[devscripts] 02/02: checkbashisms: Check scripts which use env in the #!
James McCoy
jamessan at debian.org
Fri Jan 8 04:18:27 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 4b37be15e4a6ff58b6d848f38879323404f2a0b4
Author: James McCoy <jamessan at debian.org>
Date: Thu Jan 7 23:18:00 2016 -0500
checkbashisms: Check scripts which use env in the #!
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 1 +
scripts/checkbashisms.pl | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 1d62317..027513f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ devscripts (2.16.1) UNRELEASED; urgency=medium
[ James McCoy ]
* checkbashisms:
+ Recognize dash as a valid shell.
+ + Check scripts which use “#!/path/to/env $interpreter”
-- Antonio Terceiro <terceiro at debian.org> Tue, 05 Jan 2016 13:01:05 -0200
diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index 81ff82e..e894a75 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -139,10 +139,10 @@ foreach my $filename (@ARGV) {
next unless ($check_lines_count == -1 or $. <= $check_lines_count);
if ($. == 1) { # This should be an interpreter line
- if (m,^\#!\s*(\S+),) {
+ if (m,^\#!\s*(?:\S+/env\s+)?(\S+),) {
my $interpreter = $1;
- if ($interpreter =~ m,/make$,) {
+ if ($interpreter =~ m,(?:^|/)make$,) {
init_hashes if !$makefile++;
$makefile = 1;
} else {
@@ -151,10 +151,10 @@ foreach my $filename (@ARGV) {
}
next if $opt_force;
- if ($interpreter =~ m,/bash$,) {
+ if ($interpreter =~ m,(?:^|/)bash$,) {
$mode = 1;
}
- elsif ($interpreter !~ m,/(sh|dash|posh)$,) {
+ elsif ($interpreter !~ m,(?:^|/)(sh|dash|posh)$,) {
### ksh/zsh?
warn "script $display_filename does not appear to be a /bin/sh script; skipping\n";
$status |= 2;
--
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