Repository navigation
WIP: 路径层修复 — 尾点/空格操作数与盘上 NUL.txt (#1332, #1333) - #1415
Merged
Merged
Conversation
Trailing dot/space leaves (name., name␣) are stripped by DOS open rules, so sed/grep on the normalize tier silently read the wrong sibling file and sed -i overwrote it. Route the file-open sites (sed script/w/r/R inputs and process_files open_path, hence the -i temp/rename chain; grep's five open sites) through make_api_path_operand().extended, which names the literal on-disk file. A trailing separator on a non-directory keeps the normalized spelling so the #1052 ENOTDIR enforcement still rejects the open; glob expansion inputs stay on normalize (matching only) and the grep -r walk root stays normalized (its generic_wstring child paths do not round-trip a \\?\\ root). Fixes #1332
…llPathNameW An on-disk file whose final component is a DOS device stem with an extension (NUL.txt) was handled three different ways because the extended-path computation consulted GetFullPathNameW, which resolves the stem onto the device namespace (\\.\\NUL under Wine; the same DOS rule governs plain-path opens): cat (extended tier) failed with ENOENT after to_extended_path mangled the result to \\?\\UNC\\.\\NUL, grep (normalize tier) read the empty device stream, and sed (normalize tier) read the empty device stream. Route such leaves through the lexical preserving form instead, so every tier opens the same on-disk file. Bare device names are unaffected (make_api_path_operand_w returns them verbatim before to_extended_path runs), as are stems that merely contain a device name (ANUL.txt) and dot-less stems; cat needs no command change (it was already extended-tier) and sed/grep use this form via the #1332 tier switch in the parent commit. Fixes #1333
This was referenced Oct 27, 2026
# Conflicts: # tests/unit/cat/cat_unit_test.cpp
…unctions fc57b90 appended the #1332/#1333 test blocks to three test files and lost the closing brace of the preceding test in each: cat (fixed in 5bbe101), grep (issue_1283 test, before the preserving_path_1332 helper namespace — MSVC C1075/C2870 on CI) and sed (the s/a*/x/2 test, same junction shape). Add the two missing braces; no test content changes. Refs #1332 Refs #1333
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
….1.21 release checklist - packaging/ffi/README.md: DESIGN 4.1 layout on the packaging side (usr/bin/ffi/v1.1.21/winuxcore.dll + tiers.tsv, current.txt pointer, SHA256SUMS.txt incl. the DLL line, keep-last-2 GC, rollback), wpm-index ffi field wiring described (P2, not applied) - packaging/ffi/FFI-EXPERIMENTAL-NOTICE.md: in-package D8 notice - default off, NIU_WINUXCMD_FFI=1 to enable, SmartScreen/Defender notes, signed DLL as the hard gate for non-experimental FFI - packaging/ffi-interim-release-checklist.md: 12 pre-release gates, all honestly marked unmet where unmet (incl. the real CI snapshot for PRs #1414/#1415/#1423), plus the CMake install-rule patch proposal for the coordinator - CMakeLists/CMakePresets/src are outside this prep's file surface and are NOT touched - prep only: no tag, no release
caomengxuan666
marked this pull request as ready for review
October 27, 2026 18:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
winx3-paths 簇(路径层)草稿 PR:先让工作在 GitHub 上可见,集成由主会话处理。
覆盖
Fixes #1332
Fixes #1333
当前进度
两条均已修复并验证(同源 harness:winlibs GCC 16.2 + Wine,mini2 = 全部 .cppm 模块 + sed/cat/grep):
open_operand_path/open_operand_path_w,had_trailing_separator时仍走 normalize 以保留 [gap] trailing '/' on a regular file is silently stripped: readers accept it, tee/dd/cp/mv write through it (data loss), some errors report ENOENT or exit 0 #1052 的 ENOTDIR enforcement)。基线实测 sed 读name.得错文件内容、sed -i 覆盖错文件、grep 同样读错(审计注记的“grep 已合 GNU”被证伪);修复后 sed/cat/grep 读name.均为目标内容,sed -i 只改name.。grep -r 遍历根保持 normalize(扩展形态子路径无法经 generic_wstring 往返,已实测回退)。GetFullPathNameW把NUL.txt解析到设备命名空间(\\.\NUL),to_extended_path再加工成打不开的形态——cat 已在扩展档同样失败,档位切换 alone 不够。native_path.cppm新增has_device_stem_with_extension_w卫士:终组件词干为 DOS 设备名且带扩展名时绕开 GetFullPathNameW。修复后 cat/grep/sed 读盘上NUL.txt一致为文件内容,裸NUL仍为设备(空流 rc 0)。cat 无命令改动。#1299 重基检查(已做)
#1299 已合并;本分支已重基至 main tip
1854504并在重基树上重建重验(build37 [81/81] + probes 全过)。winx2 的 #1297 卫士has_device_name_leaf与本簇 #1333 卫士并存于to_extended_path(互补不重复)。重基中曾丢失一处闭合括号,已 amend 补回并以测试计数/括号平衡对账核实,详见簇 REPORT.md。回归测试
11 个新测试(名中带 issue 号):sed 5、grep 4、cat 2,期望值逐项对照 GNU coreutils 9.4。尚未在 Windows CI 跑过——沙箱只能跑 harness 探针,完整工程构建与 winuxcmd-tests 待 CI。
验证边界
NUL.txt的行为与真 NTFS 逐档复核仍待真机确认。NUL.txt时扩展档报 ENOENT(与 cat 现行一致),不再静默读设备空流——分界已写入测试与报告。详细报告:簇内 REPORT.md(本地
~/workspace/winuxcmd-fix/clusters/winx3-paths/REPORT.md)。