From 20cf529b3c574953ec80ffd719ab3daaa2e31997 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mar 20 2017 08:56:43 +0000 Subject: Add tests fix for sed file build-id regexp matching. --- diff --git a/0019-fix-sed-build-id-match-test.patch b/0019-fix-sed-build-id-match-test.patch new file mode 100644 index 0000000..cdbf6f4 --- /dev/null +++ b/0019-fix-sed-build-id-match-test.patch @@ -0,0 +1,268 @@ +commit f0a581925ad4c948dc58cc8f9a55399ad8de351e +Author: Mark Wielaard +Date: Fri Mar 3 23:51:13 2017 +0100 + + tests/tpmbuild.at: Make file sed regexp more strict to extract BuildID. + + In some testcases we extract the BuildID with the file command. + Unfortunately the file command output changed slightly between versions. + Make the sed regexp more strict by only matching a hex-string. + Also properly "escape" [ and ] which inside an AT_CHECK should be [[ and ]]. + + Tested against file versions 5.11, 5.29 and 5.30. + + Signed-off-by: Mark Wielaard + +diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at +index a46822f..dcbdd2c 100644 +--- a/tests/rpmbuild.at ++++ b/tests/rpmbuild.at +@@ -423,11 +423,11 @@ hello2_file=./usr/local/bin/hello2 + test -f $hello_file || echo "no hello file: $hello_file" + test -f $hello2_file || echo "no hello2 file: $hello2_file" + +-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-id2=$(file $hello2_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-id1debug=$(file $hello_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-idmulti=$(file $hello_multi_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++id2=$(file $hello2_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++id1debug=$(file $hello_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++idmulti=$(file $hello_multi_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug" + test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug" +@@ -516,11 +516,11 @@ hello2_file=./usr/local/bin/hello2 + test -f $hello_file || echo "no hello file: $hello_file" + test -f $hello2_file || echo "no hello2 file: $hello2_file" + +-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-id2=$(file $hello2_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-id1debug=$(file $hello_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') +-idmulti=$(file $hello_multi_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++id2=$(file $hello2_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++id1debug=$(file $hello_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++id2debug=$(file $hello2_file_debug | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') ++idmulti=$(file $hello_multi_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test "$id1" = "$id1debug" || echo "id1: $id1 != id1debug: $id1debug" + test "$id2" = "$id2debug" || echo "id2: $id2 != id2debug: $id2debug" +commit 09b5082f1073451423c6d5ebffed781e25472fd6 +Author: Mark Wielaard +Date: Mon Mar 20 09:27:05 2017 +0100 + + tests/rpmbuildid.at: Make file sed regexp more strict to extract BuildID. + + Like commit f0a5819 for rpmbuild.at. In the case of rpmbuildid.at the + sed expression looked to work, but only matched by accident. Make the sed + regexp more strict by only matching a hex-string. And properly "escape" + [ and ] which inside an AT_CHECK should be [[ and ]]. + + Signed-off-by: Mark Wielaard + +diff --git a/tests/rpmbuildid.at b/tests/rpmbuildid.at +index 15c0620..1c06ca1 100644 +--- a/tests/rpmbuildid.at ++++ b/tests/rpmbuildid.at +@@ -97,7 +97,7 @@ main_file=./usr/local/bin/hello + test -f "${main_file}" || echo "No main file ${main_file}" + + # Extract the build-id from the main file +-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + id_main_file="./usr/lib/debug/.build-id/${id_main:0:2}/${id_main:2}" + test -L "$id_main_file" || echo "No build-id file $id_main_file" +@@ -120,7 +120,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello.debug + test -f ${debug_file} || echo "No debug file ${debug_file}" + + # Extract the build-id from the .debug file +-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test ${id_main} = ${id_debug} || echo "unequal main and debug id" + +@@ -190,7 +190,7 @@ main_file=./usr/local/bin/hello + test -f "${main_file}" || echo "No main file ${main_file}" + + # Extract the build-id from the main file +-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + id_main_file="./usr/lib/debug/.build-id/${id_main:0:2}/${id_main:2}" + test -L "$id_main_file" || echo "No build-id file $id_main_file" +@@ -213,7 +213,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello-*.debug + test -f ${debug_file} || echo "No debug file ${debug_file}" + + # Extract the build-id from the .debug file +-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test ${id_main} = ${id_debug} || echo "unequal main and debug id" + +@@ -283,7 +283,7 @@ main_file=./usr/local/bin/hello + test -f "${main_file}" || echo "No main file ${main_file}" + + # Extract the build-id from the main file +-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}" + test -L "$id_main_file" || echo "No build-id file $id_main_file" +@@ -306,7 +306,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello.debug + test -f ${debug_file} || echo "No debug file ${debug_file}" + + # Extract the build-id from the .debug file +-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test ${id_main} = ${id_debug} || echo "unequal main and debug id" + +@@ -375,7 +375,7 @@ main_file=./usr/local/bin/hello + test -f "${main_file}" || echo "No main file ${main_file}" + + # Extract the build-id from the main file +-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}" + test -L "$id_main_file" || echo "No build-id file $id_main_file" +@@ -398,7 +398,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello-*.debug + test -f ${debug_file} || echo "No debug file ${debug_file}" + + # Extract the build-id from the .debug file +-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test ${id_main} = ${id_debug} || echo "unequal main and debug id" + +@@ -469,7 +469,7 @@ main_file=./usr/local/bin/hello + test -f "${main_file}" || echo "No main file ${main_file}" + + # Extract the build-id from the main file +-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}" + test -L "$id_main_file" || echo "No build-id file $id_main_file" +@@ -492,7 +492,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello.debug + test -f ${debug_file} || echo "No debug file ${debug_file}" + + # Extract the build-id from the .debug file +-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test ${id_main} = ${id_debug} || echo "unequal main and debug id" + +@@ -574,7 +574,7 @@ main_file=./usr/local/bin/hello + test -f "${main_file}" || echo "No main file ${main_file}" + + # Extract the build-id from the main file +-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}" + test -L "$id_main_file" || echo "No build-id file $id_main_file" +@@ -597,7 +597,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello-*debug + test -f ${debug_file} || echo "No debug file ${debug_file}" + + # Extract the build-id from the .debug file +-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + test ${id_main} = ${id_debug} || echo "unequal main and debug id" + +@@ -662,7 +662,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \ + hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file +-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # alldebug not here... + id_file="./usr/lib/debug/.build-id/${id:0:2}/${id:2}" +@@ -732,7 +732,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \ + hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file +-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # alldebug not here... + id_file="./usr/lib/debug/.build-id/${id:0:2}/${id:2}" +@@ -799,7 +799,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \ + hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file +-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # separate build-ids split... + id_file="./usr/lib/.build-id/${id:0:2}/${id:2}" +@@ -866,7 +866,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \ + hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file +-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # separate build-ids split... + id_file="./usr/lib/.build-id/${id:0:2}/${id:2}" +@@ -930,7 +930,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \ + hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file +-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # compat build-ids split... + id_file="./usr/lib/.build-id/${id:0:2}/${id:2}" +@@ -1009,7 +1009,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \ + hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file +-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # compat build-ids split... + id_file="./usr/lib/.build-id/${id:0:2}/${id:2}" +@@ -1084,7 +1084,7 @@ hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file + test -f $hello_file || echo "No $hello_file" +-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # Make sure we generate a new one + rm $hello_file +@@ -1101,7 +1101,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-2.*.rpm \ + + # Extract the build-id from the main file + test -f $hello_file || echo "No $hello_file" +-id2=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id2=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + if test "$id1" == "$id2"; then echo "equal $id1"; else echo "unequal"; fi + ], +@@ -1138,7 +1138,7 @@ hello_file=./usr/local/bin/hello + + # Extract the build-id from the main file + test -f $hello_file || echo "No $hello_file" +-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + # Make sure we generate a new one + rm $hello_file +@@ -1157,7 +1157,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-2.*.rpm \ + + # Extract the build-id from the main file + test -f $hello_file || echo "No $hello_file" +-id2=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/') ++id2=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/') + + if test "$id1" == "$id2"; then echo "equal"; else echo "unequal $id1 $id2"; fi + ], diff --git a/rpm.spec b/rpm.spec index 97bcdd8..7a953f3 100644 --- a/rpm.spec +++ b/rpm.spec @@ -90,6 +90,7 @@ Patch264: 0015-reset-buildid-file-attrs.patch Patch265: 0016-debugedit-replace-files.patch Patch266: 0017-do-not-process-buildi-ds-for-noarch.patch Patch267: 0018-update-build-id-endian.patch +Patch268: 0019-fix-sed-build-id-match-test.patch # OpenSSL backend Patch300: 0001-Add-OpenSSL-support-for-digest-and-signatures.patch @@ -594,6 +595,9 @@ exit 0 %doc doc/librpm/html/* %changelog +* Mon Mar 20 2017 Mark Wielaard +- Add tests fix for sed file build-id regexp matching. + * Fri Mar 17 2017 Mark Wielaard - 4.13.0.1-12 - Fix reading and updating (cross-endian) build-id information.