control: tags -1 +patch Hi Guillem, On Sun, Nov 20, 2016 at 03:28:26AM +0100, Guillem Jover wrote: > Control: retitle -1 dpkg-maintscript-helper: Version comparison fails for > supposedly valid versions > Control: severity -1 serious > > Hi! > > On Fri, 2016-11-18 at 14:02:39 +0530, shirish शिरीष wrote: > > Package: dpkg > > Version: 1.18.14 > > Severity: normal > > > It seems the bug is in dpkg 1.18.11 and above. I was suffering from > > some sort of broken packages. I shared my issue at > > http://unix.stackexchange.com/questions/323817/debian-strech-update-broken-seems-buggy-dpkg > > . It took quite some time but it seems that dpkg at least 1.18.14 is > > somewhat broken/buggy in its implementation. In dpkg 1.18.10 I am able > > to fix the broken packages. These happened a few more times. I did run > > a few checks > > http://unix.stackexchange.com/questions/324151/how-to-find-out-half-configured-broken-packages-in-debian > > but found nothing untoward. > > Please include your reports inline, instead of referencing outside > resources, because this means those details might disappear (in the > future) in case those sites are shutdown, or it requires maintainers > to be online to check them. > > Ok, so this is about the dpkg-maintscript-helper failing on the > version validation check for supposedly valid versions. This was > recently reported on IRC too, but we were unable to reproduce it. If > you can still reproduce it, I'd appreciate if you could apply the > attached patch to your installed dpkg-maintscript-helper script > (from a dpkg version > 1.18.11) and rerun the failing package. > > Oh, I think I know what's wrong now, the attached patch should in > principle fix that.
I've tried the attached patches they still fail in my use case (pbuilder create). The reason is that stderr contains completely unrelated garbish form ld.so. I've added a version that relies on exit status only. Can this be applied? Cheers, -- Guido
>From 4dec2511556e80cd4f8fc9073e866e0feaa52108 Mon Sep 17 00:00:00 2001 Message-Id: <4dec2511556e80cd4f8fc9073e866e0feaa52108.1481882206.git....@sigxcpu.org> From: =?UTF-8?q?Guido=20G=C3=BCnther?= <a...@sigxcpu.org> Date: Fri, 16 Dec 2016 10:49:30 +0100 Subject: [PATCH] d-m-h: don't rely on command output for version comparison Don't capture stderr since it can contain totally unrelated errors e.g. from ld.so: dpkg-maintscript-helper: error: version '1.5.58~' is not valid: ERROR: ld.so: object 'libeatmydata.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored. when running "pbuilder create" with eatmydata configured. Compare to the same version instead so we only have non-zero exit status on errors. --- scripts/dpkg-maintscript-helper.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh index f20d826..cffbe66 100755 --- a/scripts/dpkg-maintscript-helper.sh +++ b/scripts/dpkg-maintscript-helper.sh @@ -49,8 +49,9 @@ rm_conffile() { [ "${CONFFILE}" != "${CONFFILE#/}" ] || \ error "conffile '$CONFFILE' is not an absolute path" # Use --compare-versions to validate the version number. - [ -z "$(dpkg --compare-versions -- "$LASTVERSION" eq '0' 2>&1)" ] || \ - error "version '$LASTVERSION' is not valid" + if ! dpkg --compare-versions -- "$LASTVERSION" eq "$LASTVERSION" 2>&1; then + error "version '$LASTVERSION' is not valid." + fi debug "Executing $0 rm_conffile in $DPKG_MAINTSCRIPT_NAME" \ "of $DPKG_MAINTSCRIPT_PACKAGE" @@ -163,8 +164,9 @@ mv_conffile() { [ "${NEWCONFFILE}" != "${NEWCONFFILE#/}" ] || \ error "new-conffile '$NEWCONFFILE' is not an absolute path" # Use --compare-versions to validate the version number. - [ -z "$(dpkg --compare-versions -- "$LASTVERSION" eq '0' 2>&1)" ] || \ - error "version '$LASTVERSION' is not valid" + if ! dpkg --compare-versions -- "$LASTVERSION" eq "$LASTVERSION" 2>&1; then + error "version '$LASTVERSION' is not valid." + fi debug "Executing $0 mv_conffile in $DPKG_MAINTSCRIPT_NAME" \ "of $DPKG_MAINTSCRIPT_PACKAGE" -- 2.10.2