bug-coreutils
[Top][All Lists]
Advanced

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

Re: Behaviour of cp with symlinks changed


From: Jim Meyering
Subject: Re: Behaviour of cp with symlinks changed
Date: Wed, 19 Dec 2007 21:37:53 +0100

Ignacio Fernández Galván <address@hidden> wrote:
> --- Jim Meyering <address@hidden> wrote:
>
>> Copying through a destination symlink is fundamentally risky,
>> so I've changed cp not to do it anymore.

Oops.  I have to clarify.

    Copying through a *dangling* destination symlink is fundamentally risky,
    so I've changed cp not to do it anymore.

> OK, thanks, I see.
>
>> Best is just not to do that anymore.  However, if it's something
>> you cannot easily avoid, you can do this instead:
>>
>>     $ cp -p link1 $(readlink -f link2)

Another way is simply to create the destination first:

    $ touch link2
    $ cp -p link1 link2

> Well, the problem is I don't do it, but it is sort of hardcoded in some
> other program I use, which was failing and I tracked the error down to
> this cp "feature". I will inform the maintainers of this other program.
> However, it might be a good idea to have some option to force this
> risky behaviour, maybe with --force ?

Adding an option is not impossible, but when you can get the same
effect portably by simply touching the dangling symlink,
it doesn't seem worthwhile.




reply via email to

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