bug-coreutils
[Top][All Lists]
Advanced

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

Re: 'cp -lL' behaviour conflicts with documentation


From: Jim Meyering
Subject: Re: 'cp -lL' behaviour conflicts with documentation
Date: Tue, 15 Mar 2005 18:35:13 +0100

Tim Waugh <address@hidden> wrote:
> On Tue, Mar 15, 2005 at 04:38:03PM +0100, Jim Meyering wrote:
...
>> Thanks for the report.
>> I suppose this is a documentation bug, since
>> making hard links to symlinks is not portable.
>> I suppose -L and -l should mention that when they are used
>> together, cp may try to make hard links to symbolic links.
>
> It isn't obvious to me that a hardlink to a symbolic link would be
> created.  Why isn't a hard link to the referent created?
>
> The --help output says:
>
>   -L, --dereference            always follow symbolic links
>
> so it's quite surprising that an operation occurs on the link itself
> rather than the referent, regardless of whether the operation is to
> copy or to make a hard link to.
>
> Surely the non-portability of making hard links to symlinks would only
> occur if -L was _omitted_ from the argument list?

But the actual referent (as opposed to the symlink value) may be
another symlink, which may point to another, etc.  The final
non-symlink value -- assuming there is one -- is the referent.
It'd be easy if there were an flink syscall.  Then
you'd just open the symlink (which would open the referent)
and use flink to create a hard link to the file behind
the descriptor.

Is it worth it to make cp manually follow a sequence of symlinks
when given both -L and --link?




reply via email to

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