GNU bug report logs - #11427
cp 8.16 not writing through, writing over

Previous Next

Package: coreutils;

Reported by: karl <at> freefriends.org (Karl Berry)

Date: Mon, 7 May 2012 13:22:02 UTC

Severity: normal

Tags: notabug

Done: Jim Meyering <jim <at> meyering.net>

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 11427 in the body.
You can then email your comments to 11427 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 bug-coreutils <at> gnu.org:
bug#11427; Package coreutils. (Mon, 07 May 2012 13:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to karl <at> freefriends.org (Karl Berry):
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 07 May 2012 13:22:03 GMT) Full text and rfc822 format available.

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

From: karl <at> freefriends.org (Karl Berry)
To: bug-coreutils <at> gnu.org
Subject: cp 8.16 not writing through, writing over
Date: Mon, 7 May 2012 13:19:02 GMT
Create dangling symlink:
$ ln -s foo bar

Attempt to write over it with cp:
$ \cp -i /etc/issue bar
cp: not writing through dangling symlink 'bar'

In the past, it would ask me if I wanted to replace bar.  (As desired.)

The error message makes me think that it is thinking I am writing
"through" a dangling symlink to a directory.  But that gets
a different error message, which seems fine:
$ \cp -i /etc/issue bar/baz
cp: cannot create regular file 'bar/baz': No such file or directory

coreutils 8.16, compiled from original source on CentOS 5.8 (libc 2.5, 
it seems).

karl




Information forwarded to bug-coreutils <at> gnu.org:
bug#11427; Package coreutils. (Mon, 07 May 2012 17:08:01 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: karl <at> freefriends.org (Karl Berry)
Cc: 11427 <at> debbugs.gnu.org
Subject: Re: bug#11427: cp 8.16 not writing through, writing over
Date: Mon, 07 May 2012 19:05:18 +0200
Karl Berry wrote:
> Create dangling symlink:
> $ ln -s foo bar
>
> Attempt to write over it with cp:
> $ \cp -i /etc/issue bar
> cp: not writing through dangling symlink 'bar'
>
> In the past, it would ask me if I wanted to replace bar.  (As desired.)

Hi Karl,

When I try that in an empty directory and using coreutils-6.7's cp
(which predates the change mentioned below), it does this:

    $ ln -s foo bar
    $ env cp -i /etc/issue bar                                :
    cp: cannot create regular file `bar': File exists

Maybe you want to use --backup?

> The error message makes me think that it is thinking I am writing
> "through" a dangling symlink to a directory.  But that gets
> a different error message, which seems fine:
> $ \cp -i /etc/issue bar/baz
> cp: cannot create regular file 'bar/baz': No such file or directory
>
> coreutils 8.16, compiled from original source on CentOS 5.8 (libc 2.5,
> it seems).

[quick answer: set POSIXLY_CORRECT]

That behavior change dates back to 2007.
Here's the NEWS snippet:


    * Noteworthy changes in release 6.9.90 (2007-12-01) [beta]
      ...
    ** Changes in behavior

      cp, by default, refuses to copy through a dangling destination symlink
      Set POSIXLY_CORRECT if you require the old, risk-prone behavior.


There's more detail here:

  http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2bdc48121916ab0d7bb7d

and even more on the mailing list just before I made that change.




Added tag(s) notabug. Request was from Jim Meyering <jim <at> meyering.net> to control <at> debbugs.gnu.org. (Tue, 08 May 2012 19:52:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 11427 <at> debbugs.gnu.org and karl <at> freefriends.org (Karl Berry) Request was from Jim Meyering <jim <at> meyering.net> to control <at> debbugs.gnu.org. (Tue, 08 May 2012 19:52:01 GMT) Full text and rfc822 format available.

Message #13 received at 11427-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: 11427-done <at> debbugs.gnu.org
Subject: Re: bug#11427: cp 8.16 not writing through, writing over
Date: Tue, 08 May 2012 21:49:03 +0200
tags 11427 + notabug
close 11427
thanks

Jim Meyering wrote:
...
> [quick answer: set POSIXLY_CORRECT]
>
> That behavior change dates back to 2007.
> Here's the NEWS snippet:
>
>
>     * Noteworthy changes in release 6.9.90 (2007-12-01) [beta]
>       ...
>     ** Changes in behavior
>
>       cp, by default, refuses to copy through a dangling destination symlink
>       Set POSIXLY_CORRECT if you require the old, risk-prone behavior.
>
>
> There's more detail here:
>
>   http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=2bdc48121916ab0d7bb7d
>
> and even more on the mailing list just before I made that change.

Karl mentioned off-list that this can be closed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 Jun 2012 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 12 days ago.

Previous Next


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