uutils / uutils/coreutils

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

Open
#9,912 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - ls
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

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).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the ls long-format output path and compare how entries with and without the security-context or FACL symbol are formatted. Reproduce the provided ls -laF examples, then add regression coverage showing that link counts and later columns align in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.