uutils/findutils

`-printf` panics on an invalid-UTF-8 format string (exit 101)

オープン

#816 opened on 2026/08/07

 (1 件のコメント) (0 件のリアクション) (0 人の担当者)Rust (96 件のフォーク)user submission
good first issue

Repository metrics

Stars
 (635 個のスター)
PR merge metrics
 (平均マージ 26d 6h) (30d で 46 merged PRs)

説明

A -printf format string that is not valid UTF-8 panics during argument collection, before the format parser is ever reached.

$ find d -printf $'%\xff|\n'
thread 'main' panicked at ...: called `Result::unwrap()` on an `Err` value
$ echo $?
101

The panic is in std::env::args, which panics on non-UTF-8 arguments. Collecting via std::env::args_os and handling the invalid-UTF-8 case explicitly would let this produce a normal error (or match GNU, which accepts arbitrary bytes in the format string and passes them through).

コントリビューターガイド