uutils/coreutils
sort --files0-from Requires UTF-8 / Panics on Non‑UTF‑8 Filenames
已关闭
#9,696 创建于 2025年12月18日
U - sortgood first issuereported-canonical
仓库指标
- 星标
- (23,893 个星标)
- PR 合并指标
- (平均合并 5天 23小时) (30 天内合并 239 个 PR)
描述
Component
sort
Description
When parsing NUL-separated filenames via --files0-from, uutils enforces UTF-8 and uses expect(), which causes an immediate panic when encountering valid non-UTF-8 paths; GNU treats filenames as raw bytes and does not require UTF-8 encoding.
Test / Reproduction Steps
open(b"weird\xffname", "wb").write(b"20\n10\n")
open("list0", "wb").write(b"weird\xffname\0")
$ ./target/release/coreutils sort --files0-from=list0
- GNU: 10 20
- uutils:
thread 'main' (1535230) panicked at src/uu/sort/src/sort.rs:1076:18:
Could not parse string from zero terminated input.: Utf8Error { valid_up_to: 5, error_len: Some(1) }
note: run with
RUST_BACKTRACE=1environment variable to display a backtrac
Impact
This can cause crashes and is incompatible with GNU in terms of "allowing arbitrary byte filenames".