You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: a non-UTF-8 argument bypasses MSYS/Cygwin quoting via to_str() == None #4116
On Windows an OsStr is WTF-8, so to_str() returns None for an argument holding an unpaired surrogate. Such an argument silently falls through to std's encoding — which is exactly the encoding #3727 is about — so if it also contains a ", it reaches an MSYS/Cygwin child mangled, with no diagnostic.
Why it is reachable. The one converted call site that actually carries OsStrings rather than Strings is runner::run_passthrough(tool: &str, args: &[std::ffi::OsString], ..) (src/core/runner.rs), whose arguments come from clap's args_os and are therefore not pre-validated as UTF-8 the way std::env::args() would be.
Severity. Low. The fallback is today's behaviour, not something worse, and it needs an unpaired surrogate and a double quote in the same argument. Filing it so it is not lost, not because it should hold anything up.
Fix shape. Test the bytes instead of the str, and build the raw argument from the wide encoding, so no UTF-8 round trip is needed:
arg.as_encoded_bytes().contains(&b'"')// instead of to_str()
std::os::windows::ffi::OsStrExt::encode_wide(arg)// to build the raw argument
Found while reviewing #3728, which introduced push_child_arg; noted there as a non-blocking item. The ChildCommand prototype in #4103 inherits the same to_str() gate, so whichever of the two lands should carry the fix.
Searched open and closed issues under three wordings ("non-UTF-8 argument Windows OsString", "to_str OsStr lossy args_os", "unpaired surrogate invalid unicode argument") before filing; nothing existed.
push_child_arg uses to_str() to gate MSYS/Cygwin quote re-encoding, so non-UTF-8 (unpaired surrogate) Windows args silently skip quoting if they also contain a double quote; switch to as_encoded_bytes()/encode_wide() to avoid the UTF-8 round trip.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/core/utils.rs
src/core/runner.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Activity
rtk-wshm-sync-bot commentedon Sep 18, 2026
🔍 Automated Triage
buglowSummary
push_child_arg uses to_str() to gate MSYS/Cygwin quote re-encoding, so non-UTF-8 (unpaired surrogate) Windows args silently skip quoting if they also contain a double quote; switch to as_encoded_bytes()/encode_wide() to avoid the UTF-8 round trip.
📁 Relevant files
src/core/utils.rssrc/core/runner.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable
refactor(core): make MSYS-safe child argument encoding unforgettable