Bug#844701: dpkg-maintscript-helper: Version comparison fails for supposedly valid versions

2016-12-16 Thread Guillem Jover
On Fri, 2016-12-16 at 14:32:35 +0100, Guido Günther wrote:
> On Fri, Dec 16, 2016 at 02:17:05PM +0100, Guillem Jover wrote:
> > […] Which is what I'm
> > in principle planning on merging for .16 which I should really be
> > releasing this week. :/
> > 
> > Sorry for the delay. Things have not been looking good from here. :(

> I can NMU dpkg with just that fix so you have all the time needed for
> the next version. This would at unbreak creating / updating chroots with
> pbuilder and eatmydata (and whetever folks are using to manage their
> chroots).

Thanks! But I prefer to handle the uploads myself, as the release
machinery (even thought it's documented in the wiki) is delicate.

I've just not been giving this priority as I thought this was only
affecting some upgrade paths, as from the report it was not clear
to me this was a more general and widespread problem.

I'll just start the release process and target a release for later
today. Hope this is early enough! :)

Thanks,
Guillem



Bug#844701: dpkg-maintscript-helper: Version comparison fails for supposedly valid versions

2016-12-16 Thread Guido Günther
On Fri, Dec 16, 2016 at 02:17:05PM +0100, Guillem Jover wrote:
> Hi!
> 
> On Fri, 2016-12-16 at 11:00:01 +0100, Guido Günther wrote:
> > 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?
> 
> Ah clever indeed! I had come to the same conclusion that relying on
> stdout/stderr was a very bad idea, so I had already implemented a
> bunch of --validate- commands in dpkg (with  being
> version, pkgname, trigname and archname), which do exactly that,
> are not affected by debug settings or similar. Which is what I'm
> in principle planning on merging for .16 which I should really be
> releasing this week. :/
> 
> Sorry for the delay. Things have not been looking good from here. :(

I can NMU dpkg with just that fix so you have all the time needed for
the next version. This would at unbreak creating / updating chroots with
pbuilder and eatmydata (and whetever folks are using to manage their
chroots).

(and having --validate- is nice to have).

Cheers,
 -- Guido



Bug#844701: dpkg-maintscript-helper: Version comparison fails for supposedly valid versions

2016-12-16 Thread Guillem Jover
Hi!

On Fri, 2016-12-16 at 11:00:01 +0100, Guido Günther wrote:
> 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?

Ah clever indeed! I had come to the same conclusion that relying on
stdout/stderr was a very bad idea, so I had already implemented a
bunch of --validate- commands in dpkg (with  being
version, pkgname, trigname and archname), which do exactly that,
are not affected by debug settings or similar. Which is what I'm
in principle planning on merging for .16 which I should really be
releasing this week. :/

Sorry for the delay. Things have not been looking good from here. :(

Thanks,
Guillem



Bug#844701: dpkg-maintscript-helper: Version comparison fails for supposedly valid versions

2016-12-16 Thread Ritesh Raj Sarraf
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

On Fri, 2016-12-16 at 11:00 +0100, Guido Günther wrote:
> I've tried the attached patches they still fail in my use case (pbuilder
> create). 

Thanks for the root cause. My use case is the same.

> The reason is that stderr contains completely unrelated garbish
> form ld.so. I've added a version that relies on exit status only. 

Hmmm. Yes. THis must be the reason. I'm going to try your patch.

> Can
> this be applied?
- -- 
Ritesh Raj Sarraf | http://people.debian.org/~rrs
Debian - The Universal Operating System
-BEGIN PGP SIGNATURE-

iQIzBAEBCgAdFiEEQCVDstmIVAB/Yn02pjpYo/LhdWkFAlhT5k4ACgkQpjpYo/Lh
dWnTUA/9EJmXudK5OR/Oo9DUtHzkEYsuN+g+q0ioZXV2Qn/PKKH/NaAVmQHxqjIc
lv1sPtsSnKqXnU1Up2M60hjttSPifvdgOvCz9kvXgUmIE7Lw3joMxh7fl/guLhaV
RNCpg0l7BOrBWJOIBp6GnIYclrtT5ZqYuFI2jYc3BIXTRSkjvAIuZmoodPIWxfcH
U/YlaRSfRlT2eX1mk/Z3pK/0TZIfuQjEBaVSD3tsGluXaXO/ADWj9OQ5Y1t4jYJp
9msZlzkzguc7P52WEyiWEaAVcZlOcIKwTDhbr9NO6up1q8WE1EXrIhXP0p8l7Fpq
GYj03bijGqaFHBJf+MCq/RPKDUzV2sd1GYJWXlXC1VEjXhTBFv/qef7wd/t5dx6J
SY8EGl0FFUJStths2WEG8cFM/jhk+n1yt3Fq3gW+Ofz72+MISPAyy/lMK4OPWZ1p
kFW0ftMqx55DU+KFKnZHofNBilO3v9MCKvnOd6YSIBDvWJ6BGT9PNC4BALo/nhwV
SG8MPtS7cSK00sSLRIeJNAUJBD/c/4fXomcAUi9xqBklpxtxBsl0XAbr2k8XM1Zo
/E+vB4s+bR7d1dusLlL/MMooVEbyVgYDcK1nBUPPz2Br9komcu33sXs1hnoQ+kl4
gSVqEag/8JNjY810WTp90Ai2bXMXzk+R78Kne5sRrSKazVgf3SQ=
=Z9f/
-END PGP SIGNATURE-



Processed: Bug#844701: dpkg-maintscript-helper: Version comparison fails for supposedly valid versions

2016-12-16 Thread Debian Bug Tracking System
Processing control commands:

> tags -1 +patch
Bug #844701 [dpkg] dpkg-maintscript-helper: Version comparison fails for 
supposedly valid versions
Bug #846624 [dpkg] debconf: invalid version in maintainer script
Added tag(s) patch.
Added tag(s) patch.

-- 
844701: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844701
846624: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=846624
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#844701: dpkg-maintscript-helper: Version comparison fails for supposedly valid versions

2016-12-16 Thread Guido Günther
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?= 
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