bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10020: cp -i -l asks for permission to overwrite then fails to do so


From: Jim Meyering
Subject: bug#10020: cp -i -l asks for permission to overwrite then fails to do so
Date: Sat, 19 Nov 2011 17:11:42 +0100

Maximiliano Curia wrote:
> I'm reviewing some old bugs reported to Debian and found this one interesting.
>
> The problem seems to be that cp -l won't work if the file exists, and
> the -i option
> won't "force" (work as if the user has given a -f option) the deletion of the
> destination file, to make the link work.
>
> A small test could be:
>
> $ rm -rf test; ls test; mkdir test; touch test/a test/b; cp -il test/a test/b
> ls: cannot access test: No such file or directory
> cp: overwrite `test/b'? y
> cp: cannot create link `test/b': File exists
>
> So, either the question generated with the -i option shouldn't be asked, or it
> shouldn't fail.
>
> The full report can be found here:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=455522

Thanks for the report.
I agree that the current behavior is undesirable.

How could we change it? (--link (-l) is not specified by POSIX, so we may)
Here are some ways:

    - make -i -l imply --force or --remove-destination when the user
    responds with "y" (or equivalent) to the interactive prompt

    - simply change -l to imply --force or --remove-destination

However, this behavior has been with us for nearly two decades.
Is it really worth changing now?

Regardless, you can certainly use --force or --remove-destination to avoid
the failure.  Or use --backup to move any existing destination file aside.

Unless someone steps forward to work on this,
I suggest we simply close the issue as "not a big deal",
given that there are plenty of ways to work around the problem.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]