coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

ls: Compatibility Tracking Issue

Open tertsdiepraam opened this issue 4 years ago • 16 comments

I've made an overview of all options that need to be added and defaults that need to be changed in ls to reach full compatibility with GNU ls. I hope this might help people out who want to contribute, without adding to many issues to the issue list.

The items marked with :one: are the ones I think make Good First Issues.

  • [x] Formats
    • [x] -x & --format=across & --format=horizontal
    • [x] -m & --format=commas
    • [x] Make -n overrideable (similar to -o and -g)
  • [ ] Date & time
    • [x] --time=birth & --time=creation
    • [x] --time-style=full-iso
    • [x] --time-style=long-iso
    • [x] --time-style=iso
    • [ ] --time-style=locale (works, but not locale-specific yet)
    • [ ] --time-style=+FORMAT like in date
    • [ ] posix- prefix for --time-style
    • [x] --full-time
    • [x] Default: follow environment variable TIME_STYLE or locale
  • [ ] Escaping and quoting
    • [x] -b. --escape& --quoting-style=escape
    • [x] -Q, --quote-name & --quoting-style=c
    • [x] -N, --literal & --quoting-style=literal
    • [x] --quoting-style=shell & --quoting-style=shell-always
    • [x] --quoting-style=shell-escape & --quoting-style=shell-escape-always
    • [ ] --quoting-style=locale
    • [ ] --quoting-style=clocale
    • [x] Default: follow environment variable QUOTING_STYLE or shell-escape.
    • [x] Space in front of file names without quotes if there are names with quotes.
  • [x] Control characters
    • [x] -q & --hide-control-characters
    • [x] --show-control-characters
    • [x] Set default to -q if the output is a terminal.
  • [ ] Sorting
    • [x] -U & --sort=none
    • [x] -v & --sort=version (also used in sort, so might make sense to put this in uucore)
    • [x] -X & --sort=extension
    • [ ] Make sorting by name locale-specific (currently only C-locale is implemented). Among other problems, this causes a behaviour where hidden files (prefixed with ".") are sorted before other files, instead of the leading "." being ignored.
    • [x] :one: --group-directories-first
    • [ ] -f (enable -aU, disable -ls --color)
  • [x] Dereferencing
    • [x] -H & --dereference-command-line
    • [x] --dereference-command-line-symlink-to-dir
  • [x] Hiding
    • [x] --hide
    • [x] -I & --ignore
  • [x] Indicator style
    • [x] --indicator-style with options: none, slash, file-type, classify
    • [x] -p (equivalent to --indicator-style=slash)
    • [x] --file-type (equivalent to --indicator-style=file-type)
  • [ ] Block size (these should mainly be implemented in uucore, since they are used by multiple programs)
    • [ ] -s & --size
    • [ ] -k & --kibibytes (equivalent to --block-size=1K)
    • [x] --block-size
    • [x] Default: Determine block size from environment variables.
  • [ ] Loose ends: The options that didn't fit into the categories above
    • [x] -w & --width
    • [ ] -T & --tabsize
    • [ ] -Z & --context
    • [ ] -D & --dired
    • [x] --hyperlink
    • [x] Show total size of directories in the long format

tertsdiepraam avatar Mar 22 '21 15:03 tertsdiepraam

Bravo for this work!

Don't hesitate to create new issues as "good first bugs"!

sylvestre avatar Mar 22 '21 15:03 sylvestre

@tertsdiepraam That's another few points to tick off

LevitatingBusinessMan avatar Apr 28 '21 19:04 LevitatingBusinessMan

@LevitatingBusinessMan Thanks for reminding me!

tertsdiepraam avatar Apr 28 '21 19:04 tertsdiepraam

@tertsdiepraam Don't forget the posix time-styles. And the TIME_STYLE environemntal variable works already.

LevitatingBusinessMan avatar Apr 28 '21 19:04 LevitatingBusinessMan

Nice list :) - I was implementing 'total size' related feature which I noticed to be missing from output. I think it aligns with the last item in the list?

siebenHeaven avatar May 03 '21 15:05 siebenHeaven

Yes, that's what that was supposed to be! I rewrote it a bit to make it clearer (hopefully). Looking forward to the PR!

tertsdiepraam avatar May 03 '21 16:05 tertsdiepraam

Thanks for confirming - it was already clear as is, I just was double confirming.

siebenHeaven avatar May 03 '21 18:05 siebenHeaven

@sylvestre did you close this by mistake?

LevitatingBusinessMan avatar May 05 '21 21:05 LevitatingBusinessMan

nah, it was closed when the PR has been merged!

sylvestre avatar May 05 '21 21:05 sylvestre

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 20 '23 04:01 stale[bot]

Set default to -q if the output is a terminal.

The IsTerminal trait was stabilized in 1.70.0 recently. So this feature should be trivial to implement once we move the minimum rust version up.

LevitatingBusinessMan avatar Jun 14 '23 12:06 LevitatingBusinessMan

Indeed! We're also using the is_terminal crate in other utils, which has the same interface, I think. So this should be pretty easy to do.

tertsdiepraam avatar Jun 14 '23 13:06 tertsdiepraam

https://github.com/uutils/coreutils/blob/main/src/uu/ls/src/ls.rs#L830-L837

Judging by this code, this is already done. Though I am not sure if it is correctly tested.

LevitatingBusinessMan avatar Jun 14 '23 16:06 LevitatingBusinessMan

We probably can't really test it. I'll mark it as done in the list. Thanks!

tertsdiepraam avatar Jun 14 '23 17:06 tertsdiepraam

was this one completed?

keys-i avatar May 02 '24 01:05 keys-i

nope, we still have some options not passing compared to GNU

sylvestre avatar Jun 17 '24 14:06 sylvestre