Repository navigation
ls: accept a leading ' in --block-size and group digits - #16961
Merged
Merged
Conversation
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9084.
ls -l --block-size="'1"failed with "invalid --block-size argument". GNU ls takes the leading'to mean "group the digits with the locale's thousands separator".dualready handles this,lsdidn't.Now
lsstrips the'before parsing the size and groups the numbers in the size column, the-scolumn and thetotalline. In the C locale there is no separator, so the output is unchanged.The width of those columns used to be counted in bytes. With fr_FR the separator is U+202F, which is 3 bytes, so the columns came out too wide. I count chars there now. This only changes anything when the separator is non-ASCII.
I compared the output with GNU ls 9.12 on macOS in C, en_US.UTF-8 and fr_FR.UTF-8, with a few files of different sizes and on /usr/bin. They match. The month name in fr_FR is still different, but that is a separate thing.
Not in this PR:
LS_BLOCK_SIZE="'1"/BLOCK_SIZE="'1"from the environment. I can do that in a follow-up.I used an AI assistant for parts of this. I checked the diff and the GNU comparison myself.