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
[paths] On-disk NUL.txt handled three different ways by cat/grep/sed (device vs file depends on path tier) #1333
A real on-disk file whose name is a DOS reserved name with an extension (e.g. NUL.txt) is handled three different ways by three commands in the same build — the layers disagree about what the operand is.
Evidence (harness under Wine, file NUL.txt with content real-content created on disk; two runs)
cat NUL.txt → cat: NUL.txt: No such file or directory, rc1 (the extended-path open fails).
grep -c real NUL.txt → prints 0, rc1 (grep opened the NUL device: empty stream, no match).
sed -n /hit/p NUL.txt (device semantics) → empty output, rc0 (also read the device).
GNU on an ordinary file of that name: prints/matches the content, rc0 (the name is a legal filename on the host FS in the oracle fixture).
Source
src/utils/native_path.cppmresolve_pseudo_device_w/is_dos_device_name_w (~L698-772): device detection matches only the exact whole operand (NUL), never NUL.txt/NUL:-style forms; the extended-path layer lifts device parsing on real Windows (\?\ prefix), while normalize/raw layers hit the device namespace. Which behavior a user gets depends on which tier the command uses.
Caveat
Reproduced under Wine; Wine's device emulation may differ from native Windows in which tier "wins". The code-level inconsistency (exact-match-only device table + tier disagreement) is platform-independent — confirm the native-Windows outcome per tier when fixing, and make all tiers agree: an on-disk NUL.txt should be one thing everywhere (and a bare NUL should stay the device everywhere).
Regression seed
cat NUL.txt, grep -c x NUL.txt, sed -n p NUL.txt on an on-disk NUL.txt → one consistent, documented behavior across all three; cat NUL still reads the device (empty, rc0).
Found by the full-audit (Windows minefield sweep). Related: #1297 (on-disk dir named NUL undeletable) covers the bare-name dir case; this issue is the extension-form + cross-command consistency.
Activity
test(cat): close the issue_1288 test body before the #1333 tests
fix(cpio): route archive and member paths through the operand boundar…
fix(cpio): route archive and member paths through the operand boundar…
fix(cpio): route archive and member paths through the operand boundar…
test(grep,sed): close the test bodies left open at the #1332 append j…
fix(cpio): route archive and member paths through the operand boundar…
fix(cpio): route archive and member paths through the operand boundar…
Merge pull request #1415 from unixwin/fix/winx3-paths
feat(winux-core): port the shell-namespace path contract from 1.x nat…
refactor(winux-cmds): route every wired command's path operands throu…
feat(winux-core): port the shell-namespace path contract from 1.x nat…
refactor(winux-cmds): route every wired command's path operands throu…
feat(a1): replay preserve-root closure + chmod/chgrp/chown tr! on main (