Igor Gnatenko 082d5d
From 58f2b095c0d1507ad09990669f1ae03f6f1d931f Mon Sep 17 00:00:00 2001
Igor Gnatenko 082d5d
From: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
Date: Mon, 20 Mar 2017 09:55:44 +0100
Igor Gnatenko 3992a6
Subject: [PATCH 24/54] tests/rpmbuildid.at: Make file sed regexp more strict
Igor Gnatenko 082d5d
 to extract BuildID.
Mark Wielaard 20cf52
Igor Gnatenko 082d5d
Like commit f0a5819 for rpmbuild.at. In the case of rpmbuildid.at the
Igor Gnatenko 082d5d
sed expression looked to work, but only matched by accident. Make the sed
Igor Gnatenko 082d5d
regexp more strict by only matching a hex-string. And properly "escape"
Igor Gnatenko 082d5d
[ and ] which inside an AT_CHECK should be [[ and ]].
Mark Wielaard 20cf52
Igor Gnatenko 082d5d
Signed-off-by: Mark Wielaard <mark@klomp.org>
Igor Gnatenko 082d5d
(cherry picked from commit 60f958ab41f854f8839fe04f1a67d1752ad7eda0)
Igor Gnatenko 082d5d
---
Igor Gnatenko 082d5d
 tests/rpmbuildid.at | 44 ++++++++++++++++++++++----------------------
Igor Gnatenko 082d5d
 1 file changed, 22 insertions(+), 22 deletions(-)
Mark Wielaard 20cf52
Mark Wielaard 20cf52
diff --git a/tests/rpmbuildid.at b/tests/rpmbuildid.at
Igor Gnatenko 082d5d
index a0e39782c..158ce122d 100644
Mark Wielaard 20cf52
--- a/tests/rpmbuildid.at
Mark Wielaard 20cf52
+++ b/tests/rpmbuildid.at
Mark Wielaard 20cf52
@@ -97,7 +97,7 @@ main_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 test -f "${main_file}" || echo "No main file ${main_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 id_main_file="./usr/lib/debug/.build-id/${id_main:0:2}/${id_main:2}"
Mark Wielaard 20cf52
 test -L "$id_main_file" || echo "No build-id file $id_main_file"
Mark Wielaard 20cf52
@@ -120,7 +120,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello.debug
Mark Wielaard 20cf52
 test -f ${debug_file} || echo "No debug file ${debug_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the .debug file
Mark Wielaard 20cf52
-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 test ${id_main} = ${id_debug} || echo "unequal main and debug id"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
@@ -190,7 +190,7 @@ main_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 test -f "${main_file}" || echo "No main file ${main_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 id_main_file="./usr/lib/debug/.build-id/${id_main:0:2}/${id_main:2}"
Mark Wielaard 20cf52
 test -L "$id_main_file" || echo "No build-id file $id_main_file"
Mark Wielaard 20cf52
@@ -213,7 +213,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello-*.debug
Mark Wielaard 20cf52
 test -f ${debug_file} || echo "No debug file ${debug_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the .debug file
Mark Wielaard 20cf52
-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 test ${id_main} = ${id_debug} || echo "unequal main and debug id"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
@@ -283,7 +283,7 @@ main_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 test -f "${main_file}" || echo "No main file ${main_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}"
Mark Wielaard 20cf52
 test -L "$id_main_file" || echo "No build-id file $id_main_file"
Mark Wielaard 20cf52
@@ -306,7 +306,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello.debug
Mark Wielaard 20cf52
 test -f ${debug_file} || echo "No debug file ${debug_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the .debug file
Mark Wielaard 20cf52
-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 test ${id_main} = ${id_debug} || echo "unequal main and debug id"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
@@ -375,7 +375,7 @@ main_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 test -f "${main_file}" || echo "No main file ${main_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}"
Mark Wielaard 20cf52
 test -L "$id_main_file" || echo "No build-id file $id_main_file"
Mark Wielaard 20cf52
@@ -398,7 +398,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello-*.debug
Mark Wielaard 20cf52
 test -f ${debug_file} || echo "No debug file ${debug_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the .debug file
Mark Wielaard 20cf52
-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 test ${id_main} = ${id_debug} || echo "unequal main and debug id"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
@@ -469,7 +469,7 @@ main_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 test -f "${main_file}" || echo "No main file ${main_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}"
Mark Wielaard 20cf52
 test -L "$id_main_file" || echo "No build-id file $id_main_file"
