uutils/coreutils

sort --files0-from Requires UTF-8 / Panics on Non‑UTF‑8 Filenames

Open

#9.696 geöffnet am 18. Dez. 2025

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)Rust (1.852 Forks)batch import
U - sortgood first issuereported-canonical

Repository-Metriken

Stars
 (23.246 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 9T 14h) (216 gemergte PRs in 30 T)

Beschreibung

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=1 environment variable to display a backtrac

Impact

This can cause crashes and is incompatible with GNU in terms of "allowing arbitrary byte filenames".

Contributor Guide