GNU bug report logs - #36220
ls -l: maddening mixed left right justifications with numeric ids

Previous Next

Package: coreutils;

Reported by: Dan Jacobson <jidanni <at> jidanni.org>

Date: Sat, 15 Jun 2019 03:30:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 36220 in the body.
You can then email your comments to 36220 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#36220; Package coreutils. (Sat, 15 Jun 2019 03:30: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, 15 Jun 2019 03:30: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: maddening mixed left right justifications with numeric ids
Date: Sat, 15 Jun 2019 10:35:10 +0800
Some files might only have numeric user ids,

# ls -l
-rw-r--r-- 1  777 root   0 06-15 10:14 a
-rw-r--r-- 1 root 777777 0 06-15 10:11 b
-rw-r--r-- 1 root root   0 06-15 10:12 c
-rw-r--r-- 1 root    777 0 06-15 10:12 d

Well it turns out an undocumented feature is that numeric ids are
justified in the opposite direction of regular ids.

Makes sense, however it wreaks havoc in the above mixed situations.

The only way to get columns to line up in such mixed situations is

# ls -ln
-rw-r--r-- 1 777      0 0 06-15 10:14 a
-rw-r--r-- 1   0 777777 0 06-15 10:11 b
-rw-r--r-- 1   0      0 0 06-15 10:12 c
-rw-r--r-- 1   0    777 0 06-15 10:12 d

but that sacrifices the names.

Well at least on (info "(coreutils) What information is listed") at

‘-n’
‘--numeric-uid-gid’
     Produce long format directory listings, but display numeric user
     and group IDs instead of the owner and group names.

document that "Note that numeric ids are always right justified."

ls (GNU coreutils) 8.30




Information forwarded to bug-coreutils <at> gnu.org:
bug#36220; Package coreutils. (Mon, 17 Jun 2019 14:07:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Dan Jacobson <jidanni <at> jidanni.org>, 36220 <at> debbugs.gnu.org
Subject: Re: bug#36220: ls -l: maddening mixed left right justifications with
 numeric ids
Date: Mon, 17 Jun 2019 15:06:44 +0100
On 15/06/19 03:35, Dan Jacobson wrote:
> Some files might only have numeric user ids,
> 
> # ls -l
> -rw-r--r-- 1  777 root   0 06-15 10:14 a
> -rw-r--r-- 1 root 777777 0 06-15 10:11 b
> -rw-r--r-- 1 root root   0 06-15 10:12 c
> -rw-r--r-- 1 root    777 0 06-15 10:12 d

I guess the numeric IDs are usually the minority in the mixed case,
so it would be best to align left in that case?
Are mixed names/IDs a common case for you?
I.E. is it worth worrying about this?
It's easy enough to fix, but it would be nice
to know if it was a common issue, as I've not encountered it at least.

cheers,
Pádraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#36220; Package coreutils. (Mon, 17 Jun 2019 15:13:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Dan Jacobson <jidanni <at> jidanni.org>, 36220 <at> debbugs.gnu.org
Subject: Re: bug#36220: ls -l: maddening mixed left right justifications with
 numeric ids
Date: Mon, 17 Jun 2019 16:12:26 +0100
[Message part 1 (text/plain, inline)]
On 17/06/19 15:06, Pádraig Brady wrote:
> On 15/06/19 03:35, Dan Jacobson wrote:
>> Some files might only have numeric user ids,
>>
>> # ls -l
>> -rw-r--r-- 1  777 root   0 06-15 10:14 a
>> -rw-r--r-- 1 root 777777 0 06-15 10:11 b
>> -rw-r--r-- 1 root root   0 06-15 10:12 c
>> -rw-r--r-- 1 root    777 0 06-15 10:12 d
> 
> I guess the numeric IDs are usually the minority in the mixed case,
> so it would be best to align left in that case?
> Are mixed names/IDs a common case for you?
> I.E. is it worth worrying about this?
> It's easy enough to fix, but it would be nice
> to know if it was a common issue, as I've not encountered it at least.

