diff --git a/.gitignore b/.gitignore index ac202a2..95d6369 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ /1.2.1.tar.gz /1.2.2.tar.gz /1.2.3.tar.gz +/isomd5sum-1.2.4.tar.gz +/isomd5sum-1.2.5.tar.gz diff --git a/0001-Revert-Fix-checksum-failure-with-small-isos.patch b/0001-Revert-Fix-checksum-failure-with-small-isos.patch new file mode 100644 index 0000000..505d006 --- /dev/null +++ b/0001-Revert-Fix-checksum-failure-with-small-isos.patch @@ -0,0 +1,67 @@ +From 14e4bac91c6aba61fe56c8d9a59cf7f07dbb99ab Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Mon, 29 Apr 2024 11:35:14 -0700 +Subject: [PATCH] Revert "Fix checksum failure with small isos" + +This reverts commit e313746011768ed69587fcda88ff65951af90ccc. + +This patch causes short checksums (57 characters instead of 60) to be +written, resulting in a checksum that doesn't cover the whole iso and +which fails when checked with previous checkisomd5sum versions. + +The incorrect checksums are shown with a ';FR' at the end instead of the +last 3 digits. +--- + libcheckisomd5.c | 4 ++-- + libimplantisomd5.c | 6 +++--- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/libcheckisomd5.c b/libcheckisomd5.c +index adcd938..2d350bc 100644 +--- a/libcheckisomd5.c ++++ b/libcheckisomd5.c +@@ -66,7 +66,7 @@ static enum isomd5sum_status checkmd5sum(int isofd, checkCallback cb, void *cbda + size_t previous_fragment = 0UL; + off_t offset = 0LL; + while (offset < total_size) { +- const size_t nbyte = MIN((size_t)(total_size - offset), MIN(fragment_size, buffer_size)); ++ const size_t nbyte = MIN((size_t)(total_size - offset), buffer_size); + + ssize_t nread = read(isofd, buffer, nbyte); + if (nread <= 0L) +@@ -89,7 +89,7 @@ static enum isomd5sum_status checkmd5sum(int isofd, checkCallback cb, void *cbda + const size_t current_fragment = offset / fragment_size; + const size_t fragmentsize = FRAGMENT_SUM_SIZE / info->fragmentcount; + /* If we're onto the next fragment, calculate the previous sum and check. */ +- if (current_fragment != previous_fragment && current_fragment < info->fragmentcount) { ++ if (current_fragment != previous_fragment) { + if (!validate_fragment(&hashctx, current_fragment, fragmentsize, + info->fragmentsums, NULL)) { + /* Exit immediately if current fragment sum is incorrect */ +diff --git a/libimplantisomd5.c b/libimplantisomd5.c +index d5f32fc..217c896 100644 +--- a/libimplantisomd5.c ++++ b/libimplantisomd5.c +@@ -109,8 +109,8 @@ int implantISOFD(int isofd, int supported, int forceit, int quiet, char **errstr + const off_t fragment_size = total_size / (FRAGMENT_COUNT + 1); + size_t previous_fragment = 0UL; + off_t offset = 0LL; +- while (offset < total_size && previous_fragment < FRAGMENT_COUNT) { +- const size_t nbyte = MIN((size_t)(total_size - offset), MIN(fragment_size, buffer_size)); ++ while (offset < total_size) { ++ const size_t nbyte = MIN((size_t)(total_size - offset), buffer_size); + ssize_t nread = read(isofd, buffer, nbyte); + if (nread <= 0L) + break; +@@ -119,7 +119,7 @@ int implantISOFD(int isofd, int supported, int forceit, int quiet, char **errstr + const size_t current_fragment = offset / fragment_size; + const size_t fragmentsize = FRAGMENT_SUM_SIZE / FRAGMENT_COUNT; + /* If we're onto the next fragment, calculate the previous sum and check. */ +- if (current_fragment != previous_fragment && current_fragment < FRAGMENT_COUNT) { ++ if (current_fragment != previous_fragment) { + validate_fragment(&hashctx, current_fragment, fragmentsize, NULL, fragmentsums); + previous_fragment = current_fragment; + } +-- +2.44.0 + diff --git a/isomd5sum.spec b/isomd5sum.spec index 3034c0c..e7272ea 100644 --- a/isomd5sum.spec +++ b/isomd5sum.spec @@ -1,12 +1,16 @@ +%global forgeurl https://github.com/rhinstaller/isomd5sum + Summary: Utilities for working with md5sum implanted in ISO images Name: isomd5sum -Version: 1.2.3 -Release: 15%{?dist} +Version: 1.2.5 +Release: 5%{?dist} Epoch: 1 -License: GPLv2+ +License: GPL-2.0-or-later -Url: https://github.com/rhinstaller/isomd5sum -Source0: https://github.com/rhinstaller/%{name}/archive/%{version}.tar.gz +%global tag %{version} +%forgemeta +Url: %{forgeurl} +Source0: %{forgesource} BuildRequires: gcc BuildRequires: popt-devel @@ -35,7 +39,7 @@ an md5sum implanted into an ISO9660 image. %prep -%autosetup +%forgeautosetup %build @@ -63,6 +67,67 @@ PYTHON=%{__python3} make DESTDIR=$RPM_BUILD_ROOT install-bin install-devel insta %{python3_sitearch}/pyisomd5sum.so %changelog +* Thu Jul 24 2025 Fedora Release Engineering - 1:1.2.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Mon Jun 02 2025 Python Maint - 1:1.2.5-4 +- Rebuilt for Python 3.14 + +* Fri Jan 17 2025 Fedora Release Engineering - 1:1.2.5-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + +* Thu Jul 18 2024 Fedora Release Engineering - 1:1.2.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + +* Tue Jun 25 2024 Brian C. Lane - 1.2.5-1 +- New Version 1.2.5 (bcl) +- testpyisomd5sum.py: Use a consistent iso size (bcl) +- Remove quiet from iso creation, size seems wrong (bcl) +- workflows: Move to Fedora 39 and checkout v4 (bcl) +- Revert "test: Update testing to include small iso and larger iso" (bcl) +- Revert "Fix checksum failure with small isos" (bcl) + +* Fri Jun 07 2024 Python Maint - 1:1.2.4-3 +- Rebuilt for Python 3.13 + +* Mon Apr 29 2024 Brian C. Lane - 1.2.4-2 +- Revert small iso fix, it resulted in incorrect checksums + Resolves: rhbz#2277398 + +* Fri Feb 16 2024 Brian C. Lane - 1.2.4-1 +- New Version 1.2.4 (bcl) +- Add support for riscv64 (davidlt) +- workflows: Update to use actions/checkout (bcl) +- Fix checksum failure with small isos (bcl) +- test: Update testing to include small iso and larger iso (bcl) +- Add a GitHub Action to run tests (bcl) +- Add mips64 (wangray1021) +- testpyisomd5sum.py: Support genisoimage, Python 2 (ryan) + +* Wed Jan 24 2024 Fedora Release Engineering - 1:1.2.3-23 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jan 20 2024 Fedora Release Engineering - 1:1.2.3-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Jul 20 2023 Fedora Release Engineering - 1:1.2.3-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue Jun 13 2023 Python Maint - 1:1.2.3-20 +- Rebuilt for Python 3.12 + +* Mon Jan 30 2023 Brian C. Lane - 1.2.3-19 +- SPDX migration + +* Thu Jan 19 2023 Fedora Release Engineering - 1:1.2.3-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 1:1.2.3-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Mon Jun 13 2022 Python Maint - 1:1.2.3-16 +- Rebuilt for Python 3.11 + * Thu Jan 20 2022 Fedora Release Engineering - 1:1.2.3-15 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild diff --git a/sources b/sources index 84f1e92..2ff8ef9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (1.2.3.tar.gz) = a500faa368377c8fb5dfc311bc3a6dbadd253e6af7928b691d1fc11e25b69819a611f72fa201e70f5df257cdc491c97d1f612bb179fa49de1fb0a638d6ac7972 +SHA512 (isomd5sum-1.2.5.tar.gz) = aa6bb16be18b42925ac1834aa4d558fafdba7751639acfb7344a79f7ead1125d810f13c442458526f394d8790369b1c48ab41cb73881808740263161caa99655 diff --git a/tests/smoke.sh b/tests/smoke.sh index 1f2f20e..ce667b2 100755 --- a/tests/smoke.sh +++ b/tests/smoke.sh @@ -8,8 +8,12 @@ mkisofs -o test.iso isocontent # Implant and check md5 sum implantisomd5 test.iso -checkisomd5 --verbose test.iso +checkisomd5 --verbose test.iso 2>&1 | tee test.run.log + +echo "Check implanted checksum for 1.2.4-1 checksum bug" +grep ';FR' test.run.log && exit 1 # Destroy testing iso image rm -rf ./isocontent rm test.iso +rm test.run.log