diff --git a/.gitignore b/.gitignore index 55a851c..af1a2cb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ par2cmdline-0.4-tbb-20100203.tar.gz /v0.6.14.tar.gz /par2cmdline-0.7.4.tar.bz2 /par2cmdline-0.8.0.tar.bz2 +/par2cmdline-0.8.1.tar.bz2 diff --git a/0001-Fix-for-Github-issue-143.-Test-did-not-account-for-e.patch b/0001-Fix-for-Github-issue-143.-Test-did-not-account-for-e.patch new file mode 100644 index 0000000..4e5d4f9 --- /dev/null +++ b/0001-Fix-for-Github-issue-143.-Test-did-not-account-for-e.patch @@ -0,0 +1,68 @@ +From fcba671fdaf7973d17d67684685f71787cd0e0c7 Mon Sep 17 00:00:00 2001 +From: Michael Nahas +Date: Tue, 11 Feb 2020 22:42:08 -0600 +Subject: [PATCH] Fix for Github issue #143. Test did not account for + endianness correctly. + +--- + src/reedsolomon_test.cpp | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/src/reedsolomon_test.cpp b/src/reedsolomon_test.cpp +index 1285b3c..c8d26e9 100644 +--- a/src/reedsolomon_test.cpp ++++ b/src/reedsolomon_test.cpp +@@ -433,6 +433,23 @@ int test3() { + + + // Check that the correct constants are being used for Par2 ++ ++//The test pretends there are 10 input blocks ("NUM_IN") and 1 ++//recovery block ("NUM_REC"), each 1024 bytes long ("BUF_SIZE"). These ++//are all stored in data[11][BUF_SIZE], with the input blocks ++//occupying data[0] through data[9] and the recovery block in ++//data[10]. ++ ++//The test zeroes out the input blocks and then writes a 1 into the ++//first location of the first input block, and into the second ++//location of the second input block, etc. It then generates the ++//recovery block using many calls to ReedSolomon. When that happens, ++//those 1s are multiplied by the coefficients for each input block. So ++//the first location of recovery block holds the coefficient for the ++//first input block, the second location has the coefficient for the ++//second input block, etc. Those values are checked against the ++//expected values passed to the function. ++ + template + int test4(int NUM_IN, int *expected_bases) { + //const int NUM_IN = 10; +@@ -448,8 +465,9 @@ int test4(int NUM_IN, int *expected_bases) { + for (int k = 0; k < BUF_SIZE; k++) { + data[i][k] = (u8)0; + } +- // EXCEPT put a 1 in a different place for each file +- ((gtype *)(&(data[i][0])))[i] = (utype) 1; ++ // EXCEPT write a (little endian) 1 in a different place for each file ++ // In the i-th file, it is written into the i-th location ++ data[i][sizeof(utype)*i] = (u8) 1; + } + // zero recovery + for (int j = 0; j < NUM_REC; j++) { +@@ -488,7 +506,13 @@ int test4(int NUM_IN, int *expected_bases) { + // The recovery file has exponent 1 and should + // contain each base to the power 1. + for (int i = 0; i < NUM_IN; i++) { +- int base = (utype) ((gtype *) &(data[NUM_IN+0][0]))[i]; ++ // read little-endian value ++ utype v = 0; ++ for (int byte_index = 0; byte_index < sizeof(utype); byte_index++) { ++ u8 byte = data[NUM_IN+0][sizeof(utype)*i + byte_index]; ++ v |= (((utype)byte) << (byte_index*8)); ++ } ++ int base = v; + if (base != expected_bases[i]) { + cerr << "base at location " << i << " did not match expected." << endl; + cerr << " base = " << base << endl; +-- +2.25.2 + diff --git a/par2cmdline.spec b/par2cmdline.spec index b2cd8ca..0add035 100644 --- a/par2cmdline.spec +++ b/par2cmdline.spec @@ -1,11 +1,14 @@ Name: par2cmdline -Version: 0.8.0 -Release: 4%{?dist} +Version: 0.8.1 +Release: 1%{?dist} Summary: PAR 2.0 compatible file verification and repair tool License: GPLv2+ URL: https://github.com/Parchive/par2cmdline/ Source0: https://github.com/Parchive/par2cmdline/releases/download/v%{version}/par2cmdline-%{version}.tar.bz2 +# Fix tests to account for endianness correctly. +# Backport of https://github.com/Parchive/par2cmdline/commit/4f3576a314d7169912842ec9dc1e595e61e52653. +Patch0: 0001-Fix-for-Github-issue-143.-Test-did-not-account-for-e.patch BuildRequires: gcc-c++ @@ -19,7 +22,8 @@ multi-part archives. %prep -%autosetup +%autosetup -p 1 + # Remove executable permission from text files chmod -x ChangeLog configure.ac INSTALL Makefile.am NEWS stamp-h.in @@ -48,6 +52,10 @@ make check-TESTS %changelog +* Wed Jul 15 2020 Tadej Janež - 0.8.1-1 +- Update to 0.8.1 release +- Add patch to fix tests to account for endianness correctly + * Wed Jan 29 2020 Fedora Release Engineering - 0.8.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/sources b/sources index cb27e9e..90991f7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (par2cmdline-0.8.0.tar.bz2) = af91024dc80a4af0935c2fc0b867e57a8d3879d93146f52ab62d8bb105f2c637abe46c762302515417691d12144818446932c970d1018d2f10c0d4e1fa455020 +SHA512 (par2cmdline-0.8.1.tar.bz2) = b33ee654bd14269afb02d48175abf183281270c3e0dad9ffcaa0aa69c4271715a85e550d6d56fe5460ebfe9a37dc53b7d2210cd79a6f55d3921dc5dd5972c846