Subject: bug#31335: closed (Re: bug#31335: Fwd: bug#31335: unexpected cp -f behavior)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 15 May 2018 17:07:02 +0000

Your bug report

#31335: unexpected cp -f behavior

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
31335: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=31335
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#31335: Fwd: bug#31335: unexpected cp -f behavior
From: Pádraig Brady <[email-masked]>
To: Ernesto Alfonso <[email-masked]>, [email-masked]
Date: Tue, 15 May 2018 10:05:56 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 03/05/18 23:24, Ernesto Alfonso wrote:
> did not reply all
> 
> ---------- Forwarded message ----------
> From: Ernesto Alfonso <[email-masked]>
> Date: Thu, May 3, 2018 at 11:10 PM
> Subject: Re: bug#31335: unexpected cp -f behavior
> To: Pádraig Brady <[email-masked]>
> 
> 
> 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.

Subject: unexpected cp -f behavior
From: Ernesto Alfonso <[email-masked]>
To: [email-masked]
Date: Tue, 01 May 2018 11:14:44 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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