Set Strength::Quaternary on the ICU collator so that punctuation like
hyphens sort before alphanumerics in UTF-8 locales, matching GNU sort
behavior.
Fixes#12542
* fold: fix crash when reading from pseudo-devices
squashme: wraparound struct for fold
squashme: fix crash when reading from pseudo-devices
Fixes#11291
* tests/fold: add tests to read from pseudo device streams
* tests/fold: kill child process before making asserts
* tests/fold: test fold on pseudo devices only for bsds and linux
Follow-up to the metadata TOCTOU fix (#11972, PR #12439):
- Add a syscall-level regression guard in util/check-safe-traversal.sh:
under strace, head must read metadata from the open descriptor
(fstat/statx on the fd) and must not stat the path before opening it.
Verified this fails on the pre-fix code and passes after.
- Add an integration test asserting that an unreadable file produces an
error but no "==> name <==" header, matching GNU (the header is only
printed after a successful open).
- Fix a stray paren in the Windows-branch comment.
`pr -e0` on input containing a tab aborted with a remainder-by-zero panic
(`chunk.len() % expand_options.width` in `apply_expand_tab`). The
`-e[char][width]` parser accepted a width of `0` — and a negative width via
e.g. `-eX-5` — without validation, so the zero/negative reached the chunk
arithmetic.
Reject `width <= 0` while parsing `-e`, emitting the same invalid-argument
error GNU produces (`pr: '-e' extra characters or invalid number in the
argument: '0'`, exit 1) instead of crashing.
* shuf: fix panic/abort on large -i range without small --head-count
NonrepeatingIterator::new sized its sparse hash map to
min(head_count, range_len) and allocated it with the infallible
with_capacity_and_hasher. head_count defaults to u64::MAX when -n is
absent (and can be passed a huge value explicitly), so for a large -i
range the map was asked to reserve the whole range:
shuf -i 1-9999999999999999999 # no -n
shuf -i 1-9999999999999999999 -n 9999999999999999999
Both aborted (exit 134) with a hashbrown "Hash table capacity overflow"
panic or an allocator abort, where GNU prints "memory exhausted" and
exits 1.
Reserve fallibly with try_reserve (mirroring the Vec branch) and map
the failure to a clean error, so an unsatisfiable request errors like
GNU instead of crashing. A small --head-count still works unchanged.
Closes#12500.
* shuf: assert full stderr (incl. program prefix) in memory-exhausted tests
Per review on #12501: switch the two memory-exhausted regression tests
from stderr_contains to stderr_only("shuf: memory exhausted\n") so they
verify the whole stderr, including the `shuf:` program-name prefix.