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] Redirection-open diagnostics bypass an already-applied stderr redirect: 'cat 2>/dev/null < /nonexistent' leaks the error (default mode, set -o posix, and comsub bodies; GNU silent) #250
Found by: wt4/regfix lane issue round (2026-09-27), script-file-verified against WSL GNU Bash 5.3.0.
Summary: A redirection-open diagnostic (< /nonexistent) is written to the shell's ORIGINAL stderr even when an earlier 2>/dev/null on the same command already redirected fd 2. GNU applies redirections left-to-right and reports the failed open through the CURRENT fd 2 (i.e. silenced). Diverges in default mode, set -o posix, and inside command-substitution bodies.
GNU Bash 5.3.0: stdout only (rc=1 / rc=1 / v=[] rc=1 / done), stderr EMPTY in all three contexts.
rubash (wt4/regfix debug build): stdout identical, but stderr leaks all three diagnostics:
p4c-diag-redirect.sh: line 2: /nonexistent_dir_xyz/f: No such file or directory
p4c-diag-redirect.sh: line 6: /nonexistent_dir_xyz/f: No such file or directory
p4c-diag-redirect.sh: line 10: /nonexistent_dir_xyz/f: No such file or directory
(The reversed order < bad 2>/dev/null correctly leaks on BOTH shells — the open fails before the 2> applies; that ordering is not the bug.)
GNU C source owner:redir.c:135 redirection_error reached from redir.c:260 do_redirections — do_redirections walks the list left-to-right and each do_redirection_internal takes effect when reached, so the report for the later < open goes out through the fd 2 already pointed at /dev/null.
Rubash owner:src/executor/command_prepare.rs:515 — the input-redirect IoError arm builds the diagnostic then calls self.write_default_stderr(&stderr), which writes to the shell default stderr instead of the command's applied fd-2 target (the ordered-output machinery one file over in src/executor/redirection.rs already has the correct state.write_to_fd(self, 2, ...) pattern).
Classification: rubash-caused (WSL GNU 5.3.0 oracle). Breaks cmd 2>/dev/null < file error hygiene in configure-style scripts and pollutes captured comsub output discipline.
Artifacts:target/issue-suites/results/wt4-regfix/issue-probes/p4c-diag-redirect.sh (+ .gnu.* / .rb.* captures; p4/p4b show the control orderings).
Activity
lexer: brace-scan resume must restore the snapshot position — depth>=…
xtrace fn head line, reserved-word redirect operands, comsub $-carrie…
caomengxuan666 commentedon Sep 27, 2026
已修复并合入 master(commit 160d31b1,lane wt5/misc;GNU 引用与全矩阵验证见提交;相邻真 bug(v=$(f) 在 set -x 下双执行函数体)已一并修复)。感谢报告!
fd/io family: move-fd dups, <> create, empty-target diagnostics, bad-…
fix: Wave1 P1 batch - trap exit unwind, pipeline redirect rejection, …
fix(restricted): fd-var refusals precede redir_varassign; member fail…
fix(restricted): select loop refuses pre-menu; fd-var pre-check speak…