uutils/coreutils

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

已關閉

#9,696 建立於 2025年12月18日

 (1 則留言) (0 個反應) (0 位負責人)Rust (1,981 個分叉)batch import
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=1 environment variable to display a backtrac

Impact

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

貢獻者指南