GNU bug report logs -
#25261
ls -L: also allow seeing intermediate links
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#25261: ls -L: also allow seeing intermediate links
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 25261 <at> debbugs.gnu.org.
--
25261: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25261
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
tag 25261 notabug
thanks
On 12/24/2016 06:10 AM, 積丹尼 Dan Jacobson wrote:
> $ man ls
> -L, --dereference
> when showing file information for a symbolic link, show informa-
> tion for the file the link references rather than for the link
> itself
>
> Ah ah ah... so one can only see the first (no -L) or last (-L) of a
> e.g., long chain of symbolic links.
Correct, because that's all the kernel gives you, via lstat() (no -L) or
stat() (-L). Since the kernel has no atomic way to stop halfway through
a chain of symlink resolution (other than the fact that it stops with
ELOOP if the chain would resolve but not in the amount of finite
resources the kernel is willing to allot to the resolution), the best
you could do is non-atomic approximations by a series of readlink()
kernel calls, if you don't mind being subject to a TOCTTOU race condition.
> Perhaps add a --symbolic-link-depth
> option to be able to see where an arbitrary depth of symbolic links
> points to.
You can already use the readlink and/or realpath utilities to follow a
chain of symlinks one link at a time. And ls is already bloated enough
that the bar is REALLY high for adding any new options, especially if
the option is not already existing practice in some other
implementation, or if the action could be performed via other existing
command line tools.
> Or add a -L1, -L6, -L14 ... option.
Not possible. There is no way using getopt_long() to differentiate
plain '-L' to mean something different than '-L1' - it gets parsed the
same as '-L -1'. And we are not going to turn -L from no argument into
an optional argument, as that would break existing users.
Because what you seem to want is already available through readlink, I'm
closing this as not a bug. But feel free to add further arguments, or
propose a patch rather than just idle musings if you think there is more
that we're overlooking.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
[Message part 5 (message/rfc822, inline)]
$ man ls
-L, --dereference
when showing file information for a symbolic link, show informa-
tion for the file the link references rather than for the link
itself
Ah ah ah... so one can only see the first (no -L) or last (-L) of a
e.g., long chain of symbolic links. Perhaps add a --symbolic-link-depth
option to be able to see where an arbitrary depth of symbolic links
points to. Or add a -L1, -L6, -L14 ... option.
This bug report was last modified 8 years and 233 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.