bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drastic change in behaviour of "cp -ab" betwee V5.93 and V6.3


From: Jim Meyering
Subject: Re: Drastic change in behaviour of "cp -ab" betwee V5.93 and V6.3
Date: Fri, 13 Oct 2006 00:54:22 +0200

Paul Eggert <address@hidden> wrote:

> Peter Breitenlohner <address@hidden> writes:
>
>> I cannot believe that the new behaviour is intentional, and IMHO it doesn't
>> make much sense.
>
> Looking at the patch that changed the behavior:
>
> http://lists.gnu.org/archive/html/bug-coreutils/2006-08/msg00285.html
>
> it appears you're right.  That was a fix to mv, but I guess
> it inadvertently affected cp.  Jim would know more, though.

Thanks for reporting that!

Here's a barely-tested patch that restores the desired
behavior to cp, while preserving the mv bug fix:
This bears some more thought, and test cases [both coming, tomorrow].

Index: src/copy.c
===================================================================
RCS file: /fetish/cu/src/copy.c,v
retrieving revision 1.213
diff -u -p -r1.213 copy.c
--- src/copy.c  24 Sep 2006 19:28:25 -0000      1.213
+++ src/copy.c  12 Oct 2006 22:52:17 -0000
@@ -1181,7 +1181,8 @@ copy_internal (char const *src_name, cha
          if (x->backup_type != no_backups
              /* Don't try to back up a destination if the last
                 component of src_name is "." or "..".  */
-             && ! dot_or_dotdot (last_component (src_name)))
+             && ! dot_or_dotdot (last_component (src_name))
+             && (x->move_mode || ! S_ISDIR (dst_sb.st_mode)))
            {
              char *tmp_backup = find_backup_file_name (dst_name,
                                                        x->backup_type);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]