Skip to content

fix(dracut.sh): Ensure hardlink deduplication is reproducible - #2703

Closed
cjriches wants to merge 1 commit into
dracutdevs:masterfrom
cjriches:master
Closed

fix(dracut.sh): Ensure hardlink deduplication is reproducible#2703
cjriches wants to merge 1 commit into
dracutdevs:masterfrom
cjriches:master

Conversation

@cjriches

@cjriches cjriches commented Jul 4, 2025

Copy link
Copy Markdown

By default, hardlink will only deduplicate files with identical mtimes, down to one-second granularity. If a dracut module rapidly generates multiple identical files, it is completely up to chance as to whether their mtimes cross a second boundary or not, and thus whether they get deduplicated or not. This results in non-reproducible output.

Perform timestamp clamping before invoking hardlink if a reproducible build is requested.

Checklist

  • I have tested it locally
  • I have reviewed and updated any documentation if relevant
  • I am providing new code and test(s) for it

By default, `hardlink` will only deduplicate files with identical
mtimes, down to one-second granularity. If a dracut module rapidly
generates multiple identical files, it is completely up to chance as to
whether their mtimes cross a second boundary or not, and thus whether
they get deduplicated or not. This results in non-reproducible output.

Perform timestamp clamping before invoking `hardlink` if a reproducible
build is requested.
@cjriches
cjriches requested review from haraldh and johannbg as code owners July 4, 2025 09:06
@cjriches

cjriches commented Jul 4, 2025

Copy link
Copy Markdown
Author

There's a few open questions / alternative approaches here:

  • Doing this mtime clamping will also result in more files getting more consistently deduplicated, so it potentially has benefits for everyone - perhaps we should do it unconditionally regardless of --reproducible?
  • We could also avoid touching mtimes and just run hardlink -t to deduplicate regardless of mtime match, but there's a small chance this breaks someone who was relying on identical files having different mtimes. The -t option also isn't present in all distros (e.g. it's in RHEL9 but not RHEL8).

@cjriches

cjriches commented Jul 4, 2025

Copy link
Copy Markdown
Author

Linked RHEL bug ticket: https://issues.redhat.com/browse/RHEL-101901

@aafeijoo-suse aafeijoo-suse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this hidden issue.

This repo is dead, could you please resubmit this to https://github.com/dracut-ng/dracut-ng?

@cjriches

cjriches commented Jul 9, 2025

Copy link
Copy Markdown
Author

Thanks for fixing this hidden issue.

This repo is dead, could you please resubmit this to https://github.com/dracut-ng/dracut-ng?

Thanks, have done: dracut-ng/dracut#1429

If you have the power to do so, I would suggest updating the README of this repo and marking it as archived, so that future contributors don't make the same mistake.

@cjriches cjriches closed this Jul 9, 2025
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.

2 participants