[devscripts] 02/04: debdiff: Use wdiff's return code to detect differences

James McCoy jamessan at debian.org
Mon May 25 04:36:19 UTC 2015


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

jamessan pushed a commit to branch master
in repository devscripts.

commit dbe726208e8ed60d9b974925acda0dff3fe10eae
Author: James McCoy <jamessan at debian.org>
Date:   Sat May 23 23:21:41 2015 -0400

    debdiff: Use wdiff's return code to detect differences
    
    Pattern matching against Dpkg::IPC::spawn's exception was inherently
    buggy since the message could change (and did once libdpkg-perl started
    translating the error messages).
    
    Changing the check to verify wdiff's return code is 1 (i.e., there are
    differences) is the correct behavior.
    
    Closes: #786518
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog   |  2 ++
 scripts/debdiff.pl | 18 +++++++++---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c4b7bd0..fdb249a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,8 @@ devscripts (2.15.5) UNRELEASED; urgency=medium
     at least a decade.
   * Move bash-completion scripts from /etc/bash_completion.d (compat
     directory) to /usr/share/bash-completion/completions.
+  * debdiff: Inspect wdiff's return code rather than Dpkg::IPC::spawn's
+    exception to determine if wdiff found differences.  (Closes: #786518)
 
   [ Dominique Dumont ]
   * licensecheck:
diff --git a/scripts/debdiff.pl b/scripts/debdiff.pl
index 54c7573..2b98f51 100755
--- a/scripts/debdiff.pl
+++ b/scripts/debdiff.pl
@@ -1030,17 +1030,17 @@ sub wdiff_control_files($$$$$)
 	my $usepkgname = $debname eq $dummyname ? "" : " of package $debname";
 	my @opts = ('-n');
 	push @opts, $wdiff_opt if $wdiff_opt;
-	my $wdiff = '';
-	eval {
-	    spawn(exec => ['wdiff', @opts, "$dir1/$cf", "$dir2/$cf"],
-		to_string => \$wdiff,
-		wait_child => 1);
-	};
-	if ($@ and $@ !~ /gave error exit status 1/) {
-	    print "$@\n";
+	my ($wdiff, $wdiff_error) = ('', '');
+	spawn(exec => ['wdiff', @opts, "$dir1/$cf", "$dir2/$cf"],
+	    to_string => \$wdiff,
+	    error_to_string => \$wdiff_error,
+	    wait_child => 1,
+	    nocheck => 1);
+	if ($? && ($? >> 8) != 1) {
+	    print "$wdiff_error\n";
 	    warn "wdiff failed\n";
 	} else {
-	    if (!$@) {
+	    if (!$?) {
 		if (! $quiet) {
 		    print "\nNo differences were encountered between the $cf files$usepkgname\n";
 		}

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