[devscripts] 01/01: uscan: Consistently handle empty/undef $lastversion

James McCoy jamessan at debian.org
Mon Mar 21 17:01:05 UTC 2016


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

jamessan pushed a commit to branch master
in repository devscripts.

commit 0801b872c86b34b60c57de4ed02fc7c78490373a
Author: James McCoy <jamessan at debian.org>
Date:   Mon Mar 21 12:57:42 2016 -0400

    uscan: Consistently handle empty/undef $lastversion
    
    If a watch line has trailing spaces on it, then $lastversion will be ''
    instead of undef.  This was causing the subsequent !defined check not to
    trigger, so $lastversion would never get updated appropriately.
    
    Coercing undef to '' allows us to change the !defined to !length and
    handle both cases correctly.
    
    Closes: #818865
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog | 2 ++
 scripts/uscan.pl | 7 ++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 82536a5..f57d0dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ devscripts (2.16.3) UNRELEASED; urgency=medium
   * uscan:
     + Fix regression in processing FTP listings when file pattern is the tail
       of another filename.  (Closes: #818727)
+    + Handle trailing spaces on the watch line when determining whether the
+      line specifies the version to check.  (Closes: #818865)
 
  -- James McCoy <jamessan at debian.org>  Sun, 20 Mar 2016 12:26:04 -0400
 
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 5e2ee59..6f32c8a 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -2564,7 +2564,7 @@ sub process_watchline ($$$$$$)
 	}
 
 	# 4 parameter watch line
-	($base, $filepattern, $lastversion, $action) = split ' ', $line, 4;
+	($base, $filepattern, $lastversion, $action) = split /\s+/, $line, 4;
 
 	# 3 parameter watch line (override)
 	if ($base =~ s%/([^/]*\([^/]*\)[^/]*)$%/%) {
@@ -2572,8 +2572,9 @@ sub process_watchline ($$$$$$)
 	    # separate filepattern field; we remove the filepattern from the
 	    # end of $base and rescan the rest of the line
 	    $filepattern = $1;
-	    (undef, $lastversion, $action) = split ' ', $line, 3;
+	    (undef, $lastversion, $action) = split /\s+/, $line, 3;
 	}
+	$lastversion //= '';
 
 	# compression is persistent
 	if ($options{'mode'} eq 'LWP') {
@@ -2586,7 +2587,7 @@ sub process_watchline ($$$$$$)
 
 	# Set $lastversion to the numeric last version
 	# Update $options{'versionmode'} (its default "newer")
-	if (! defined $lastversion or $lastversion eq 'debian') {
+	if (!length($lastversion) or $lastversion eq 'debian') {
 	    if (! defined $pkg_version) {
 		uscan_warn "Unable to determine the current version\n  in $watchfile, skipping:\n  $line\n";
 		return 1;

-- 
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