[devscripts] 05/06: checkbashisms: Detect %q/%b when it starts the string

James McCoy jamessan at debian.org
Mon Jul 27 06:28:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit c339d207f4b8a51aa28e4e9e69e03b7daec033c4
Author: James McCoy <jamessan at debian.org>
Date:   Mon Jul 27 01:04:06 2015 -0400

    checkbashisms: Detect %q/%b when it starts the string
    
    Closes: #793396
    Reported-by: Eero Vuojolahti <eero at vuojolahti.com>
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog            | 8 +++++---
 scripts/checkbashisms.pl    | 2 +-
 test/bashisms/printf.sh     | 2 ++
 test/bashisms/printf.sh.out | 2 ++
 4 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 3847bb2..694e3fe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,9 +9,11 @@ devscripts (2.15.6) UNRELEASED; urgency=medium
       (Closes: #788777)
     + Handle authenticated checkout when Vcs-Darcs is missing the root /darcs
       directory.
-  * checkbashisms: Fix unescaped, literal curly brace in regex, causing FTBFS
-    with Perl 5.22.  Thanks to Roderich Schupp for the patch.  (Closes:
-    #788707)
+  * checkbashisms:
+    + Fix unescaped, literal curly brace in regex, causing FTBFS with Perl
+      5.22.  Thanks to Roderich Schupp for the patch.  (Closes: #788707)
+    + Improve detection of %q/%b to include when it is at the start of the
+      string.  Thanks to Eero Vuojolahti.  (Closes: #793396)
   * wnpp-check:
     + Use getopt to handle argument parsing.
     + Add --exact switch to match the exact package name instead of a
diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index 567624a..045328c 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -689,7 +689,7 @@ sub init_hashes {
 	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 = (
diff --git a/test/bashisms/printf.sh b/test/bashisms/printf.sh
index 59e0fcf..f1025d4 100644
--- a/test/bashisms/printf.sh
+++ b/test/bashisms/printf.sh
@@ -5,3 +5,5 @@ printf -v some_var "this is a BASHISM"
 printf "the use of %q is bad\n" "BASHISMS" >/dev/null
 
 printf "this is another BASHISM: %b" "\n" >/dev/null
+
+printf "%q leading the string is bad\n" "BASHISMS" >/dev/null
diff --git a/test/bashisms/printf.sh.out b/test/bashisms/printf.sh.out
index 623c999..bfb14bf 100644
--- a/test/bashisms/printf.sh.out
+++ b/test/bashisms/printf.sh.out
@@ -4,3 +4,5 @@ possible bashism in bashisms/printf.sh line 5 (printf %q|%b):
 printf "the use of %q is bad\n" "BASHISMS" >/dev/null
 possible bashism in bashisms/printf.sh line 7 (printf %q|%b):
 printf "this is another BASHISM: %b" "\n" >/dev/null
+possible bashism in bashisms/printf.sh line 9 (printf %q|%b):
+printf "%q leading the string is bad\n" "BASHISMS" >/dev/null

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list