GNU bug report logs - #6022
cp: Make --backup the default

Previous Next

Package: coreutils;

Reported by: Salvador <salvador.mazza33 <at> gmail.com>

Date: Sat, 24 Apr 2010 10:32:05 UTC

Severity: wishlist

Tags: moreinfo

Merged with 6023

Done: Bob Proulx <bob <at> proulx.com>

Bug is archived. No further changes may be made.

Full log


Message #9 received at control <at> debbugs.gnu.org (full text, mbox):

From: Bob Proulx <bob <at> proulx.com>
To: Salvador <salvador.mazza33 <at> gmail.com>
Cc: 6023 <at> debbugs.gnu.org
Subject: Re: bug#6023: An enhancement request for the Cp command.
Date: Sat, 24 Apr 2010 13:32:19 -0600
forcemerge 6022 6023
severity 6023 wishlist
tags 6023 + moreinfo
retitle 6023 cp: Make --backup the default
thanks

Salvador wrote:
> Salvador wrote:
>> I want to request a feature for the Cp command that consist in  
>> renaming a file from the source when a file in the destination  
>> directory with the same name already exists. I am thought It could be  
>> something like: from file.jpg to file-1.jpg.
>> This behavior already exists in Web browsers and file managers.
>> Thanks.
> Also, I know about the backup argument but it makes the file not being  
> possible to use by some programs without being renamed.

As you say the feature already exists with 'cp --backup[=CONTROL]' and
therefore you already have that behavior available to you.  If I
understand what you are saying then you are asking for it to be made
the default behavior.  But if that were done it would break 40 years
of Unix behavior.  It is not wise to make such changes.  In order to
stabilize the Unix API the POSIX standard defines the cp behavior that
everyone can rely upon having here:

  http://www.opengroup.org/onlinepubs/009695399/utilities/cp.html

If you desire to have a command that defaults to making a backup all
of the time you may easily do so by creating a differently named
command.  This would avoid breaking legacy applications because it
wouldn't change the behavior of the cp command upon which everyone
counts on.  You could name it 'cpbak' or some such name.

  #!/bin/sh
  exec cp --backup "$@"

Bob




This bug report was last modified 14 years and 209 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.