diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore index 0150b00..95d6369 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,9 @@ /isomd5sum-1.0.12.tar.bz2 /1.0.12.tar.gz /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-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 e3d26f4..e7272ea 100644 --- a/isomd5sum.spec +++ b/isomd5sum.spec @@ -1,16 +1,21 @@ +%global forgeurl https://github.com/rhinstaller/isomd5sum + Summary: Utilities for working with md5sum implanted in ISO images Name: isomd5sum -Version: 1.1.0 +Version: 1.2.5 Release: 5%{?dist} Epoch: 1 -License: GPLv2+ -Group: Applications/System +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 -BuildRequires: python2-devel python3-devel +BuildRequires: python3-devel +BuildRequires: make %description The isomd5sum package contains utilities for implanting and verifying @@ -18,7 +23,6 @@ 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} @@ -26,14 +30,6 @@ 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 @@ -43,25 +39,18 @@ an md5sum implanted into an ISO9660 image. %prep -%setup -q +%forgeautosetup -rm -rf %{py3dir} -cp -a . %{py3dir} %build CFLAGS="$RPM_OPT_FLAGS -Wno-strict-aliasing"; export CFLAGS -PYTHON=%{__python2} make checkisomd5 implantisomd5 pyisomd5sum.so +LDFLAGS="$RPM_LD_FLAGS"; export LDFLAGS -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 @@ -72,14 +61,167 @@ popd %files devel %{_includedir}/*.h %{_libdir}/*.a - -%files -n python-isomd5sum -%{python2_sitearch}/pyisomd5sum.so +/usr/share/pkgconfig/isomd5sum.pc %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 + +* Wed Aug 02 2017 Fedora Release Engineering - 1:1.2.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1:1.2.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Fri Jun 09 2017 Brian C. Lane - 1:1.2.1-1 +- New Version 1.2.1 (bcl) +- Let the user pass their own file descriptor (squimrel) +- Correct format specifiers (squimrel) + +* Thu Jun 08 2017 Brian C. Lane - 1:1.2.0-1 +- New Version 1.2.0 (bcl) +- Improve the python test and add a test target to the Makefile (bcl) +- Improve error handling of libimplantisomd5 (squimrel) +- Fix popt memory leak and avoid exit in main (squimrel) +- Add derived clang format and editorconfig (squimrel) +- Format, constify, castify, decl-at-use code (squimrel) +- Make libimplantisomd5 use the utilities (squimrel) +- Implement shared utilities (squimrel) +- Refactor libcheckisomd5 (squimrel) + * Fri Feb 10 2017 Fedora Release Engineering - 1:1.1.0-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild diff --git a/plans/smoke.fmf b/plans/smoke.fmf new file mode 100644 index 0000000..1c67208 --- /dev/null +++ b/plans/smoke.fmf @@ -0,0 +1,7 @@ +summary: Smoke tests for isomd5sum tools + +discover: + how: fmf + +execute: + how: tmt diff --git a/sources b/sources index db53830..2ff8ef9 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -eac79ba8ecc16034339a8675a989833e 1.1.0.tar.gz +SHA512 (isomd5sum-1.2.5.tar.gz) = aa6bb16be18b42925ac1834aa4d558fafdba7751639acfb7344a79f7ead1125d810f13c442458526f394d8790369b1c48ab41cb73881808740263161caa99655 diff --git a/tests/smoke.fmf b/tests/smoke.fmf new file mode 100644 index 0000000..66450d8 --- /dev/null +++ b/tests/smoke.fmf @@ -0,0 +1,6 @@ +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 new file mode 100755 index 0000000..ce667b2 --- /dev/null +++ b/tests/smoke.sh @@ -0,0 +1,19 @@ +#!/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