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
[bug] Move-fd redirections >&n- / <&n- parse as literal filenames ('&5-: No such file or directory'; GNU dups then closes) #263
Found by: wt5/audit source lane (2026-09-28), script-file-verified against WSL GNU Bash 5.3.0.
Summary: The >&n- / <&n- move-fd redirection forms (duplicate fd n onto the target, then close n) are mis-lexed in rubash: the trailing - is not recognized, so >&5- becomes an output redirect to the literal FILENAME &5-.
GNU C source owner:
third_party/bash/make_cmd.c:704-718make_redirection() case r_duplicating_output_word: when the word after >& ends in -, it strips the dash and converts to r_move_output (digits) or r_move_output_word (r_move_input/r_move_input_word for <&).
third_party/bash/redir.c:1253case r_move_input_word / r_move_output_word in do_redirection_internal — dup then close (addexrclose).
exec5>/dev/null
echo moved >&5-;echo"rc=$?"exec5</dev/null
read -u 5 x <&5-;echo"rc=$?"
GNU 5.3.0: both forms work silently (>&5- writes via fd 5 then closes it; rc=0). With exec 5>&1 first, echo moved >&5- prints moved and fd 5 ends closed. rubash: stderr line N: &5-: No such file or directory — the operand is treated as a filename; the fd is never duplicated or closed.
Rubash owner: redirect lexer/parser — src/parser/redirections.rs (operand classification) feeding src/executor/redirection.rs; no move opcode counterpart exists for the trailing-dash dup forms.
Classification: rubash-caused. Affects fd-juggling scripts (here-doc fd shuffling, process managers); adjacent to the redir.tests family in #225.
Activity
docs: source-audit lane (wt5/audit) — GNU C vs Rust owner gap audit, …
fd/io family: move-fd dups, <> create, empty-target diagnostics, bad-…
caomengxuan666 commentedon Sep 27, 2026
已修复并合入 master(commit 3aec2a83,lane wt6/fdio;GNU 引用与 14 探针矩阵/真基线切片验证见提交——redir/read/heredoc/procsub 全 0 差异,regression 24/24)。感谢报告!