Author: adam-guest
Date: 2008-03-02 21:35:27 +0000 (Sun, 02 Mar 2008)
New Revision: 1092

Modified:
   trunk/debian/changelog
   trunk/scripts/checkbashisms.1
   trunk/scripts/checkbashisms.pl
Log:
  + Add an option to force checking of scripts that would normally be
    skipped (Closes: #469023)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-03-02 21:24:16 UTC (rev 1091)
+++ trunk/debian/changelog      2008-03-02 21:35:27 UTC (rev 1092)
@@ -6,6 +6,8 @@
     Thanks to gregor herrmann for pointing the obvious solution out.
   * checkbashisms:
     + Use Getopt::Long for option parsing
+    + Add an option to force checking of scripts that would normally be
+      skipped (Closes: #469023)
 
  -- Adam D. Barratt <[EMAIL PROTECTED]>  Sat, 01 Mar 2008 11:42:02 +0000
 

Modified: trunk/scripts/checkbashisms.1
===================================================================
--- trunk/scripts/checkbashisms.1       2008-03-02 21:24:16 UTC (rev 1091)
+++ trunk/scripts/checkbashisms.1       2008-03-02 21:35:27 UTC (rev 1092)
@@ -19,6 +19,10 @@
 .BR \-\-newline ", " \-n
 Check for "echo -n" usage (non POSIX but required by Debian Policy 10.4.)
 .TP
+.BR \-\-force ", " \-f
+Force each script to be checked, even if it would normally not be (for 
+instance, it has a bash or non POSIX shell shebang or appears to be a 
+shell wrapper).
 .TP
 .BR \-\-version ", " \-v
 Show version and copyright information.

Modified: trunk/scripts/checkbashisms.pl
===================================================================
--- trunk/scripts/checkbashisms.pl      2008-03-02 21:24:16 UTC (rev 1091)
+++ trunk/scripts/checkbashisms.pl      2008-03-02 21:35:27 UTC (rev 1092)
@@ -29,7 +29,7 @@
 (my $progname = $0) =~ s|.*/||;
 
 my $usage = <<"EOF";
-Usage: $progname [-n] script ...
+Usage: $progname [-n] [-f] script ...
    or: $progname --help
    or: $progname --version
 This script performs basic checks for the presence of bashisms
@@ -46,7 +46,7 @@
 GNU General Public License, version 2, or (at your option) any later version.
 EOF
 
-my $opt_echo = 0;
+my ($opt_echo, $opt_force);
 my ($opt_help, $opt_version);
 
 ##
@@ -55,6 +55,7 @@
 GetOptions("help|h" => \$opt_help,
           "version|v" => \$opt_version,
           "newline|n" => \$opt_echo,
+          "force|f" => \$opt_force,
            )
     or die "Usage: $progname [options] filelist\nRun $progname --help for more 
details\n";
 
@@ -64,7 +65,7 @@
 my $status = 0;
 
 foreach my $filename (@ARGV) {
-    if (script_is_evil_and_wrong($filename)) {
+    if (!opt_force and script_is_evil_and_wrong($filename)) {
        warn "script $filename does not appear to be a /bin/sh script; 
skipping\n";
        next;
     }
@@ -79,6 +80,7 @@
     while (<C>) {
        if ($. == 1) { # This should be an interpreter line
            if (m,^\#!\s*(\S+),) {
+               next if $opt_force;
                my $interpreter = $1;
                if ($interpreter =~ m,/bash$,) {
                    warn "script $filename is already a bash script; 
skipping\n";



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to