Package: devscripts Version: 2.15.8 Severity: normal Tags: patch uupdate has a bit cryptic shell contruct:
| UVERSION=`expr "$SVERSION" : '\(.*\)-[0-9a-zA-Z.+~]*$'` || | { | echo "$PROGNAME: a native Debian package cannot take upstream updates" >&2 | exit 1 | } It looks like some expert coding style beyond I would come up but there is a catch. * If SVERSION=1-1, uupdate works. * If SVERSION=1, uupdate thinks it is a native Debian package (right). * If SVERSION=0-1, uupdate thinks it is a native Debian package (wrong). The reason is the return code of expr is: Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred. If SVERSION=1, it is null and return 1. Good. If SVERSION=0-1, it is 0 and return 1. Not nice! So we should ignore return code with || true and use test -z "$UVERSION" to decide if it is a native Debian package or not. Osamu -- Package-specific info: --- /etc/devscripts.conf --- --- ~/.devscripts --- DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -us -uc" DEBUILD_LINTIAN_OPTS="-i -I --show-overrides" DEBSIGN_KEYID="1DD8D791" -- System Information: Debian Release: 8.1 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'stable'), (99, 'testing'), (98, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages devscripts depends on: ii dpkg-dev 1.17.25 ii libc6 2.19-18 ii perl 5.20.2-3+deb8u1 ii python3 3.4.2-2 pn python3:any <none> Versions of packages devscripts recommends: ii at 3.1.16-1 ii curl 7.38.0-4+deb8u2 ii dctrl-tools 2.23 ii debian-keyring 2015.04.10 ii dput 0.9.6.4 ii equivs 2.0.9 ii fakeroot 1.20.2-1 ii file 1:5.22+15-2 ii gnupg 1.4.18-7 ii libdistro-info-perl 0.14 ii libencode-locale-perl 1.03-1 ii libjson-perl 2.61-1 ii liblwp-protocol-https-perl 6.06-2 ii libparse-debcontrol-perl 2.005-4 ii libsoap-lite-perl 1.11-1 ii liburi-perl 1.64-1 ii libwww-perl 6.08-1 ii lintian 2.5.35~bpo8+1 ii man-db 2.7.0.2-5 ii patch 2.7.5-1 ii patchutils 0.3.3-1 ii python3-debian 0.1.27 ii python3-magic 1:5.22+15-2 ii sensible-utils 0.0.9 ii strace 4.9-2 ii unzip 6.0-16 ii wdiff 1.2.2-1 ii wget 1.16-1 ii xz-utils 5.1.1alpha+20120614-2+b3 Versions of packages devscripts suggests: ii bsd-mailx [mailx] 8.1.2-0.20141216cvs-2 ii build-essential 11.7 pn cvs-buildpackage <none> pn debbindiff <none> pn devscripts-el <none> pn gnuplot <none> ii gpgv 1.4.18-7 ii libauthen-sasl-perl 2.1600-1 ii libfile-desktopentry-perl 0.07-1 ii libnet-smtp-ssl-perl 1.01-3 pn libterm-size-perl <none> ii libtimedate-perl 2.3000-2 ii libyaml-syck-perl 1.27-2+b2 ii mutt 1.5.23-3 ii openssh-client [ssh-client] 1:6.7p1-5 pn svn-buildpackage <none> ii w3m 0.5.3-19 -- no debconf information
>From 1a404b68e8a6d34d8728d08962e9a84a23f58e23 Mon Sep 17 00:00:00 2001 From: Osamu Aoki <os...@debian.org> Date: Sun, 6 Sep 2015 18:38:01 +0900 Subject: [PATCH] uupdate: exit code is tricky Bug: * If SVERSION=1-1, uupdate works. (right) * If SVERSION=1, uupdate thinks it is a native Debian package (right). * If SVERSION=0-1, uupdate thinks it is a native Debian package (wrong). The reason is the return code of expr is: Exit status is 0 if EXPRESSION is neither null nor 0, 1 if EXPRESSION is null or 0, 2 if EXPRESSION is syntactically invalid, and 3 if an error occurred. If SVERSION=1, it is null and return 1. Good. If SVERSION=0-1, it is 0 and return 1. Not nice! --- scripts/uupdate.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/uupdate.sh b/scripts/uupdate.sh index e037327..4240ea8 100755 --- a/scripts/uupdate.sh +++ b/scripts/uupdate.sh @@ -237,11 +237,11 @@ mustsetvar VERSION "`dpkg-parsechangelog -SVersion`" "source version" # Get epoch and upstream version eval `echo "$VERSION" | perl -ne '/^(?:(\d+):)?(.*)/; print "SVERSION=$2\nEPOCH=$1\n";'` -UVERSION=`expr "$SVERSION" : '\(.*\)-[0-9a-zA-Z.+~]*$'` || -{ +UVERSION=`expr "$SVERSION" : '\(.*\)-[0-9a-zA-Z.+~]*$' || true` +if [ -z "$UVERSION" ]; then echo "$PROGNAME: a native Debian package cannot take upstream updates" >&2 exit 1 -} +fi # Save pwd before we goes walkabout OPWD=`pwd` -- 2.1.4