Repository navigation
WIP: W6 oracle audit — cmp/patch/diff/sdiff vs diffutils-3.10 + patch-2.7.6 (Refs #1462) - #1476
Merged
Merged
Conversation
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.
This was referenced Oct 31, 2026
#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
marked this pull request as ready for review
October 31, 2026 19:50
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.
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.