Repository navigation
Conversation
Briefly lists directory contents, with -a, -C, -1, -R, -r, -S, -t, -w and the long -- spellings. Listing and sorting live in common/dir; src/dir is a thin main. -R prefixes each subdirectory with its path and separates it with a blank line, and it descends after its parent has been printed rather than depth-first. Three behaviours were wrong on the first attempt and were caught by comparison rather than by reading: the default layout is columns separated by two spaces, not one line per entry; -a has to synthesise the . and .. entries because os.ls omits them; and a path that cannot be accessed exits 2 rather than 1. -S is the one case where this port deliberately does not match uutils. GNU puts directories first when sorting by size because a directory reports a larger size than a two-byte file; uutils on Windows puts them last. Both were measured on the same tree, GNU through WSL, and GNU is the authority, so the suite pins GNU's order. Multi-column wrapping when the names do not fit the line width is not implemented, and the trailing-space case is pinned by a test.
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.
dirbriefly lists directory contents, with-a,-C,-1,-R,-r,-S,-t,-wand the long--spellings.Listing and sorting live in
common/dir;src/diris a thin main.-Rprefixes each subdirectory with its path and separates it with a blank line, descending after its parent has been printed rather than depth-first.Three behaviours were wrong on the first attempt and were caught by comparison rather than by reading: the default layout is columns separated by two spaces, not one line per entry;
-ahas to synthesise the.and..entries becauseos.lsomits them; and a path that cannot be accessed exits 2 rather than 1. All three are pinned by tests.A control run confirms the suite has teeth: breaking the column separator from two spaces to one turns
test_default_is_columns_not_one_per_line,test_all_includes_dot_entriesandtest_reversered.One deliberate divergence, and the reason it is worth a reviewer's attention. GNU and uutils disagree about
-S. On a tree of two 2-byte files and a directory, GNU orderssub one.txt two.txt— directories first, because a directory reports a larger size — while uutils on Windows ordersone.txt two.txt sub. Both were measured on the same tree, GNU through WSL. This port follows GNU andtest_size_sort_puts_directories_firstpins that order with the disagreement written into the test.Multi-column wrapping when the names do not fit the line width is not implemented; the single-line case is what the reference and the tests cover.