[devscripts] 01/04: uupdate: exit code is tricky

Osamu Aoki osamu at moszumanska.debian.org
Sat Sep 12 16:03:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

osamu pushed a commit to branch master
in repository devscripts.

commit fe93206f48bbebd831e425246feba41d49976d34
Author: Osamu Aoki <osamu at debian.org>
Date:   Sun Sep 6 18:38:01 2015 +0900

    uupdate: exit code is tricky
    
    https://bugs.debian.org/798175
    uupdate: fails if upstream version is 0
    
    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..759d497 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.+~]*$'`
+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`

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list