[SCM] Git repository for devscripts branch, master, updated. v2.11.6-18-g1d83778

James McCoy jamessan at debian.org
Sat May 5 16:10:07 UTC 2012


The following commit has been merged in the master branch:
commit 49591ad535e7a92ae925c03d728b9b352b3a19b7
Author: Raphael Geissert <geissert at debian.org>
Date:   Thu Apr 19 23:19:48 2012 -0500

    checkbashisms: Allow stdin to be checked by accepting '-' as file name

diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index bc89d3b..8840d55 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -50,6 +50,11 @@ my ($opt_echo, $opt_force, $opt_extra, $opt_posix);
 my ($opt_help, $opt_version);
 my @filenames;
 
+# Detect if STDIN is a pipe
+if (scalar(@ARGV) == 0 && (-p STDIN or -f STDIN)) {
+    push(@ARGV, '-');
+}
+
 ##
 ## handle command-line options
 ##
@@ -69,16 +74,6 @@ if ($opt_version) { print $version; exit 0; }
 
 $opt_echo = 1 if $opt_posix;
 
-# Detect if STDIN is a pipe
-if (scalar(@ARGV) == 0 && (-p STDIN or -f STDIN)) {
-    my ($tmp_fh, $tmp_filename) = tempfile("chkbashisms_tmp.XXXX", TMPDIR => 1, UNLINK => 1);
-    while (my $line = <STDIN>) {
-        print $tmp_fh $line;
-    }
-    close($tmp_fh);
-    push(@ARGV, $tmp_filename);
-}
-
 my $status = 0;
 my $makefile = 0;
 my (%bashisms, %string_bashisms, %singlequote_bashisms);
@@ -90,8 +85,15 @@ foreach my $filename (@ARGV) {
     my $check_lines_count = -1;
 
     my $display_filename = $filename;
-    if ($filename =~ /chkbashisms_tmp\.....$/) {
-        $display_filename = "(stdin)";
+
+    if ($filename eq '-') {
+	my $tmp_fh;
+	($tmp_fh, $filename) = tempfile("chkbashisms_tmp.XXXX", TMPDIR => 1, UNLINK => 1);
+	while (my $line = <STDIN>) {
+	    print $tmp_fh $line;
+	}
+	close($tmp_fh);
+	$display_filename = "(stdin)";
     }
 
     if (!$opt_force) {

-- 
Git repository for devscripts



More information about the Devscripts-devel mailing list