Skip to content

ls: needs padding when a security context (.) or FACL (+) symbol is present. #9912

@sgmarz

Description

@sgmarz

Currently in main branch, the columns are misaligned in long format mode if a particular directory or file has a security context or FACL indication ('.' and '+', respectively). The issue is that only one space is used if this symbol is NOT present. However, two need to be used since one of the spaces is in place of the . or + symbol.

Example of the problem:

~> rust-coreutils/target/release/coreutils ls -laF
total 4
drwxr-xr-x  1 root root   34 Dec 29 13:33 ./
drwxr-xr-x 20 root root 4096 Dec 26 12:57 ../
-rw-r--r--  1 root root    0 Dec 29 13:33 abc
drwxrwxr-x+  1 root root  302 Dec 22 20:36 cbin/
-rw-r--r--  1 root root    0 Dec 29 13:33 def
-rw-r--r--  1 root root    0 Dec 29 13:33 ghi
drwxrwxr-x+  1 root root   98 Dec 28 05:54 http/

The cbin and http directories have an ACL symbol "+", but because of that, the subsequent columns are pushed to the right by one space. Notice the link count for cbin/http lines up with the space before 'r' in root.

Example of the desired behavior on GNU coreutils v0.2.2 (arch linux x86_64):

~> ls -laF
total 4
drwxr-xr-x   1 root root   34 Dec 29 13:33 ./
drwxr-xr-x  20 root root 4096 Dec 26 12:57 ../
-rw-r--r--   1 root root    0 Dec 29 13:33 abc
drwxrwxr-x+  1 root root  302 Dec 22 20:36 cbin/
-rw-r--r--   1 root root    0 Dec 29 13:33 def
-rw-r--r--   1 root root    0 Dec 29 13:33 ghi
drwxrwxr-x+  1 root root   98 Dec 28 05:54 http/

Notice the link count numbers are properly right-aligned in GNU coreutils (0.2.2).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions