Skip to content

libdiff: update truncation test for EIO return - #572

Merged
laffer1 merged 1 commit into
masterfrom
fix/libdiff-test-eio
Oct 20, 2026
Merged

laffer1 merged 1 commit into
masterfrom
fix/libdiff-test-eio

Conversation

@laffer1

@laffer1 laffer1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Commit 19f69c3 removed DIFF_ATOMIZER_FILE_TRUNCATED and changed the libdiff atomizer to return EIO when a file is truncated. lib/libdiff/tests/libdiff_test.c still referenced the removed flag and expected a 0 return, so make buildworld fails when building the tests.

This change makes the test expect EIO from diff_atomize_file() and removes the flag check. The length checks stay, so the test still confirms that truncation is detected at the right place. Nothing else in the tree uses the removed flag.

Testing

  • The test compiles cleanly with -Wall -Werror against the ATF headers in contrib/atf.
  • I ran the same test code with a small stand-in for ATF, linked against the current libdiff sources, and it passed. libatf isn't built on the test host, so I couldn't run it through kyua.

🤖 Generated with Claude Code

Summary by Sourcery

Bug Fixes:

  • Update the truncated-file atomizer test to expect the new EIO error behavior and remove its obsolete flag assertion.

Commit 19f69c3 removed DIFF_ATOMIZER_FILE_TRUNCATED and made the
atomizer return EIO on truncation, but the ATF test still referenced
the removed flag and expected a 0 return, breaking buildworld.

Expect EIO from diff_atomize_file() and drop the flag check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates the libdiff truncation test for the atomizer’s EIO return after file truncation, removes the obsolete flag assertion, and preserves length-based detection checks.

File-Level Changes

Change Details Files
Align the truncation test with libdiff’s updated error-reporting API.
  • Expect diff_atomize_file() to return EIO after the backing file is truncated.
  • Remove the assertion for the deleted DIFF_ATOMIZER_FILE_TRUNCATED flag.
  • Retain atomized-length bounds to verify truncation is detected at the expected position.
lib/libdiff/tests/libdiff_test.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@laffer1
laffer1 merged commit a99b7cf into master Oct 20, 2026
10 of 12 checks passed
@laffer1
laffer1 deleted the fix/libdiff-test-eio branch October 20, 2026 13:08
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