From 5992901805679912ea374ef19cae4979e6817a26 Mon Sep 17 00:00:00 2001 From: weili <541602953@qq.com> Date: Wed, 10 Jun 2026 02:38:26 +0000 Subject: [PATCH] find: -printf: test octal escape before a multibyte char MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression test for the panic fixed in #720/#723: a `\NNN` octal escape immediately followed by a multibyte character (`\0€`) used to slice the format string mid-char and abort. Assert `-printf` emits the escape byte and the following character intact. --- tests/test_find.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_find.rs b/tests/test_find.rs index 5497a32..70a5ec9 100644 --- a/tests/test_find.rs +++ b/tests/test_find.rs @@ -510,6 +510,15 @@ fn find_printf() { ); } +#[test] +fn find_printf_octal_escape_before_multibyte_char() { + ucmd() + .args(&["./test_data/simple", "-maxdepth", "0", "-printf", "\\0€\\n"]) + .succeeds() + .no_stderr() + .stdout_only("\0€\n"); +} + #[cfg(unix)] #[test] fn find_perm() {