From 1fe1bd2bc86816dd9c0099605c2f8bfc0df3205f329e98989ca546197c497f0d Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 13 Apr 2018 07:12:49 +0000 Subject: [PATCH 1/7] - check rpm capabilities for recommends/suggests - Ignore /usr/lib/.build-id differences in package filelist OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=247 --- build-compare.changes | 10 ++++++++++ build-compare.spec | 4 ++-- functions.sh | 26 ++++++++++++++++++++++++-- pkg-diff.sh | 3 +++ 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index 9a33352..68e6fff 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Apr 13 07:10:30 UTC 2018 - olaf@aepfle.de + +- check rpm capabilities for recommends/suggests + +------------------------------------------------------------------- +Fri Dec 8 16:57:00 UTC 2017 - ol@infoserver.lv + +- Ignore /usr/lib/.build-id differences in package filelist + ------------------------------------------------------------------- Mon Dec 4 10:21:44 UTC 2017 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index 8029208..60c4e0a 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 20171204T112209.f06fbac +Version: 20180413T091103.4639e30 Release: 0 Source1: COPYING Source2: same-build-result.sh @@ -30,8 +30,8 @@ Source4: functions.sh Source5: srpm-check.sh %if 0%{?suse_version} Requires: bash -Requires: coreutils Requires: cpio +Requires: coreutils Requires: diffutils Requires: file Requires: gawk diff --git a/functions.sh b/functions.sh index 7923178..502d2f3 100644 --- a/functions.sh +++ b/functions.sh @@ -10,6 +10,12 @@ RPM="rpm -qp --nodigest --nosignature" +set_rpm_meta_global_variables() { + + local pkg=$1 + local rpm_tags= + local out=`mktemp` + # Name, Version, Release QF_NAME="%{NAME}" QF_VER_REL="%{VERSION}-%{RELEASE}" @@ -21,8 +27,19 @@ QF_PROVIDES="[%{PROVIDENAME} %{PROVIDEFLAGS} %{PROVIDEVERSION}\\n]\\n" QF_PROVIDES="${QF_PROVIDES}[%{REQUIRENAME} %{REQUIREFLAGS} %{REQUIREVERSION}\\n]\\n" QF_PROVIDES="${QF_PROVIDES}[%{CONFLICTNAME} %{CONFLICTFLAGS} %{CONFLICTVERSION}\\n]\\n" QF_PROVIDES="${QF_PROVIDES}[%{OBSOLETENAME} %{OBSOLETEFLAGS} %{OBSOLETEVERSION}\\n]\\n" -QF_PROVIDES="${QF_PROVIDES}[%{RECOMMENDNAME} %{RECOMMENDFLAGS} %{RECOMMENDVERSION}\\n]\\n" -QF_PROVIDES="${QF_PROVIDES}[%{SUPPLEMENTNAME} %{SUPPLEMENTFLAGS} %{SUPPLEMENTVERSION}\\n]\\n" + +rpm_tags="%{RECOMMENDNAME} %{RECOMMENDFLAGS} %{RECOMMENDVERSION}" +check_header "%{NAME} ${rpm_tags}" > "${out}" +if test -s "${out}" +then + QF_PROVIDES="${QF_PROVIDES}[${rpm_tags}\\n]\\n" +fi +rpm_tags="%{SUPPLEMENTNAME} %{SUPPLEMENTFLAGS} %{SUPPLEMENTVERSION}" +check_header "%{NAME} ${rpm_tags}" > "${out}" +if test -s "${out}" +then + QF_PROVIDES="${QF_PROVIDES}[${rpm_tags}\\n]\\n" +fi # don't look at RELEASE, it contains our build number QF_TAGS="%{NAME} %{VERSION} %{EPOCH}\\n" @@ -65,6 +82,7 @@ QF_ALL="$QF_ALL\n___QF_PROVIDES___\n${QF_PROVIDES}\n___QF_PROVIDES___\n" QF_ALL="$QF_ALL\n___QF_SCRIPT___\n${QF_SCRIPT}\n___QF_SCRIPT___\n" QF_ALL="$QF_ALL\n___QF_FILELIST___\n${QF_FILELIST}\n___QF_FILELIST___\n" QF_ALL="$QF_ALL\n___QF_CHECKSUM___\n${QF_CHECKSUM}\n___QF_CHECKSUM___\n" +} check_header() { @@ -83,6 +101,7 @@ function trim_release_old() /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_old_regex_l\$\|$version_release_old_regex_l)\)/{s,$version_release_old_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_old_regex_s,@VERSION@-@RELEASE_SHORT@,g} s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_old_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g + /\/usr\/lib\/\.build-id/d " } function trim_release_new() @@ -91,6 +110,7 @@ function trim_release_new() /\(\/boot\|\/lib\/modules\|\/lib\/firmware\|\/usr\/src\|$version_release_new_regex_l\$\|$version_release_new_regex_l)\)/{s,$version_release_new_regex_l,@VERSION@-@RELEASE_LONG@,g;s,$version_release_new_regex_s,@VERSION@-@RELEASE_SHORT@,g} s/\(\/var\/adm\/update-scripts\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g s/\(\/var\/adm\/update-messages\/\)${name_ver_rel_new_regex_l}\([^[:blank:]]\+\)/\1@NAME_VER_REL@\2/g + /\/usr\/lib\/\.build-id/d " } # Get single directory or filename with long or short release string @@ -222,6 +242,8 @@ function cmp_rpm_meta () rpm_meta_old=`mktemp` rpm_meta_new=`mktemp` + set_rpm_meta_global_variables $oldrpm + check_header "$QF_ALL" $oldrpm > $rpm_meta_old check_header "$QF_ALL" $newrpm > $rpm_meta_new diff --git a/pkg-diff.sh b/pkg-diff.sh index 5988ea7..680233d 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -659,6 +659,7 @@ check_single_file() # # # + # # # sed -i -e ' @@ -672,6 +673,8 @@ check_single_file() t next s/^\(\)/\1 some-date-removed-by-build-compare \5/ t next + s/^\(\)/\1 some-date-removed-by-build-compare \3/ + t next s/^\(\)/\1 some-date-removed-by-build-compare \3/ t next s/^// From 159d089c591e10c16748bc327371e5525e20b388c41ba64c1a8a8efcca0b30fe Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Mon, 28 May 2018 13:38:08 +0000 Subject: [PATCH 2/7] - Avoid large temporary files from hexdump output and avoid diff(1) runing OOM by using a fifo (issue#24) OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=248 --- build-compare.changes | 6 ++++++ build-compare.spec | 2 +- pkg-diff.sh | 25 +++++++++++++++++++------ 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index 68e6fff..78c5deb 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon May 28 13:26:44 UTC 2018 - olaf@aepfle.de + +- Avoid large temporary files from hexdump output and avoid + diff(1) runing OOM by using a fifo (issue#24) + ------------------------------------------------------------------- Fri Apr 13 07:10:30 UTC 2018 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index 60c4e0a..71be5b7 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 20180413T091103.4639e30 +Version: 20180528T152809.3cec12e Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/pkg-diff.sh b/pkg-diff.sh index 680233d..5e5f53e 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -280,6 +280,9 @@ dfile=`mktemp` diff_two_files() { + local offset length + local po pn + if test ! -e old/$file; then echo "Missing in old package: $file" return 1 @@ -289,15 +292,25 @@ diff_two_files() return 1 fi - if cmp -s old/$file new/$file; then + if cmp -b old/$file new/$file > $dfile ; then return 0 fi + if ! test -s $dfile ; then + return 1 + fi - echo "$file differs ($ftype)" - hexdump -C old/$file > $file1 & - hexdump -C new/$file > $file2 & - wait - diff -u $file1 $file2 | $buildcompare_head + offset=`sed 's@^.*differ: byte @@;s@,.*@@' < $dfile` + echo "$file differs at offset '$offset' ($ftype)" + po=`mktemp --dry-run $TMPDIR/old.XXX` + pn=`mktemp --dry-run $TMPDIR/new.XXX` + mkfifo -m 0600 $po + mkfifo -m 0600 $pn + offset=$(( ($offset >> 6) << 6 )) + length=512 + hexdump -C -s $offset -l $length old/$file > $po & + hexdump -C -s $offset -l $length new/$file > $pn & + diff -u $po $pn | $buildcompare_head + rm -f $po $pn return 1 } From df37dcbff0b4fecb575c92d75373934576f1a590e70f19564c26d7fa2c6728af Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 29 May 2018 19:57:21 +0000 Subject: [PATCH 3/7] correct arguments for hexdump OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=249 --- build-compare.spec | 2 +- pkg-diff.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build-compare.spec b/build-compare.spec index 71be5b7..b559173 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 20180528T152809.3cec12e +Version: 20180529T215607.c58679f Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/pkg-diff.sh b/pkg-diff.sh index 5e5f53e..0409291 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -307,8 +307,8 @@ diff_two_files() mkfifo -m 0600 $pn offset=$(( ($offset >> 6) << 6 )) length=512 - hexdump -C -s $offset -l $length old/$file > $po & - hexdump -C -s $offset -l $length new/$file > $pn & + hexdump -C -s $offset -n $length old/$file > $po & + hexdump -C -s $offset -n $length new/$file > $pn & diff -u $po $pn | $buildcompare_head rm -f $po $pn return 1 From 10c76e1eaac269a81bae61d4f9a7988600e6341eb4b55d8b1d749a821854b0c8 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 26 Jun 2018 06:48:10 +0000 Subject: [PATCH 4/7] - Recognize "setuid ELF nn-bit xSB shared object" ELF binaries OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=250 --- build-compare.changes | 5 +++++ build-compare.spec | 2 +- pkg-diff.sh | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index 78c5deb..e1da2d2 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jun 26 06:45:38 UTC 2018 - olaf@aepfle.de + +- Recognize "setuid ELF nn-bit xSB shared object" ELF binaries + ------------------------------------------------------------------- Mon May 28 13:26:44 UTC 2018 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index b559173..ece1c4c 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 20180529T215607.c58679f +Version: 20180626T084710.9c80bbc Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/pkg-diff.sh b/pkg-diff.sh index 0409291..718c0f1 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -824,7 +824,7 @@ check_single_file() return 1 fi ;; - ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*) + ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*|setuid ELF*[LM]SB\ shared\ object*) $OBJDUMP -d --no-show-raw-insn old/$file > $file1 ret=$? $OBJDUMP -d --no-show-raw-insn new/$file > $file2 From 8e554ff73e3c4e278999bb413d137a64c31cb7b00991f66336860d30b5d28b37 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Tue, 26 Jun 2018 16:38:45 +0000 Subject: [PATCH 5/7] typo in previous change OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=251 --- build-compare.spec | 2 +- pkg-diff.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build-compare.spec b/build-compare.spec index ece1c4c..c8aea66 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 20180626T084710.9c80bbc +Version: 20180626T183715.37a4b00 Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/pkg-diff.sh b/pkg-diff.sh index 718c0f1..4686eb3 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -824,7 +824,7 @@ check_single_file() return 1 fi ;; - ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*|setuid ELF*[LM]SB\ shared\ object*) + ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*|setuid\ ELF*[LM]SB\ shared\ object*) $OBJDUMP -d --no-show-raw-insn old/$file > $file1 ret=$? $OBJDUMP -d --no-show-raw-insn new/$file > $file2 From 5d84d5ea8cc4cf72feb7f66d1ec6b2dab0d2853da85ea955d229cd7c190ca3ce Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Wed, 4 Jul 2018 05:59:33 +0000 Subject: [PATCH 6/7] - Match also ELF pie executable (bsc#1097339) - Remove trailing space from two match patterns OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=252 --- build-compare.changes | 10 ++++++++++ build-compare.spec | 2 +- pkg-diff.sh | 11 ++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index e1da2d2..fcb69e9 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Jul 4 05:58:13 UTC 2018 - olaf@aepfle.de + +- Match also ELF pie executable (bsc#1097339) + +------------------------------------------------------------------- +Wed Jul 4 05:42:05 UTC 2018 - olaf@aepfle.de + +- Remove trailing space from two match patterns + ------------------------------------------------------------------- Tue Jun 26 06:45:38 UTC 2018 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index c8aea66..219d2d6 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 20180626T183715.37a4b00 +Version: 20180704T075846.8f3031d Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/pkg-diff.sh b/pkg-diff.sh index 4686eb3..b9cff38 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -707,7 +707,7 @@ check_single_file() esac done ;; - /usr/share/javadoc/gjdoc.properties |\ + /usr/share/javadoc/gjdoc.properties|\ /usr/share/javadoc/*/gjdoc.properties) for f in old/$file new/$file; do sed -i -e 's|^#[A-Z][a-z]\{2\} [A-Z][a-z]\{2\} [0-9]\{2\} ..:..:.. GMT 20..$|#Fri Jan 01 11:27:36 GMT 2009|' $f @@ -744,7 +744,7 @@ check_single_file() *.elc) filter_generic emacs_lisp ;; - /var/lib/texmf/web2c/*/*fmt |\ + /var/lib/texmf/web2c/*/*fmt|\ /var/lib/texmf/web2c/metafont/*.base|\ /var/lib/texmf/web2c/metapost/*.mem) # binary dump of TeX and Metafont formats, we can ignore them for good @@ -824,7 +824,12 @@ check_single_file() return 1 fi ;; - ELF*executable*|ELF*[LM]SB\ relocatable*|ELF*[LM]SB\ shared\ object*|setuid\ ELF*[LM]SB\ shared\ object*) + ELF*executable*|\ + ELF*[LM]SB\ relocatable*|\ + ELF*[LM]SB\ shared\ object*|\ + setuid\ ELF*[LM]SB\ shared\ object*|\ + ELF*[LM]SB\ pie\ executable*|\ + setuid\ ELF*[LM]SB\ pie\ executable*) $OBJDUMP -d --no-show-raw-insn old/$file > $file1 ret=$? $OBJDUMP -d --no-show-raw-insn new/$file > $file2 From e3e3d3e14da0f561f22552645e711bb605076b5edf42b6ecffc1f551427cf30b Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 6 Jul 2018 14:02:40 +0000 Subject: [PATCH 7/7] - pkg-diff: fix diff returning 0 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=253 --- build-compare.changes | 5 +++++ build-compare.spec | 2 +- pkg-diff.sh | 5 +---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index fcb69e9..c7ce4a4 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Jul 6 14:01:17 UTC 2018 - olaf@aepfle.de + +- pkg-diff: fix diff returning 0 + ------------------------------------------------------------------- Wed Jul 4 05:58:13 UTC 2018 - olaf@aepfle.de diff --git a/build-compare.spec b/build-compare.spec index 219d2d6..494f296 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -21,7 +21,7 @@ Summary: Build Result Compare Script License: GPL-2.0+ Group: Development/Tools/Building Url: https://github.com/openSUSE/build-compare -Version: 20180704T075846.8f3031d +Version: 20180706T160151.66224a8 Release: 0 Source1: COPYING Source2: same-build-result.sh diff --git a/pkg-diff.sh b/pkg-diff.sh index b9cff38..5dd6884 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -469,6 +469,7 @@ check_compressed_file() check_single_file() { local file="$1" + local ret=0 # If the two files are the same, return at once. if [ -f old/$file -a -f new/$file ]; then @@ -512,7 +513,6 @@ check_single_file() cd $pwd/new/$fdir cpio --quiet --extract --force-local < "../${file##*/}" cd $pwd - local ret=0 for f in $flist; do if ! check_single_file $fdir/$f; then ret=1 @@ -529,7 +529,6 @@ check_single_file() fdir=$file.extract.$PPID.$$ unsquashfs -no-progress -dest old/$fdir "old/$file" unsquashfs -no-progress -dest new/$fdir "new/$file" - local ret=0 for f in $flist; do if ! check_single_file $fdir/$f; then ret=1 @@ -550,7 +549,6 @@ check_single_file() cd $pwd/new/$fdir tar xf `basename $file` cd $pwd - local ret=0 for f in $flist; do if ! check_single_file $fdir/$f; then ret=1 @@ -582,7 +580,6 @@ check_single_file() cd $pwd/new/$fdir unjar `basename $file` cd $pwd - local ret=0 for f in $flist; do if test -f new/$fdir/$f && ! check_single_file $fdir/$f; then ret=1