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
Redirecting, touching or cping to /dev/tty, /dev/stdin, /dev/stdout or /dev/stderr creates regular CON, CONIN$, CONOUT$ files in the current directory #4151
The files are real: echo x > /dev/tty writes x into ./CON and returns 0, cp f /dev/stdin copies f into ./CONIN$, and the files stay behind afterwards. This happens with or without a console attached. /dev/null is not affected.
Possibly related: shell_path_to_windows (src/executor/path.rs) maps these paths to the bare device names CON, CONIN$ and CONOUT$, and session_path (src/executor/shell_options.rs) joins any relative path onto the cwd. On Windows 11, C:\dir\CON names an ordinary file rather than the console device; only the bare name, or NUL in any directory, still refers to a device.
niubash 1.5.1 (rubash master 511cca8). Windows 11.
The issue was drafted with Claude and the reproductions were run on the versions above.
CAPTAIN ADJUDICATION (2026-11-24): CONFIRMED, P2. Owner: the rubash path layer, for every reported shape (the WinuxCmd share is zero — the argv funnel passes /dev/* verbatim per the #120 ruling, and none of the reported shapes pass through it).
Mechanism: shell_path_to_windows_inner (path.rs:4627-4635) maps /dev/stdin -> CONIN$, /dev/stdout and /dev/stderr -> CONOUT$, /dev/tty -> CON — all bare relative names. Redirect opens and the emulated touch (:991) / cp (:1641) then cwd-join them via session_path and real files land in the current directory. On Windows 11 a CON file inside a directory is a regular file (only NUL remains a device in every directory), which is exactly why /dev/null is unaffected, as reported.
Fix direction (captain): a device mapping must never degrade into a name that can be cwd-joined — device-namespace form or a consumer-side join exemption; one mechanism, chosen by the fix lane. One design question the lane must settle first, recorded here: redirect semantics for /dev/stdout should bind the shell's then-current fd 1 (a pipe when piped), while the present mapping pins the console even once the landing is fixed — the lane will check whether a /dev/fd-style binding path exists for the redirect face before choosing the mechanism. A captain fix lane is dispatched; real-host verification is owed while the verification host is unreachable.
CAPTAIN-VERIFY (2026-11-24): fixed by PR #4162, merged by the captain after review. The design question recorded at adjudication is settled first: a /dev/fd-style binding mechanism exists (special_paths::fd_alias_target, GNU anchor redir.c:601 _redir_special_filenames) and already owns every /dev/std* on the redirect face — cmd > /dev/stdout already binds the shell's then-current fd 1 (a pipe when piped); the funnel's CONOUT$ mapping never reaches redirects. The bare-name products were actually consumed only by the /dev/tty redirect pass-through, the emulated touch/cp operand face, and the <> CON predicate face. Fix (single mechanism): the path funnel now mints device-namespace forms at its exit — /dev/stdin -> \.\CONIN$, /dev/stdout and /dev/stderr -> \.\CONOUT$, /dev/tty -> \.\CON — absolute paths that no downstream transform can turn into a cwd file (the consumer-side join exemption was rejected for exactly that reason: this defect was caused by a joining+creating downstream transform). is_con_device_path now strips the \.\ prefix before comparing, and the duplicated CON check inside FileFd::open_readwrite_pair is deleted in favour of that single point. The argv funnel's #120 verbatim pass-through is untouched (it short-circuits all /dev/* first), and /dev/null still maps to NUL, locked by a control pin. Evidence: PR CI — Windows tests compile check pass (both cfg(windows) changes and all Windows-gated pins compile on the real Windows toolchain), Rust tests pass, niu-canary pass; census differential zero PR-unique true reds (the two names unique against the 511cca8 baseline are documented timing rotators, and every change in this PR is inert on the Linux census by construction — cfg!(windows) arms and #[cfg(windows)] blocks only); goldens red is the #4038 first-mismatch shape. Owed verification, recorded honestly: rubash CI has no Windows EXECUTION leg for these gated pins, so the report's three shapes plus the <> face get a real-host re-run with a master build when the X299 tunnel recovers. Closing.
Activity
caomengxuan666 commentedon Nov 23, 2026
CAPTAIN ADJUDICATION (2026-11-24): CONFIRMED, P2. Owner: the rubash path layer, for every reported shape (the WinuxCmd share is zero — the argv funnel passes /dev/* verbatim per the #120 ruling, and none of the reported shapes pass through it).
Mechanism: shell_path_to_windows_inner (path.rs:4627-4635) maps /dev/stdin -> CONIN$, /dev/stdout and /dev/stderr -> CONOUT$, /dev/tty -> CON — all bare relative names. Redirect opens and the emulated touch (:991) / cp (:1641) then cwd-join them via session_path and real files land in the current directory. On Windows 11 a CON file inside a directory is a regular file (only NUL remains a device in every directory), which is exactly why /dev/null is unaffected, as reported.
Fix direction (captain): a device mapping must never degrade into a name that can be cwd-joined — device-namespace form or a consumer-side join exemption; one mechanism, chosen by the fix lane. One design question the lane must settle first, recorded here: redirect semantics for /dev/stdout should bind the shell's then-current fd 1 (a pipe when piped), while the present mapping pins the console even once the landing is fixed — the lane will check whether a /dev/fd-style binding path exists for the redirect face before choosing the mechanism. A captain fix lane is dispatched; real-host verification is owed while the verification host is unreachable.
Mint /dev/std* and /dev/tty console mappings in device-namespace form…
caomengxuan666 commentedon Nov 23, 2026
CAPTAIN-VERIFY (2026-11-24): fixed by PR #4162, merged by the captain after review. The design question recorded at adjudication is settled first: a /dev/fd-style binding mechanism exists (special_paths::fd_alias_target, GNU anchor redir.c:601 _redir_special_filenames) and already owns every /dev/std* on the redirect face — cmd > /dev/stdout already binds the shell's then-current fd 1 (a pipe when piped); the funnel's CONOUT$ mapping never reaches redirects. The bare-name products were actually consumed only by the /dev/tty redirect pass-through, the emulated touch/cp operand face, and the <> CON predicate face. Fix (single mechanism): the path funnel now mints device-namespace forms at its exit — /dev/stdin -> \.\CONIN$, /dev/stdout and /dev/stderr -> \.\CONOUT$, /dev/tty -> \.\CON — absolute paths that no downstream transform can turn into a cwd file (the consumer-side join exemption was rejected for exactly that reason: this defect was caused by a joining+creating downstream transform). is_con_device_path now strips the \.\ prefix before comparing, and the duplicated CON check inside FileFd::open_readwrite_pair is deleted in favour of that single point. The argv funnel's #120 verbatim pass-through is untouched (it short-circuits all /dev/* first), and /dev/null still maps to NUL, locked by a control pin. Evidence: PR CI — Windows tests compile check pass (both cfg(windows) changes and all Windows-gated pins compile on the real Windows toolchain), Rust tests pass, niu-canary pass; census differential zero PR-unique true reds (the two names unique against the 511cca8 baseline are documented timing rotators, and every change in this PR is inert on the Linux census by construction — cfg!(windows) arms and #[cfg(windows)] blocks only); goldens red is the #4038 first-mismatch shape. Owed verification, recorded honestly: rubash CI has no Windows EXECUTION leg for these gated pins, so the report's three shapes plus the <> face get a real-host re-run with a master build when the X299 tunnel recovers. Closing.
fix(redir): materialize undo-save slot saturation EMFILE diagnostics (F…