[devscripts] 01/05: checkbashisms: Allow printf to use %b

James McCoy jamessan at debian.org
Wed Feb 3 03:30:24 UTC 2016


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

jamessan pushed a commit to branch master
in repository devscripts.

commit 00d3afd7eefe53371d07d7404caf6b862a32931e
Author: James McCoy <jamessan at debian.org>
Date:   Tue Feb 2 21:24:59 2016 -0500

    checkbashisms: Allow printf to use %b
    
    POSIX permits the b conversion specifier character:
    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html
    
    EXTENDED DESCRIPTION
    7. An additional conversion specifier character, b, shall be supported
       as follows.
    
    Closes: #804735
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog            | 2 ++
 scripts/checkbashisms.pl    | 2 +-
 test/bashisms/printf.sh     | 2 --
 test/bashisms/printf.sh.out | 6 ++----
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 104b512..f83bfdc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -22,6 +22,8 @@ devscripts (2.16.1) UNRELEASED; urgency=medium
   * checkbashisms:
     + Recognize dash as a valid shell.
     + Check scripts which use “#!/path/to/env $interpreter”
+    + Allow %b as a printf conversion specifier.  Thanks to Mike Frysinger for
+      the patch.  (Closes: #804735)
   * debian/tests/control: Add gcc as a dependency for dpkg-architecture.
   * chdist:
     + Symlink, rather than copy, the archive keyrings into the chdist tree so
diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index e894a75..7460250 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["\'][^"\']*?%q.+?["\']' => q<printf %q>,
     );
 
     %singlequote_bashisms = (
diff --git a/test/bashisms/printf.sh b/test/bashisms/printf.sh
index f1025d4..1ba20b8 100644
--- a/test/bashisms/printf.sh
+++ b/test/bashisms/printf.sh
@@ -4,6 +4,4 @@ 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 bfb14bf..05472da 100644
--- a/test/bashisms/printf.sh.out
+++ b/test/bashisms/printf.sh.out
@@ -1,8 +1,6 @@
 possible bashism in bashisms/printf.sh line 3 ('printf -v var ...' should be var='$(printf ...)'):
 printf -v some_var "this is a BASHISM"
-possible bashism in bashisms/printf.sh line 5 (printf %q|%b):
+possible bashism in bashisms/printf.sh line 5 (printf %q):
 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):
+possible bashism in bashisms/printf.sh line 7 (printf %q):
 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