[mc/f13/master] fix broken directory copying, backport from upstream (#624973)

Jindrich Novy jnovy at fedoraproject.org
Thu Sep 2 09:15:05 UTC 2010


commit f6590fcee6a71a481219f78e8b8ec7856a3f78ae
Author: Jindrich Novy <jnovy at redhat.com>
Date:   Thu Sep 2 11:15:01 2010 +0200

    fix broken directory copying, backport from upstream (#624973)

 mc-dircopying.patch |   38 ++++++++++++++++++++++++++++++++++++++
 mc.spec             |    3 +++
 2 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/mc-dircopying.patch b/mc-dircopying.patch
new file mode 100644
index 0000000..485adcc
--- /dev/null
+++ b/mc-dircopying.patch
@@ -0,0 +1,38 @@
+diff --git a/src/file.c b/src/file.c
+index d7eaa46..5c45dcf 100644
+--- a/src/file.c
++++ b/src/file.c
+@@ -2066,28 +2066,21 @@ panel_operate (void *source_panel, FileOperation operation, gboolean force_singl
+             dest_dir = other_panel->cwd;
+         else
+             dest_dir = panel->cwd;
+-
+         /*
+          * Add trailing backslash only when do non-local ops.
+          * It saves user from occasional file renames (when destination
+          * dir is deleted)
+          */
+-        if (force_single || dest_dir[0] == '\0')
+-        {
+-            /* just copy */
+-            dest_dir_ = g_strdup (dest_dir);
+-        }
+-        else if (single_entry)
++        if (!force_single && dest_dir[0] != '\0' && dest_dir[strlen (dest_dir) - 1] != PATH_SEP)
+         {
+-            /* add filename to dest path */
+-            dest_dir_ = g_build_filename (dest_dir, source, (char *) NULL);
++            /* add trailing separator */
++            dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR, (char *) NULL);
+         }
+         else
+         {
+-            /* add trailing separator */
+-            dest_dir_ = g_strconcat (dest_dir, PATH_SEP_STR, (char *) NULL);
++            /* just copy */
++            dest_dir_ = g_strdup (dest_dir);
+         }
+-
+         if (dest_dir_ == NULL)
+         {
+             file_op_total_context_destroy (tctx);
diff --git a/mc.spec b/mc.spec
index 1b995c8..e9cff70 100644
--- a/mc.spec
+++ b/mc.spec
@@ -15,6 +15,7 @@ Requires:	dev >= 3.3-3
 Patch0:		mc-extensions.patch
 Patch1:		mc-mcviewsegfault.patch
 Patch2:		mc-achownsegfault.patch
+Patch3:		mc-dircopying.patch
 
 %description
 Midnight Commander is a visual shell much like a file manager, only
@@ -28,6 +29,7 @@ specific files.
 %patch0 -p1 -b .extensions
 %patch1 -p1 -b .mcviewsegfault
 %patch2 -p1 -b .achownsegfault
+%patch3 -p1 -b .dircopying
 
 %build
 export CFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $RPM_OPT_FLAGS"
@@ -91,6 +93,7 @@ rm -rf $RPM_BUILD_ROOT
 %changelog
 * Wed Sep  1 2010 Jindrich Novy <jnovy at redhat.com> 4.7.3-2
 - fix segfault in advanced chown dialog (#625801)
+- fix broken directory copying, backport from upstream (#624973)
 
 * Fri Jul  9 2010 Jindrich Novy <jnovy at redhat.com> 4.7.3-1
 - update to 4.7.3 (fixes #577960, #603184)


More information about the scm-commits mailing list