Skip to content

LocalStore::doAddToStore(): Check NAR size before NAR hash#512

Merged
edolstra merged 1 commit into
mainfrom
check-size-before-hash-2
Jun 17, 2026
Merged

LocalStore::doAddToStore(): Check NAR size before NAR hash#512
edolstra merged 1 commit into
mainfrom
check-size-before-hash-2

Conversation

@edolstra

@edolstra edolstra commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Same as #510, to get around our CI being broken for PRs from external contributors.

If the file size is wrong, the hash is almost certainly wrong. Checking the size first provides useful information that is not shown otherwise.

Size mismatch indicates issues like truncated files, whereas hash mismatch for the matching file size suggests data corruption. Reporting the correct condition helps troubleshoot the issue.

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.


Closes #510

Size mismatch indicates issues like truncated files, whereas hash
mismatch for the matching file size suggests data corruption.
@edolstra edolstra enabled auto-merge June 17, 2026 15:34
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e83aa462-2be0-496f-96eb-9dcbdec29e2e

📥 Commits

Reviewing files that changed from the base of the PR and between 21ed367 and 4c933bf.

📒 Files selected for processing (2)
  • src/libstore/local-store.cc
  • tests/functional/binary-cache.sh
 _______________________________________________________________________
< Simplicity does not precede complexity, but follows it. - Alan Perlis >
 -----------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch check-size-before-hash-2

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request June 17, 2026 15:42 Inactive
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@edolstra edolstra added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit f9bbf32 Jun 17, 2026
33 checks passed
@edolstra edolstra deleted the check-size-before-hash-2 branch June 17, 2026 16:34
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.

3 participants