Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 158615 Details for
Bug 229723
gnome-base/nautilus-2.22.3: patch for preventing recursive move/copy into itself
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
nautilus-copymove_inside_itself.patch
nautilus-copymove_inside_itself.patch (text/plain), 3.03 KB, created by
Pacho Ramos
on 2008-06-27 12:16:04 UTC
(
hide
)
Description:
nautilus-copymove_inside_itself.patch
Filename:
MIME Type:
Creator:
Pacho Ramos
Created:
2008-06-27 12:16:04 UTC
Size:
3.03 KB
patch
obsolete
>Index: libnautilus-private/nautilus-file-operations.c >=================================================================== >--- libnautilus-private/nautilus-file-operations.c (revision 14108) >+++ libnautilus-private/nautilus-file-operations.c (working copy) >@@ -3224,6 +3224,24 @@ > } > } > >+static gboolean >+g_file_struct_contains (GFile *child, GFile *root) >+{ >+ GFile *f; >+ >+ f = g_file_dup (child); >+ while (f) { >+ if (g_file_equal (f, root)) { >+ g_object_unref (f); >+ return TRUE; >+ } >+ f = g_file_get_parent (f); >+ } >+ >+ if (f) g_object_unref (f); >+ return FALSE; >+} >+ > /* Debuting files is non-NULL only for toplevel items */ > static void > copy_move_file (CopyMoveJob *copy_job, >@@ -3264,6 +3282,41 @@ > dest = get_target_file (src, dest_dir, same_fs); > } > >+ >+ /* Don't allow recursive move/copy into itself. >+ * (We would get a file system error if we proceeded but it is nicer to >+ * detect and report it at this level) */ >+ if (g_file_struct_contains (dest_dir, src)) { >+ if (job->skip_all_error) { >+ g_error_free (error); >+ goto out; >+ } >+ >+ /* the run_warning() frees all strings passed in automatically */ >+ primary = copy_job->is_move ? g_strdup (_("You cannot move a folder into itself.")) >+ : g_strdup (_("You cannot copy a folder into itself.")); >+ secondary = g_strdup (_("The destination folder is inside the source folder.")); >+ >+ response = run_warning (job, >+ primary, >+ secondary, >+ NULL, >+ GTK_STOCK_CANCEL, SKIP_ALL, SKIP, >+ NULL); >+ >+ if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { >+ abort_job (job); >+ } else if (response == 1) { /* skip all */ >+ job->skip_all_error = TRUE; >+ } else if (response == 2) { /* skip */ >+ /* do nothing */ >+ } else { >+ g_assert_not_reached (); >+ } >+ >+ goto out; >+ } >+ > retry: > > error = NULL; >@@ -3791,6 +3844,41 @@ > > dest = get_target_file (src, dest_dir, same_fs); > >+ >+ /* Don't allow recursive move/copy into itself. >+ * (We would get a file system error if we proceeded but it is nicer to >+ * detect and report it at this level) */ >+ if (g_file_struct_contains (dest_dir, src)) { >+ if (job->skip_all_error) { >+ g_error_free (error); >+ goto out; >+ } >+ >+ /* the run_warning() frees all strings passed in automatically */ >+ primary = move_job->is_move ? g_strdup (_("You cannot move a folder into itself.")) >+ : g_strdup (_("You cannot copy a folder into itself.")); >+ secondary = g_strdup (_("The destination folder is inside the source folder.")); >+ >+ response = run_warning (job, >+ primary, >+ secondary, >+ NULL, >+ GTK_STOCK_CANCEL, SKIP_ALL, SKIP, >+ NULL); >+ >+ if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { >+ abort_job (job); >+ } else if (response == 1) { /* skip all */ >+ job->skip_all_error = TRUE; >+ } else if (response == 2) { /* skip */ >+ /* do nothing */ >+ } else { >+ g_assert_not_reached (); >+ } >+ >+ goto out; >+ } >+ > retry: > > flags = G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_NO_FALLBACK_FOR_MOVE;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229723
: 158615