Mark Wielaard 20cf52
@@ -492,7 +492,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello.debug
Mark Wielaard 20cf52
 test -f ${debug_file} || echo "No debug file ${debug_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the .debug file
Mark Wielaard 20cf52
-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 test ${id_main} = ${id_debug} || echo "unequal main and debug id"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
@@ -574,7 +574,7 @@ main_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 test -f "${main_file}" || echo "No main file ${main_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id_main=$(file $main_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_main=$(file $main_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 id_main_file="./usr/lib/.build-id/${id_main:0:2}/${id_main:2}"
Mark Wielaard 20cf52
 test -L "$id_main_file" || echo "No build-id file $id_main_file"
Mark Wielaard 20cf52
@@ -597,7 +597,7 @@ debug_file=./usr/lib/debug/usr/local/bin/hello-*debug
Mark Wielaard 20cf52
 test -f ${debug_file} || echo "No debug file ${debug_file}"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the .debug file
Mark Wielaard 20cf52
-id_debug=$(file $debug_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id_debug=$(file $debug_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 test ${id_main} = ${id_debug} || echo "unequal main and debug id"
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
@@ -662,7 +662,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
Mark Wielaard 20cf52
 hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # alldebug not here...
Mark Wielaard 20cf52
 id_file="./usr/lib/debug/.build-id/${id:0:2}/${id:2}"
Mark Wielaard 20cf52
@@ -732,7 +732,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
Mark Wielaard 20cf52
 hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # alldebug not here...
Mark Wielaard 20cf52
 id_file="./usr/lib/debug/.build-id/${id:0:2}/${id:2}"
Mark Wielaard 20cf52
@@ -799,7 +799,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
Mark Wielaard 20cf52
 hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # separate build-ids split...
Mark Wielaard 20cf52
 id_file="./usr/lib/.build-id/${id:0:2}/${id:2}"
Mark Wielaard 20cf52
@@ -866,7 +866,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
Mark Wielaard 20cf52
 hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # separate build-ids split...
Mark Wielaard 20cf52
 id_file="./usr/lib/.build-id/${id:0:2}/${id:2}"
Mark Wielaard 20cf52
@@ -930,7 +930,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
Mark Wielaard 20cf52
 hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # compat build-ids split...
Mark Wielaard 20cf52
 id_file="./usr/lib/.build-id/${id:0:2}/${id:2}"
Mark Wielaard 20cf52
@@ -1009,7 +1009,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello2-1.0-1.*.rpm \
Mark Wielaard 20cf52
 hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
-id=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # compat build-ids split...
Mark Wielaard 20cf52
 id_file="./usr/lib/.build-id/${id:0:2}/${id:2}"
Mark Wielaard 20cf52
@@ -1084,7 +1084,7 @@ hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
 test -f $hello_file || echo "No $hello_file"
Mark Wielaard 20cf52
-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Make sure we generate a new one
Mark Wielaard 20cf52
 rm $hello_file
Mark Wielaard 20cf52
@@ -1101,7 +1101,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-2.*.rpm \
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
 test -f $hello_file || echo "No $hello_file"
Mark Wielaard 20cf52
-id2=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id2=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 if test "$id1" == "$id2"; then echo "equal $id1"; else echo "unequal"; fi
Mark Wielaard 20cf52
 ],
Mark Wielaard 20cf52
@@ -1138,7 +1138,7 @@ hello_file=./usr/local/bin/hello
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
 test -f $hello_file || echo "No $hello_file"
Mark Wielaard 20cf52
-id1=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id1=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Make sure we generate a new one
Mark Wielaard 20cf52
 rm $hello_file
Mark Wielaard 20cf52
@@ -1157,7 +1157,7 @@ rpm2cpio ${abs_builddir}/testing/build/RPMS/*/hello-1.0-2.*.rpm \
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 # Extract the build-id from the main file
Mark Wielaard 20cf52
 test -f $hello_file || echo "No $hello_file"
Mark Wielaard 20cf52
-id2=$(file $hello_file | sed 's/.*, BuildID[.*]=\(.*\),.*/\1/')
Mark Wielaard 20cf52
+id2=$(file $hello_file | sed 's/.*, BuildID\[[.*\]]=\([[0-9a-f]]*\),.*/\1/')
Mark Wielaard 20cf52
 
Mark Wielaard 20cf52
 if test "$id1" == "$id2"; then echo "equal"; else echo "unequal $id1 $id2"; fi
Mark Wielaard 20cf52
 ],
Igor Gnatenko 082d5d
-- 
Igor Gnatenko 082d5d
2.13.2
Igor Gnatenko 082d5d