diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/.gitignore b/.gitignore index 95d6369..7c6deb1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,3 @@ /1.1.0.tar.gz /1.2.0.tar.gz /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-Fix-aligned-alloc-parameters-and-overflow-on-32bit-s.patch b/0001-Fix-aligned-alloc-parameters-and-overflow-on-32bit-s.patch new file mode 100644 index 0000000..503126b --- /dev/null +++ b/0001-Fix-aligned-alloc-parameters-and-overflow-on-32bit-s.patch @@ -0,0 +1,73 @@ +From 64c71d7fc28c32ea61bf155bf1503646e4b1bf72 Mon Sep 17 00:00:00 2001 +From: squimrel +Date: Wed, 23 Aug 2017 04:21:14 +0000 +Subject: [PATCH] Fix aligned alloc parameters and overflow on 32bit size_t + +(cherry picked from commit f802c54f736006566041aeb6a9d741a6d83ce687) +--- + libcheckisomd5.c | 3 ++- + libimplantisomd5.c | 3 ++- + utilities.c | 4 ++-- + 3 files changed, 6 insertions(+), 4 deletions(-) + +diff --git a/libcheckisomd5.c b/libcheckisomd5.c +index b190959..3ec3d88 100644 +--- a/libcheckisomd5.c ++++ b/libcheckisomd5.c +@@ -49,6 +49,7 @@ static enum isomd5sum_status checkmd5sum(int isofd, checkCallback cb, void *cbda + return ISOMD5SUM_CHECK_NOT_FOUND; + + const off_t total_size = info->isosize - info->skipsectors * SECTOR_SIZE; ++ const off_t fragment_size = total_size / (info->fragmentcount + 1); + if (cb) + cb(cbdata, 0, total_size); + +@@ -85,7 +86,7 @@ static enum isomd5sum_status checkmd5sum(int isofd, checkCallback cb, void *cbda + + MD5_Update(&hashctx, buffer, (unsigned int) nread); + if (info->fragmentcount) { +- const size_t current_fragment = (size_t)(offset * (off_t)(info->fragmentcount + 1) / total_size); ++ 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) { +diff --git a/libimplantisomd5.c b/libimplantisomd5.c +index 53801c8..47f21d7 100644 +--- a/libimplantisomd5.c ++++ b/libimplantisomd5.c +@@ -106,6 +106,7 @@ int implantISOFD(int isofd, int supported, int forceit, int quiet, char **errstr + buffer = aligned_alloc(pagesize, buffer_size * sizeof(*buffer)); + + const off_t total_size = isosize - SKIPSECTORS * SECTOR_SIZE; ++ const off_t fragment_size = total_size / (FRAGMENT_COUNT + 1); + size_t previous_fragment = 0UL; + off_t offset = 0LL; + while (offset < total_size) { +@@ -115,7 +116,7 @@ int implantISOFD(int isofd, int supported, int forceit, int quiet, char **errstr + break; + + MD5_Update(&hashctx, buffer, (unsigned int) nread); +- const size_t current_fragment = (size_t) offset * (FRAGMENT_COUNT + 1) / (size_t) total_size; ++ 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) { +diff --git a/utilities.c b/utilities.c +index b00337f..cfa84ed 100644 +--- a/utilities.c ++++ b/utilities.c +@@ -131,9 +131,9 @@ struct volume_info *const parsepvd(const int isofd) { + buffer[APPDATA_SIZE - 1] = '\0'; + + struct volume_info *result = malloc(sizeof(struct volume_info)); +- result->skipsectors = 20; ++ result->skipsectors = SKIPSECTORS; + result->supported = 0; +- result->fragmentcount = 20; ++ result->fragmentcount = FRAGMENT_COUNT; + result->offset = offset; + result->isosize = isosize(aligned_buffer); + +-- +2.13.5 + diff --git a/0001-Revert-Fix-checksum-failure-with-small-isos.patch b/0001-Revert-Fix-checksum-failure-with-small-isos.patch deleted file mode 100644 index 505d006..0000000 --- a/0001-Revert-Fix-checksum-failure-with-small-isos.patch +++ /dev/null @@ -1,67 +0,0 @@ -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 e7272ea..d040995 100644 --- a/isomd5sum.spec +++ b/isomd5sum.spec @@ -1,21 +1,18 @@ -%global forgeurl https://github.com/rhinstaller/isomd5sum - Summary: Utilities for working with md5sum implanted in ISO images Name: isomd5sum -Version: 1.2.5 -Release: 5%{?dist} +Version: 1.2.1 +Release: 4%{?dist} Epoch: 1 -License: GPL-2.0-or-later +License: GPLv2+ +Group: Applications/System -%global tag %{version} -%forgemeta -Url: %{forgeurl} -Source0: %{forgesource} +Url: https://github.com/rhinstaller/isomd5sum +Source0: https://github.com/rhinstaller/%{name}/archive/%{version}.tar.gz + +Patch0: 0001-Fix-aligned-alloc-parameters-and-overflow-on-32bit-s.patch -BuildRequires: gcc BuildRequires: popt-devel -BuildRequires: python3-devel -BuildRequires: make +BuildRequires: python2-devel python3-devel %description The isomd5sum package contains utilities for implanting and verifying @@ -23,6 +20,7 @@ an md5sum implanted into an ISO9660 image. %package devel Summary: Development headers and library for using isomd5sum +Group: Development/System Requires: %{name} = %{epoch}:%{version}-%{release} Provides: %{name}-static = %{epoch}:%{version}-%{release} @@ -30,6 +28,14 @@ Provides: %{name}-static = %{epoch}:%{version}-%{release} This contains header files and a library for working with the isomd5sum implanting and checking. +%package -n python-isomd5sum +Summary: Python bindings for isomd5sum +Provides: python2-isomd5sum = %{epoch}:%{version}-%{release} + +%description -n python-isomd5sum +The isomd5sum package contains utilities for implanting and verifying +an md5sum implanted into an ISO9660 image. + %package -n python3-isomd5sum Summary: Python bindings for isomd5sum @@ -39,18 +45,25 @@ an md5sum implanted into an ISO9660 image. %prep -%forgeautosetup +%autosetup +rm -rf %{py3dir} +cp -a . %{py3dir} %build CFLAGS="$RPM_OPT_FLAGS -Wno-strict-aliasing"; export CFLAGS -LDFLAGS="$RPM_LD_FLAGS"; export LDFLAGS +PYTHON=%{__python2} make checkisomd5 implantisomd5 pyisomd5sum.so +pushd %{py3dir} PYTHON=%{__python3} make checkisomd5 implantisomd5 pyisomd5sum.so +popd %install +PYTHON=%{__python2} make DESTDIR=$RPM_BUILD_ROOT install-bin install-devel install-python +pushd %{py3dir} PYTHON=%{__python3} make DESTDIR=$RPM_BUILD_ROOT install-bin install-devel install-python +popd %files %license COPYING @@ -61,144 +74,16 @@ PYTHON=%{__python3} make DESTDIR=$RPM_BUILD_ROOT install-bin install-devel insta %files devel %{_includedir}/*.h %{_libdir}/*.a -/usr/share/pkgconfig/isomd5sum.pc + +%files -n python-isomd5sum +%{python2_sitearch}/pyisomd5sum.so %files -n python3-isomd5sum %{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 - -* Thu Jul 22 2021 Fedora Release Engineering - 1:1.2.3-14 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - -* Fri Jun 04 2021 Python Maint - 1:1.2.3-13 -- Rebuilt for Python 3.10 - -* Tue Jan 26 2021 Fedora Release Engineering - 1:1.2.3-12 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Tue Dec 01 2020 Brian C. Lane - 1.2.3-11 -- Add make to BuildRequires - -* Tue Jul 28 2020 Fedora Release Engineering - 1:1.2.3-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Tue May 26 2020 Miro Hrončok - 1:1.2.3-9 -- Rebuilt for Python 3.9 - -* Wed Jan 29 2020 Fedora Release Engineering - 1:1.2.3-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Mon Aug 19 2019 Miro Hrončok - 1:1.2.3-7 -- Rebuilt for Python 3.8 - -* Thu Jul 25 2019 Fedora Release Engineering - 1:1.2.3-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Fri Feb 01 2019 Fedora Release Engineering - 1:1.2.3-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Mon Jan 14 2019 Miro Hrončok - 1:1.2.3-4 -- Subpackage python2-isomd5sum has been removed - See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal - -* Fri Jul 13 2018 Fedora Release Engineering - 1:1.2.3-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Tue Jun 19 2018 Miro Hrončok - 1:1.2.3-2 -- Rebuilt for Python 3.7 - -* Tue Apr 10 2018 Brian C. Lane - 1:1.2.3-1 -- New Version 1.2.3 (bcl) -- Fix 32bit bug on large files (squimrel) -- Don't put DESTDIR in the isomd5sum.pc file (bcl) - -* Fri Feb 23 2018 Florian Weimer - 1:1.2.2-4 -- Use LDFLAGS from redhat-rpm-config - -* Mon Feb 19 2018 Brian C. Lane - 1.2.2-3 -- Add gcc BuildRequires for future minimal buildroot support - -* Wed Feb 07 2018 Fedora Release Engineering - 1:1.2.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Tue Oct 03 2017 Brian C. Lane - 1:1.2.2-1 -- Don't put DESTDIR in the isomd5sum.pc file -- New Version 1.2.2 (bcl) -- Fix aligned alloc parameters and overflow on 32bit size_t (#1497458) (squimrel) -- Fix memory leak (squimrel) -- Add pkgconfig file (squimrel) -- Remove line-breaks from error messages (squimrel) -- Make library C++ compatible (squimrel) -- Constify function signatures (squimrel) -- Revert checkCallback function signature (squimrel) - -* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 1:1.2.1-4 -- Python 2 binary package renamed to python2-isomd5sum - See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3 +* Tue Oct 03 2017 Brian C. Lane - 1.2.1-4 +- Fix aligned alloc parameters and overflow on 32bit (#1497458) * Wed Aug 02 2017 Fedora Release Engineering - 1:1.2.1-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild diff --git a/plans/smoke.fmf b/plans/smoke.fmf deleted file mode 100644 index 1c67208..0000000 --- a/plans/smoke.fmf +++ /dev/null @@ -1,7 +0,0 @@ -summary: Smoke tests for isomd5sum tools - -discover: - how: fmf - -execute: - how: tmt diff --git a/sources b/sources index 2ff8ef9..530ea4f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (isomd5sum-1.2.5.tar.gz) = aa6bb16be18b42925ac1834aa4d558fafdba7751639acfb7344a79f7ead1125d810f13c442458526f394d8790369b1c48ab41cb73881808740263161caa99655 +SHA512 (1.2.1.tar.gz) = 8ad4b3db4a5e1c13445fa7e30f74b594a023410d0b5bc6d018eeaab250b5756bd644f9f72c27841bb9068b3472ae125baa1a2d8b474e0e2ba4177a5c04df66b3 diff --git a/tests/smoke.fmf b/tests/smoke.fmf deleted file mode 100644 index 66450d8..0000000 --- a/tests/smoke.fmf +++ /dev/null @@ -1,6 +0,0 @@ -summary: Basic smoke test -contact: Radek Vykydal -path: /tests -test: ./smoke.sh -duration: 30m -require: [genisoimage, coreutils, isomd5sum] diff --git a/tests/smoke.sh b/tests/smoke.sh deleted file mode 100755 index ce667b2..0000000 --- a/tests/smoke.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -eux - -# Create testing iso image -rm -rf ./isocontent -mkdir isocontent -dd if=/dev/zero of=isocontent/big_enough_file bs=500K count=1 -mkisofs -o test.iso isocontent - -# Implant and check md5 sum -implantisomd5 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