Package: devscripts
Version: 2.10.37
Severity: normal
Tags: patch

Hi, checkbashisms doesn't notice a brace expansion if either of the
components of the brace is empty. For example,

% cat test.sh
#!/bin/sh
cp foo{,baz}
% touch foo
% dash test.sh 
cp: missing destination file operand after `foo{,baz}'
Try `cp --help' for more information.
% bash test.sh
% checkbashisms test.sh 
% 

The attached patch against devscripts SVN appears to fix this problem for
me.

Regards,

-- 
Jonny Lamb, UK                                   [EMAIL PROTECTED]
http://jonnylamb.com                                     GPG: 0x2E039402
Index: checkbashisms.pl
===================================================================
--- checkbashisms.pl    (revision 1649)
+++ checkbashisms.pl    (working copy)
@@ -451,7 +451,7 @@
                                       q<should be 'b = a'>,
        qr'\[\s+[^\]]+\s+==\s' =>        q<should be 'b = a'>,
        qr'\s\|\&' =>                    q<pipelining is not POSIX>,
-       qr'[^\\\$]\{([^\s\\\}]+?,)+[^\\\}\s]+\}' =>
+       qr'[^\\\$]\{([^\s\\\}]*?,)+[^\\\}\s]*\}' =>
                                       q<brace expansion>,
        qr'(?:^|\s+)\w+\[\d+\]=' =>      q<bash arrays, H[0]>,
        $LEADIN . qr'read\s+(?:-[a-qs-zA-Z\d-]+)' => q<read with option other 
than -r>,

Attachment: signature.asc
Description: Digital signature

Reply via email to