Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix checksum error with small isos #26

Merged
merged 2 commits into from
Oct 28, 2021
Merged

Conversation

bcl
Copy link
Collaborator

@bcl bcl commented Jul 27, 2021

Fixes #25 and #18

subprocess.check_call(["genisoimage", "-quiet", "-o", "testiso.iso", "."])

# create iso file using a clean directory
with tempfile.TemporaryDirectory(prefix="isomd5test-") as tmpdir:
Copy link
Contributor

Choose a reason for hiding this comment

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

TemporaryDirectory is Python 3.2+. Personally I say kill 2.7 with fire, but I'll leave that decision to you. :)

(If you do decide to explicitly announce dropping 2.7 compatibility, I can prepare a PR which gets rid of the various 2/3 hacks. I need to make a PR about the mkisofs/genisoimage code in the test anyway, to add xorriso support.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, it's time to drop py2 support. In Fedora we no longer build it for py2 so those bits are really just leftovers that haven't been cleaned up.

bcl added 2 commits October 28, 2021 11:29
isos smaller than about 100k are failing.

This changes to using a temporary test directory instead of the source
directory, and it tests 2 sizes of iso.
When the size of an iso was small enough that the fragment size was
smaller than the buffer size it wouldn't calculate or check the checksum
correctly (it would output 19 instead of 20 checksum fragments).

This fixes that by doing 2 things:
 * read the smaller of:
  - remaining bytes
  - fragment size
  - buffer size
 * When reading the last dangling bit of data add it to the checksum
   but do not write a 21st checksum fragment.

This is backwards compatible with the previous code and now you can
checksum any size iso.
@bcl bcl force-pushed the master-small-iso branch from c0cb110 to 50cf14b Compare October 28, 2021 18:29
@bcl bcl merged commit e313746 into rhinstaller:master Oct 28, 2021
@bcl
Copy link
Collaborator Author

bcl commented Apr 29, 2024

This patch broke the checksums. Need to revisit this.

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.

Check faild if size of all files less than 100KB
2 participants