Patch attached to do as described above

[ls-align-id.diff (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#36220; Package coreutils. (Mon, 17 Jun 2019 23:02:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Pádraig Brady <P <at> draigBrady.com>,
 Dan Jacobson <jidanni <at> jidanni.org>, 36220 <at> debbugs.gnu.org
Subject: Re: bug#36220: ls -l: maddening mixed left right justifications with
 numeric ids
Date: Mon, 17 Jun 2019 16:01:38 -0700
On 6/17/19 8:12 AM, Pádraig Brady wrote:
> Patch attached to do as described above

I prefer the current ("maddening") behavior, as it gives the reader a 
useful signal that the user is numeric rather than textual. This is 
particularly important when a user name consists entirely of digits, 
which is allowed on some systems. In that case, left alignment of a 
string like "7777" means it's a textual user name, whereas right 
alignment means it's a numeric user ID. Admittedly the disambiguation is 
not perfect (as there is no cue when the user name has the maximum 
width) but it's helpful in common practice.

I thought this was all documented somewhere - at least, it was a 
conscious decision when I wrote that code long ago.





Information forwarded to bug-coreutils <at> gnu.org:
bug#36220; Package coreutils. (Tue, 18 Jun 2019 02:36:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 36220 <at> debbugs.gnu.org
Subject: Re: bug#36220: ls -l: maddening mixed left right justifications with
 numeric ids
Date: Tue, 18 Jun 2019 10:34:53 +0800
>>>>> "PB" == Pádraig Brady <P <at> draigBrady.com> writes:
PB> to know if it was a common issue, as I've not encountered it at least.

Well as the anbox Android emulator could possibly become very popular,
ls should be ready for a big influx of numeric ids.




Information forwarded to bug-coreutils <at> gnu.org:
bug#36220; Package coreutils. (Tue, 18 Jun 2019 02:40:02 GMT) Full text and rfc822 format available.

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

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 36220 <at> debbugs.gnu.org, Pádraig Brady <P <at> draigBrady.com>
Subject: Re: bug#36220: ls -l: maddening mixed left right justifications with
 numeric ids
Date: Tue, 18 Jun 2019 10:39:27 +0800
>>>>> "PE" == Paul Eggert <eggert <at> cs.ucla.edu> writes:
PE> On 6/17/19 8:12 AM, Pádraig Brady wrote:

PE> I prefer the current ("maddening") behavior, as it gives the reader a
PE> useful signal that the user is numeric rather than textual. This is
PE> particularly important when a user name consists entirely of digits,
PE> which is allowed on some systems. In that case, left alignment of a
PE> string like "7777" means it's a textual user name, whereas right
PE> alignment means it's a numeric user ID. Admittedly the disambiguation
PE> is not perfect (as there is no cue when the user name has the maximum
PE> width) but it's helpful in common practice.

PE> I thought this was all documented somewhere - at least, it was a
PE> conscious decision when I wrote that code long ago.

Indeed all you need to do would me mention the logic there on INFO "ls"
and we would realize that this was actually a feature.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 18 Jun 2019 07:34:03 GMT) Full text and rfc822 format available.

Notification sent to Dan Jacobson <jidanni <at> jidanni.org>:
bug acknowledged by developer. (Tue, 18 Jun 2019 07:34:03 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 36220-done <at> debbugs.gnu.org,
 Pádraig Brady <P <at> draigBrady.com>
Subject: Re: bug#36220: ls -l: maddening mixed left right justifications with
 numeric ids
Date: Tue, 18 Jun 2019 00:33:44 -0700
[Message part 1 (text/plain, inline)]
積丹尼 Dan Jacobson wrote:
> Indeed all you need to do would me mention the logic there on INFO "ls"
> and we would realize that this was actually a feature.

OK, I installed the attached and am marking this bug as done.
[0001-doc-mention-ls-l-user-group-justification.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 16 Jul 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 257 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.