The following commit has been merged in the master branch:
commit 66e25e4e82f183bc4c7631a73c4110829d135e0c
Author: Raphael Geissert <[email protected]>
Date:   Sun Oct 21 23:14:57 2012 -0500

    checkbashisms: check for incorrect args. to 'exit' (Closes: #687450)
    
    Signed-off-by: Benjamin Drung <[email protected]>

diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index 8f9b19c..11767ce 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -430,6 +430,13 @@ foreach my $filename (@ARGV) {
                    output_explanation($display_filename, $orig_line, 
$explanation);
                }
            }
+           # This check requires the value to be compared, which could
+           # be done in the regex itself but requires "use re 'eval'".
+           # So it's better done in its own
+           if ($line =~ m/$LEADIN(exit\s+(\d{3,}))/ && $2 > 255) {
+               $explanation = 'exit status code greater than 255';
+               output_explanation($display_filename, $orig_line, $explanation);
+           }
 
            # Only look for the beginning of a heredoc here, after we've
            # stripped out quoted material, to avoid false positives.
@@ -609,6 +616,8 @@ sub init_hashes {
        $LEADIN . qr'command\s+-[^p]\s' =>  q<'command' with option other than 
-p>,
        $LEADIN . qr'setvar\s' =>  q<setvar 'foo' 'bar' should be eval 
'foo="'"$bar"'"'>,
        $LEADIN . qr'trap\s+["\']?.*["\']?\s+.*(?:ERR|DEBUG|RETURN)' => q<trap 
with ERR|DEBUG|RETURN>,
+       $LEADIN . qr'exit\s+-\d' => q<exit with negative status code>,
+       $LEADIN . qr'exit\s+--' => q<'exit --' should be 'exit'>,
     );
 
     %string_bashisms = (

-- 
Git repository for devscripts

_______________________________________________
devscripts-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/devscripts-devel

Reply via email to