Repository navigation
fix(ldd,date): fold POSIX drive-dialect operands before any open (#1238 #1239) - #1253
Merged
Merged
Conversation
ldd handed the raw operand to a bare std::ifstream, and the CRT resolves
a leading '/e' against the CURRENT drive: from a foreign cwd every POSIX
drive spelling ('/e/x.exe', '/cygdrive/e/x.exe', '/mnt/e/x.exe') reported
"cannot open" for a file that exists on the operand's drive, while MSYS
ldd opens the same spelling from anywhere (#1238, found by the #1230
sweep; PS probe with native argv).
The operand now folds once through the shared normalize_api_operand
boundary at load_file - the single point every caller opens through,
covering the default, --name and --unused paths. Error messages keep
quoting the operand exactly as typed, like MSYS does.
Regressions dialect-spell the build tree's own winuxcmd.exe (slash,
/cygdrive and /mnt forms resolve the real PE from a foreign cwd) and
probe a TempDir text file from a second fixed drive (open success proves
the fold; the message keeps the verbatim spelling).
date -f DATEFILE opened the file the same way: is_directory and the
std::ifstream open both saw the raw operand text, so a leading '/e'
resolved against the CURRENT drive - from a foreign cwd every POSIX
spelling ('/e/Data/dates.txt', '/cygdrive/e/...', '/mnt/e/...') reported
"No such file or directory" for a file that exists on the operand's
drive, and the directory probe behind the 'Is a directory' report ran
against the shadow path too (#1239, found by the #1230 sweep; PS probe
with native argv, MSYS date oracle reads the same spellings).
The -f operand folds once through the shared normalize_api_operand
boundary before the is_directory probe and the open. The open-failure
messages keep printing the operand as the user typed, like MSYS does;
bare '/e' (drive root) now correctly reports "read error: Is a
directory" instead of a bogus ENOENT.
Regressions dialect-spell a TempDir fixture (slash, /cygdrive and /mnt
forms read the file from a foreign cwd), repeat the audit's exact shape
with the cwd on a second fixed drive, and pin the bare-drive-root
directory report.
Member
Author
Independent code review — verdict: APPROVE-WITH-NITSReviewed independently from a fresh detached worktree at f6ba403 (3 commits over base 6e8ea19 — matches the PR header; branch tip confirmed as PR head). Verified (all re-executed; PS native argv; fixture
|
This was referenced Oct 19, 2026
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.
Path-dialect fix wave 2d (#1230 sweep follow-up; precedent #1243/#1245). Closes #1238, closes #1239.
Summary
lddanddate -fboth handed the raw operand text to a barestd::ifstream(plus theis_directoryprobe behinddate's "Is a directory" report). Win32/CRT resolve a leading/eagainst the CURRENT drive, so from a foreign cwd every POSIX drive spelling reported a bogus open failure for a file that exists on the operand's drive - while MSYS opens the same spelling from anywhere.The operand now folds once through the shared
normalize_api_operandboundary at the single open point of each command (load_filefor ldd - covering the default,--nameand--unusedpaths; the-fblock for date). Error messages keep quoting the operand exactly as typed, like MSYS does. Bare/e(drive root) fordate -fnow correctly reports "read error: Is a directory" instead of a bogus ENOENT.Evidence (PS native argv, installed 1.1.14, pre-fix)
ldd /e/probe-wd/probe-pe.exedate -f /e/probe-wd/probe-date.txtPost-fix matrix (freshly built binary; E:\probe-wd held a real PE + a date file, removed after):
/e/probe-wd/.../cygdrive/e/probe-wd/.../mnt/e/probe-wd/.../e(root)E:\\probe-wd\\...(Windows)Shadow witness
C:\\e,C:\\d,D:\\e: False after every cell (read-only probes) and after cleanup.Tests
ldd.drive_dialect_spellings_resolve_real_pe_from_foreign_cwd- dialect-spells the build tree's own winuxcmd.exe (slash, /cygdrive, /mnt forms) and resolves the real PE from a foreign cwdldd.drive_dialect_cwd_on_other_drive_resolves_non_pe_probe- probe file only exists at the dialect location; "not a PE executable" (verbatim spelling) proves the fold, "cannot open" would fail itdate.date_file_drive_dialect_spellings_read_from_foreign_cwd- all three spellings read the fixture from a foreign cwddate.date_file_drive_dialect_cwd_on_other_drive_reads_file- the audit's exact shape (cwd on a second fixed drive)date.date_file_bare_drive_root_reports_is_a_directory- bare/xkeeps the [GNU] directory report with the operand as typedAll regressions synthesize the dialect spelling from the fixture's own drive (land-on-operand-drive, skip when no second fixed drive) and pass on any host.
Validation
scripts/build.py(MSVC + CMake + vcpkg, VCPKG_ROOT=D:/vcpkg) builds clean; all ldd/date tests pass via the runner and via ctest0xc0000409/env-sensitive flakes on this host pass standalone on re-run and include tests merged by fix(mkdir,ln): fold POSIX drive-dialect operands before any write (#1233, #1234) #1243, and the repeatingmktemp_p_cygdrive_dir_outputs_cygdrive_formfailure reproduces identically on a pristineorigin/main~1build (3c5d9ad) under cmd-spawned ctest - pre-existing host/env sensitivity, untouched by this branchRead-only fix: no I18N catalog changes (no message text changed).