Author: adsb
Date: 2008-11-09 20:24:23 +0000 (Sun, 09 Nov 2008)
New Revision: 1719

Modified:
   trunk/debian/changelog
   trunk/scripts/checkbashisms.pl
Log:
checkbashisms: Add an updated check for $'' which is much less prone
to false positives. Thanks Filippo Giunchedi. (Closes: #504292)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-11-09 17:54:17 UTC (rev 1718)
+++ trunk/debian/changelog      2008-11-09 20:24:23 UTC (rev 1719)
@@ -12,6 +12,8 @@
     + 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)
   * 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 17:54:17 UTC (rev 1718)
+++ trunk/scripts/checkbashisms.pl      2008-11-09 20:24:23 UTC (rev 1719)
@@ -308,6 +308,14 @@
                }
            }
 
+           my $re='(?<![\$\\\])\$\'[^\']+\'';
+           if ($line =~ m/(.*)($re)/){
+               my $count = () = $1 =~ /(^|[^\\])\'/g;
+               if( $count % 2 == 0 ) {
+                   output_explanation($filename, $orig_line, q<$'...' should 
be "$(printf '...')">);
+               }
+           }   
+
            # $cat_line contains the version of the line we'll check
            # for heredoc delimiters later. Initially, remove any
            # spaces between << and the delimiter to make the following
@@ -521,7 +529,6 @@
 
     %singlequote_bashisms = (
        $LEADIN . qr'echo\s+(?:-[^e\s]+\s+)?\'[^\']*(\\[\\abcEfnrtv0])+.*?[\']' 
=> q<unsafe echo with backslash>,
-       #'(?<![\$\\\])\$\'[^\']+\''              => q<$'...' should be 
"$(printf '...')">,
        $LEADIN . qr'source\s+[\"\']?(?:\.\/|\/|\$)[^\s]+' =>
                                       q<should be '.', not 'source'>,
     );



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

Reply via email to