Skip to content

WIP: W6 oracle audit — cmp/patch/diff/sdiff vs diffutils-3.10 + patch-2.7.6 (Refs #1462) - #1476

Merged
caomengxuan666 merged 7 commits into
mainfrom
fix/audit-w6-cmp-patch
Oct 31, 2026
Merged

caomengxuan666 merged 7 commits into
mainfrom
fix/audit-w6-cmp-patch

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

W6 cluster of the per-command oracle audit (#1462): diffutils remainder + patch, cmp as main course.

Status: recovery in progress. First commit preserves the inherited uncommitted state left by two predecessor agents; every hunk is being adjudicated against the oracle C sources (diffutils-3.10, patch-2.7.6) and follow-up commits will keep/fix/revert per hunk with citations. Draft — do not merge.

Recovery preservation commit: state left uncommitted by two predecessor
agents (infrastructure error, then runtime restart). Contents will be
adjudicated hunk-by-hunk against the diffutils-3.10 / patch-2.7.6 oracle
sources in follow-up commits.

Refs #1462
Adjudication of the inherited W6 diff against patch-2.7.6 found two
real divergences in the predecessor's approximation:

* File-name selection now follows pch.c exactly: header names are
  prepared by strip_leading_slashes semantics (util.c fetchname) —
  basename when -p is unspecified, -pN strips N slash-runs and a
  name with too few runs is ignored entirely; the Index name is
  discarded beside a header name unless POSIX (pch.c:870); among
  existing candidates POSIX takes the first in old/new/Index order,
  otherwise best_name wins (fewest components, shortest basename,
  shortest name, order; pch.c:1039-1083); a creation picks the
  candidate creating the fewest new directories (pch.c:949-975).
  The old code tried names as written in fixed order with an ad-hoc
  basename pass, which picks different files when both a path-ful
  name and its basename exist, and when -p0 leaves several existing
  candidates.

* Declining the reversed-patch DWIM prompt no longer asks a second
  'Apply anyway?' question and no longer skips the file: GNU has no
  such prompt (apply_anyway is an internal flag, patch.c:349/447);
  the swapped hunk is put back and the hunk fails normally.
Default basename preparation, best_name fewest-components ordering,
-pN invalidation of short names, and the Index discard/POSIX-keep
pair — each case discriminates the GNU model from the previous
fixed-order approximation.
The ignored line must stay visible in the common span (it vanished
under the dropped-script renderer), with the surviving hunk still
driving exit 1, and exit 0 when every change is ignored.
#1462)

The no-difference early return fired before the format switch, so
diff -y -I with every hunk ignored printed nothing.  GNU treats
side-by-side as a listing format: diff.c:817-822 sets
no_diff_means_no_output false for OUTPUT_SDIFF (unless
--suppress-common-lines), analyze.c:635 therefore enters the output
block with changes == 0, and side.c:36-47 print_sdiff_script renders
the trailing common lines in full.  The guard now falls through to
the format switch for side-by-side (exit status stays 0), which also
covers the normalized-identical -y case through the same mechanism.

Fixes ctest diff.diff_side_by_side_ignore_matching_all_ignored
(verdict: product wrong, test right).
…ng (Refs #1462)

diff_ignore_all_space_side_by_side expected empty stdout, encoding
the same early-return bug as the all-ignored -I case: for
OUTPUT_SDIFF, diff.c:817-822 leaves no_diff_means_no_output false,
so analyze.c:635 prints and side.c:36-47 renders every common line
even when the comparison is empty; only the exit status is 0.
Verdict: test wrong, corrected to the GNU contract (its unified
sibling's empty expectation stands — non-listing formats print
nothing when nothing differs).
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 31, 2026 19:50
@caomengxuan666
caomengxuan666 merged commit a0feb0c into main Oct 31, 2026
8 of 9 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 31, 2026
Main advanced by #1473 (W1 coreutils files) and #1476 (W6 cmp/patch)
after the cpio composition base 4728cfc. File overlap with this
branch: none (108 main files vs 25 branch files), so the composition
in 61ad842 is untouched; merging keeps the PR current for merge.
caomengxuan666 added a commit that referenced this pull request Oct 31, 2026
Brings in the W1 mv fix (#1473) and W6 diff fix (#1476) merges.
Overlapping files: src/commands/date.cpp (both waves touched it,
disjoint hunks) and tests/differential/baseline.json (append-only).
Refs #1462
@caomengxuan666
caomengxuan666 deleted the fix/audit-w6-cmp-patch branch November 2, 2026 01:13
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.

1 participant