GNU bug report logs - #6023
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 6022

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6023 in the body.
You can then email your comments to 6023 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6023; Package coreutils. (Sat, 24 Apr 2010 10:32:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Salvador <salvador.mazza33 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 24 Apr 2010 10:32:05 GMT) Full text and rfc822 format available.

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

From: Salvador <salvador.mazza33 <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Re: An enhancement request for the Cp command.
Date: Sat, 24 Apr 2010 05:55:05 -0300
On 04/24/2010 05:51 AM, Salvador wrote:
> Hello.
> 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.





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6023; Package coreutils. (Sat, 24 Apr 2010 19:33:03 GMT) Full text and rfc822 format available.

Message #8 received at 6023 <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




Forcibly Merged 6022 6023. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Sat, 24 Apr 2010 19:33:03 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Sat, 24 Apr 2010 19:33:03 GMT) Full text and rfc822 format available.

Changed bug title to 'cp: Make --backup the default' from 'An enhancement request for the Cp command.' Request was from Bob Proulx <bob <at> proulx.com> to control <at> debbugs.gnu.org. (Sat, 24 Apr 2010 19:33:04 GMT) Full text and rfc822 format available.

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6023; Package coreutils. (Sun, 25 Apr 2010 02:32:02 GMT) Full text and rfc822 format available.

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

From: Drake Wyrm <wyrm <at> haell.com>
To: bug-coreutils <at> gnu.org
Subject: Re: bug#6023: An enhancement request for the Cp command.
Date: Sat, 24 Apr 2010 18:53:01 -0700
Bob Proulx <bob <at> proulx.com> wrote:
> 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.

I think what he wants is for the backup mechanism to preserve an
existing suffix on the filename by inserting the versioning token
somewhere in the middle of the filename.

Salvador: That's a tricky proposition. How do you know _where_ to put
the token? Figure out a good algorithm for determining how to rename
each of these files, starting with the easiest case and moving on from
there. Note that while I picked a couple of these to monkeywrench your
specific example above, any similar system will be susceptible to
similar weaknesses.

	somepic.jpeg
	package_sources.tar.gz
	document_part_1-1.odt
	document_part_1-2.odt
	Song no. 7.mp3
	some.people.really.name.files.like.this
	alsolikethis

-- 
There are problems in today's world that cannot be
solved by the level of thinking that created them.
  -- Albert Einstein





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Jan 2011 12:24:04 GMT) Full text and rfc822 format available.

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.