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

Jindrich Novy jnovy at fedoraproject.org
Thu Sep 2 09:10:53 UTC 2010


commit bca2c47c055ac418e3eb093a1fe10b7c0a1641b5
Author: Jindrich Novy <jnovy at redhat.com>
Date:   Thu Sep 2 11:10:42 2010 +0200

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

 mc-dircopying.patch |   38 ++++++++++++++++++++++++++++++++++++++
 mc.spec             |    7 ++++++-
 2 files changed, 44 insertions(+), 1 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 a06f5f4..a55da11 100644
--- a/mc.spec
+++ b/mc.spec
@@ -1,7 +1,7 @@
 Summary:	User-friendly text console file manager and visual shell
 Name:		mc
 Version:	4.7.3
-Release:	2%{?dist}
+Release:	3%{?dist}
 Epoch:		1
 License:	GPLv2
 Group:		System Environment/Shells
@@ -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"
@@ -89,6 +91,9 @@ rm -rf $RPM_BUILD_ROOT
 %dir %{_libexecdir}/mc/extfs.d
 
 %changelog
+* Thu Sep  2 2010 Jindrich Novy <jnovy at redhat.com> 4.7.3-3
+- fix broken directory copying, backport from upstream (#624973)
+
 * Wed Sep  1 2010 Jindrich Novy <jnovy at redhat.com> 4.7.3-2
 - fix segfault in advanced chown dialog (#625801)
 


More information about the scm-commits mailing list