GNU bug report logs - #25261
ls -L: also allow seeing intermediate links

Previous Next

Package: coreutils;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Sat, 24 Dec 2016 15:13:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25261 in the body.
You can then email your comments to 25261 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#25261; Package coreutils. (Sat, 24 Dec 2016 15:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 24 Dec 2016 15:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-coreutils <at> gnu.org
Subject: ls -L: also allow seeing intermediate links
Date: Sat, 24 Dec 2016 20:10:21 +0800
$ 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.




Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 27 Dec 2016 21:22:02 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Tue, 27 Dec 2016 21:22:02 GMT) Full text and rfc822 format available.

Notification sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
bug acknowledged by developer. (Tue, 27 Dec 2016 21:22:03 GMT) Full text and rfc822 format available.

Message #12 received at 25261-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>,
 25261-done <at> debbugs.gnu.org, GNU bug control <control <at> debbugs.gnu.org>
Subject: Re: bug#25261: ls -L: also allow seeing intermediate links
Date: Tue, 27 Dec 2016 15:21:19 -0600
[Message part 1 (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)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#25261; Package coreutils. (Wed, 28 Dec 2016 01:05:02 GMT) Full text and rfc822 format available.

Message #15 received at 25261-done <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Eric Blake <eblake <at> redhat.com>
Cc: 25261-done <at> debbugs.gnu.org
Subject: Re: bug#25261: ls -L: also allow seeing intermediate links
Date: Wed, 28 Dec 2016 09:04:16 +0800
OK. Perhaps on
(info "(coreutils) Which files are listed")

At
‘-L’
‘--dereference’
     When showing file information for a symbolic link, show information
     for the file the link references rather than the link itself.
     However, even with this option, ‘ls’ still prints the name of the
     link itself, not the name of the file that the link points to.

perhaps mention that one in fact might see to the end of a long chain...
and to see intermediate steps See Also: readlink.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 25 Jan 2017 12:24:03 GMT) Full text and rfc822 format available.

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.