Package: devscripts
Version: 2.15.3

Steps to produce:

1. create a script test.sh containing the following:
#!/bin/sh
printf "test %b\n" "test"
printf "%b test\n" "test"
2. run "checkbashisms test.sh"
possible bashism in test.sh line 2 (printf %q|%b):
printf "test %b\n" "test"
3. It didn't find the bashism on line 3.

Luckily checkbashisms script can be fixed quite easily. Here's the diff:
--- /usr/bin/checkbashisms 2015-06-15 21:11:48.000000000 +0300
+++ scripts/checkbashisms 2015-07-23 17:35:03.655075945 +0300
@@ -688,7 +688,7 @@
qr'\$\(\([\s\w$*/+-]*\w\-\-.*?\)\)' => q<'$((n--))' should be '$n; $((n=n-1))'>, qr'\$\(\([\s\w$*/+-]*\-\-\w.*?\)\)' => q<'$((--n))' should be '$((n=n-1))'>,
  qr'\$\(\([\s\w$*/+-]*\*\*.*?\)\)' => q<exponentiation is not POSIX>,
- $LEADIN . qr'printf\s["\'][^"\']+?%[qb].+?["\']' => q<printf %q|%b>,
+ $LEADIN . qr'printf\s["\'][^"\']*?%[qb].+?["\']' => q<printf %q|%b>,
     );

     %singlequote_bashisms = (

After the change it works as expected:
$ scripts/checkbashisms test.sh
possible bashism in test.sh line 2 (printf %q|%b):
printf "test %b\n" "test"
possible bashism in test.sh line 3 (printf %q|%b):
printf "%b test\n" "test

I've also reported this to Ubuntu, where I discovered this bug first.
See: https://bugs.launchpad.net/ubuntu/+source/devscripts/+bug/1477635


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to