Skip to content

fix(diff): pair same-name entries in recursive directory comparison (#1344) - #1414

Merged
caomengxuan666 merged 2 commits into
mainfrom
fix/winx3-diff
Oct 27, 2026
Merged

caomengxuan666 merged 2 commits into
mainfrom
fix/winx3-diff

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Root cause

compare_directory_pair (src/commands/diff.cpp) merges the two sorted directory listings with two take-predicates. take1 uses <=, but take2 used a strict <: an entry was taken from side 2 only when it was strictly less than side 1's current entry. For equal names neither side was taken as a pair — both were emitted as Only in <dir>: <name> and file contents were never compared, so diff -r reported every same-name file as one-sided on both sides.

Fix

One line: take2's < → <=, so equal names pair up (take both) and flow into the normal file comparison. Plus 5 regression tests in tests/unit/diff/diff_unit_test.cpp (diff_recursive_*_issue1344: identical trees stay quiet, differing contents produce a content diff, one-sided entries still report Only in, nested subdirectories recurse, missing directory exits 2).

Local verification (winx window round 5, Wine mini harness)

Baseline binary (unfixed): the bug reproduces in 5 of 8 repro cases — diff -r on trees with same-name files prints Only in A: f.txt / Only in B: f.txt and never a content diff; identical trees are not quiet (rc=1 with spurious Only in lines). Controls pass (one-sided entries, single-file diff).

Fixed binary: repro 8/8 PASS — content diff 1c1 for differing files, identical trees silent rc=0, nested recursion compares contents, backslash paths work, missing directory exits 2.

MSYS-style absolute paths (/tmp/...): probed under Wine, output matches the GNU oracle (record-only; the path-spelling face is a separate item, not this PR).

One repro pin was corrected with oracle evidence during verification: the missing-directory case expected cannot read directory, but GNU diffutils 3.10 prints diff: <path>: No such file or directory (rc=2) for a missing operand — the product already matched GNU; only the pin changed.

Local gtest execution is deferred to this PR's Windows CI (window precedent: the gtest suite needs the full product build). CI failure set will be compared line-by-line against main's own set before merge.

Fixes #1344

CI round 1 (head 718c1c1, run 40452789262)

x64: 9 failed / 3233 = main's own 8 (find.issue_1309 + xargs ×7, identical to run 40414608075 on beb56558) plus one new failure in this PR's own tests: diff_recursive_same_name_identical_files_quiet_issue1344 failed only on EXPECT_TRUE(r.stdout_text.empty()) (diff_unit_test.cpp:341) — exit code 0 and the no-"Only in" assertions hold on Windows, and the other four new tests pass. The cluster REPORT §3 specifies this case as rc=0 + no "Only in"; the empty-stdout assertion was stricter than spec. Relaxed in 3c1125c (tests-only, product untouched). Note: the product's identical-tree stdout on Windows is non-empty in some residue the ctest log does not dump (no "Only in", rc=0) — recorded as a micro-observation, not chased here. arm64 + oracle + compare green; i18n sync skipped (no user-visible text change).

CI on 718c1c1: only the EXPECT_TRUE(r.stdout_text.empty()) assertion
failed (diff_unit_test.cpp:341); exit_code==0 and the no-"Only in"
assertions hold on Windows, as does the Wine repro locally. The
cluster REPORT section 3 specifies this case as rc=0 + no "Only in";
drop the stricter empty-stdout assertion to match. No product change;
no user-visible text change (i18n catalog unaffected).
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
caomengxuan666 marked this pull request as ready for review October 27, 2026 16:43
@caomengxuan666
caomengxuan666 merged commit 1442711 into main Oct 27, 2026
7 of 8 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/winx3-diff branch October 30, 2026 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diff -r: every file reported as 'Only in' on BOTH sides (even identical files); contents never compared

1 participant