Author: adsb
Date: 2008-11-09 20:35:32 +0000 (Sun, 09 Nov 2008)
New Revision: 1720

Modified:
   trunk/debian/changelog
   trunk/scripts/checkbashisms.pl
Log:
* checkbashisms:
  + Add an updated check for $"" based on Filippo's $'' patch.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-11-09 20:24:23 UTC (rev 1719)
+++ trunk/debian/changelog      2008-11-09 20:35:32 UTC (rev 1720)
@@ -12,8 +12,10 @@
     + Update author email address
 
   [ Adam D. Barratt ]
-  * checkbashisms: Add an updated check for $'' which is much less prone
-    to false positives. Thanks Filippo Giunchedi. (Closes: #504292)
+  * checkbashisms:
+    + Add an updated check for $'' which is much less prone to false
+      positives. Thanks Filippo Giunchedi. (Closes: #504292)
+    + Add an updated check for $"" based on Filippo's $'' patch.
   * Debbugs.pm:
     + Really fix the special-casing of the "archive" key in select() to
       get rid of an uninitialized value warning.

Modified: trunk/scripts/checkbashisms.pl
===================================================================
--- trunk/scripts/checkbashisms.pl      2008-11-09 20:24:23 UTC (rev 1719)
+++ trunk/scripts/checkbashisms.pl      2008-11-09 20:35:32 UTC (rev 1720)
@@ -334,6 +334,14 @@
            # heredoc test itself will weed out any false positives
            $cat_line =~ s/(^|[^<\\\"-](?:\\\\)*)\'(?:\\.|[^\\\'])+\'/$1''/g;
 
+           my $re='(?<![\$\\\])\$\"[^\"]+\"';
+           if ($line =~ m/(.*)($re)/){
+               my $count = () = $1 =~ /(^|[^\\])\"/g;
+               if( $count % 2 == 0 ) {
+                   output_explanation($filename, $orig_line, q<$"foo" should 
be eval_gettext "foo">);
+               }
+           }   
+
            while (my ($re,$expl) = each %string_bashisms) {
                if ($line =~ m/($re)/) {
                    $found = 1;
@@ -524,7 +532,6 @@
        qr'\$\{?SHLVL\}?\b'           => q<$SHLVL>,
        qr'<<<'                       => q<\<\<\< here string>,
        $LEADIN . qr'echo\s+(?:-[^e\s]+\s+)?\"[^\"]*(\\[\\abcEfnrtv0])+.*?[\"]' 
=> q<unsafe echo with backslash>,
-       #'(?<![\$\\\])\$\"[^\"]+\"'   => q<$"foo" should be eval_gettext "foo">,
     );
 
     %singlequote_bashisms = (



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

Reply via email to