GNU bug report logs - #31335
unexpected cp -f behavior

Previous Next

Package: coreutils;

Reported by: Ernesto Alfonso <erjoalgo <at> gmail.com>

Date: Tue, 1 May 2018 18:15:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pádraig Brady <P <at> draigBrady.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#31335: closed (unexpected cp -f behavior)
Date: Tue, 15 May 2018 17:07:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 15 May 2018 10:05:56 -0700
with message-id <3f747ef6-8e17-5ee1-3f3a-dcdfeace4dba <at> draigBrady.com>
and subject line Re: bug#31335: Fwd: bug#31335: unexpected cp -f behavior
has caused the debbugs.gnu.org bug report #31335,
regarding unexpected cp -f behavior
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
31335: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31335
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ernesto Alfonso <erjoalgo <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: unexpected cp -f behavior
Date: Tue, 01 May 2018 11:14:44 -0700
cp -f fails when destination is a recursive symlink:

    $ ln -s self self
    $ cat self 
    self: Too many levels of symbolic links
    $ touch a
    $ cp a self 
    cp: failed to access 'self': Too many levels of symbolic links
    $ cp -f a self 
    cp: failed to access 'self': Too many levels of symbolic links
    

From the man page:

       -f, --force
              if  an  existing destination file cannot be opened, remove it and try again (this option is ignored when
              the -n option is also used)

What am I missing?

Thanks,

Ernesto


[Message part 3 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Ernesto Alfonso <erjoalgo <at> gmail.com>, 31335-done <at> debbugs.gnu.org
Subject: Re: bug#31335: Fwd: bug#31335: unexpected cp -f behavior
Date: Tue, 15 May 2018 10:05:56 -0700
On 03/05/18 23:24, Ernesto Alfonso wrote:
> did not reply all
> 
> ---------- Forwarded message ----------
> From: Ernesto Alfonso <erjoalgo <at> gmail.com>
> Date: Thu, May 3, 2018 at 11:10 PM
> Subject: Re: bug#31335: unexpected cp -f behavior
> To: Pádraig Brady <P <at> draigbrady.com>
> 
> 
> To be honest, I think cp -f should behave consistently with rm -f.
> 
>     $ ln -s self self
>     $ rm -f self
>     $ echo $?
>     0
> 
> It's also what I would expect, if I use -f, I expect cp will do everything
> it can to force the operation and succeed if all possible.

Maybe, though that's worth further consideration.
For example rm -f doesn't do everything possible to allow deleting a file.
What if the symlinks where only temporarily dangling due to unmounted dest
for example.

I've pushed at the fix for --remove at:
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.29-36-ga391007

marking this as done

cheers,
Pádraig.


This bug report was last modified 7 years and 57 days ago.

Previous Next


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