* du: propagate errors from --exclude-from instead of panicking
* du: update test_du with --exclude-from failures
* du: fix expected stderr in exclude-from read-error test
* do not ignore %N if specified width is smaller than default width
* add test for issue #12001
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* cargo clippy
* truncate instead of popping in a loop
* Update format_modifiers.rs
* skip truncation if width is 0
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Fixes#9749: rm -rf ./ and variants silently delete current directory
contents. The path_is_current_or_parent_directory() function did not
match paths like "./" after clean_trailing_slashes() collapsed them.
Rewrite the function to strip trailing separators, extract the last
component, and check if it is "." or "..".
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Co-authored-by: naoNao89 <naoNao89@users.noreply.github.com>
* ls: restore WASI ".." metadata fallback in collect_directory_entries
The ls refactor in #9851 dropped the WASI guard added in #11633, so
`ls -al` at a preopened root once again fails with "Capabilities
insufficient" when stat'ing "..". Extract the logic into a small
`dotdot_path` helper and add a regression test covering `ls -al`.
* Update spell-checker ignore words in test_ls.rs
* cksum: fix parsing error with tagged cheksum files
When passed the '-c'/'--check' flag, and parsing a checksum file in
the "tagged" format, cksum (symlinked to sha256sum, etc...) expects a
line that looks like this:
ShA256 (file.bin) = da39a3ee5e6b4b0d3255bfef95601890afd80709
If the hash algorithm at the beginning of the line (in the above case
SHA256) is missing, then cksum panics because it is attempts to use the
value of an array at index -1. This fix causes cksum to instead consider
the line a syntax error and ignore it, just as GNU cksum does. I also
added unit and integration tests to check for the above behaviour.
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>