bug-coreutils
[Top][All Lists]
Advanced

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

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


From: Peter Breitenlohner
Subject: Drastic change in behaviour of "cp -ab" betwee V5.93 and V6.3
Date: Thu, 12 Oct 2006 18:33:36 +0200 (CEST)

We have noticed that the behaviour of
        cp -ab
has drastically changed between somewhere Versions 5.93 and 6.3.

The old version didn't backup existing directories, but the new one does
make such backups (i.e., moves a destination directory FOO to FOO~).

We consider this new behaviour highly undesirable. The command "cp -ab" is
often used as a primitive backup tool, keeping a few old versions of some
subtree of the file system.

Consider a tree
        SRC/foo/a
        SRC/foo/A_DIRECTORY_CONTAINING_MANY_FILES_AND_SUBDIRS
and a copy produced by
        cp -ab SRC DST
Now assume the file SRC/foo/a has been changed (and consequently the
timestamp of SRC/foo has changed as well). Using the command
        cp -ab SRC DST
again, the old behaviour was to rename DST/foo/a into DST/foo/a~ and
copy SRC/foo/a to DST/foo/a.

The new behaviour is to rename DST/foo into DST/foo~ and recursively copy
SRC/foo to DST/foo.

====================================================

Looking at the souce code the different behaviour seems to be caused by
changing coreutils-5.93/src/copy.c line 1116

          if (x->backup_type != no_backups && !S_ISDIR (dst_sb.st_mode))

into coreutils-6.3/src/copy.c lines 1181ff

          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)))

====================================================

I cannot believe that the new behaviour is intentional, and IMHO it doesn't
make much sense.

Unless you can give very good reasons for the new behaviour we would like to
ask to restore the 5.93 behavior.

regards
Peter Breitenlohner <address@hidden>




reply via email to

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