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: arguments containing a double quote are corrupted when rtk spawns MSYS/Cygwin children (rtk grep, rtk proxy) #3727
rtk 0.45.0 and 0.46.0. Windows 11 (build 26200), Git Bash, Git for Windows 2.55.0, GNU grep 3.0.
Any argument that contains a " but no space or tab reaches an MSYS/Cygwin child process corrupted. stderr stays empty, so it looks like a legitimate "no matches".
rtk grep '"type"' q.jsonl (without -c) prints nothing and exits 1 as well. It is not specific to grep, rtk proxy corrupts the argument too:
$ rtk proxy printf '[%s]' 'a"b'
[a\b] # expected [a"b]
$ rtk proxy printf '[%s]' 'a"b c'
[a"b c] # correct, because the argument now contains a space
Cause
On Windows std::process::Command wraps an argument in double quotes only when it contains a space or a tab. An argument like a"b therefore lands on the child's raw command line as bare a\"b. MSVCRT/UCRT children decode that; Cygwin/MSYS children do not, so the quote turns into a backslash and adjacent arguments merge. On Windows the grep that which resolves is the Git for Windows MSYS binary, which is why rtk grep breaks while rtk rg (native ripgrep) and rtk git (native git.exe) are fine.
Isolated on one and the same grep.exe, same logical argument, only the wrapping quotes differing:
raw command line grep -c \"type\" q.jsonl gives 0, exit 1
raw command line grep -c "\"type\"" q.jsonl gives 1, exit 0
Native children accept both forms, so quoting the way libuv does (wrap whenever the argument is empty or contains a space, a tab or a ") fixes MSYS children with no behaviour change for native ones. It needs CommandExt::raw_arg at the spawn sites; today the callers of resolved_command in src/core/utils.rs all use plain .arg().
Happy to send a PR against develop if you want it.
Activity
fix(core): quote child arguments so MSYS children receive them intact