[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

lintian: r453 - in trunk: checks debian testset testset/maintainer-scripts/debian



Author: djpig
Date: 2005-07-23 17:47:49 +0200 (Sat, 23 Jul 2005)
New Revision: 453

Modified:
   trunk/checks/scripts
   trunk/debian/changelog
   trunk/testset/maintainer-scripts/debian/postinst
   trunk/testset/maintainer-scripts/debian/prerm
   trunk/testset/tags.libbaz
   trunk/testset/tags.maintainer-scripts
Log:
+ detect more bashisms, suggested by Clint Adams and
  martin f krafft (Closes: #253498, #296233 and addresses #253012
  partly).
+ Adjust check for positional arguments after ". file" to detect
  more shell control and piping commands that are all allowed.
  Noted by Thomas Hood. (Closes: #319212)


Modified: trunk/checks/scripts
===================================================================
--- trunk/checks/scripts	2005-07-23 14:35:37 UTC (rev 452)
+++ trunk/checks/scripts	2005-07-23 15:47:49 UTC (rev 453)
@@ -448,14 +448,20 @@
 				               # should be '.', not 'source'
 		  '(?:^|\s+)source\s+(?:\.\/|\/|\$)[^\s]+',
 		  '(\[|test|-o|-a)\s*[^\s]+\s+==\s', # should be 'b = a'
-		  '\s\|\&',                    # pipelining is not POSIX
+		  '\s(\|\&)',                  # pipelining is not POSIX
 		  '\$\[\w+\]',                 # arith not allowed
 		  '\$\{\w+\:\d+(?::\d+)?\}',   # ${foo:3[:1]}
 		  '\$\{\w+(/.+?){1,2}\}',      # ${parm/?/pat[/str]}
-		  '[^\\\]\{([^\s]+?,)+[^\\\}\s]+\}',     # brace expansion
+		  '[^\\\]\{([^\s]+?,)+[^\\\}\s]+\}', # brace expansion
 		  '(?:^|\s+)\w+\[\d+\]=',      # bash arrays, H[0]
-		  '\$\{\#?\w+\[[0-9\*\@]+\]\}',   # bash arrays, ${name[0|*|@]}
-		  '(?:^|\s+)(read\s*(?:;|$))'  # read without variable
+		  '\$\{\#?\w+\[[0-9\*\@]+\]\}',# bash arrays, ${name[0|*|@]}
+		  '(?:^|\s+)(read\s*(?:;|$))', # read without variable
+		  '((?:test|\[)\s+.+\s-[ao])\s',# test/[ -a/-o binary operators
+		  '(?:^|\s+)(kill\s+-[^sl]\w*)',   # kill -[0-9] or -[A-Z]
+		  '(?:^|\s+)(trap\s+["\']?.*["\']?\s+.*[1-9])', # trap with signal numbers
+		  '(?:^|\s+)(local)\s',        # local scoping of variables
+		  '(\&>)',                     # cshism
+		  '(\[\[)',                    # alternative test command
 		);
 
 		for my $re (@bashism_regexs) {
@@ -468,7 +474,7 @@
 		# since this test is ugly, I have to do it by itself
 		# detect source (.) trying to pass args to the command it runs
 		if (not $found and m/^\s*(\.\s+[^\s]+\s+([^\s]+))/) {
-		    if ($2 eq '&&' || $2 eq '||') {
+		    if ($2 =~ /^(\&|\||\d?>|<)/) {
 			# everything is ok
 			;
 		    } else {

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-07-23 14:35:37 UTC (rev 452)
+++ trunk/debian/changelog	2005-07-23 15:47:49 UTC (rev 453)
@@ -32,6 +32,12 @@
   * checks/scripts:
     + [FL] increase search limit for exec hack by not counting comments
       and empty lines (Closes: #294661)
+    + [FL] detect more bashisms, suggested by Clint Adams and
+      martin f krafft (Closes: #253498, #296233 and addresses #253012
+      partly).
+    + [FL] Adjust check for positional arguments after ". file" to detect
+      more shell control and piping commands that are all allowed.
+      Noted by Thomas Hood. (Closes: #319212)
 
  -- Frank Lichtenheld <djpig@debian.org>  Mon, 11 Jul 2005 15:50:10 +0300
 

Modified: trunk/testset/maintainer-scripts/debian/postinst
===================================================================
--- trunk/testset/maintainer-scripts/debian/postinst	2005-07-23 14:35:37 UTC (rev 452)
+++ trunk/testset/maintainer-scripts/debian/postinst	2005-07-23 15:47:49 UTC (rev 453)
@@ -8,6 +8,9 @@
 
 # valid
 . /usr/share/lintian/shell || exit 0
+. /usr/share/lintian/shell >/dev/null
+. /usr/share/lintian/shell 2>/dev/null
+. /usr/share/lintian/shell </dev/null
 # invalid
 . /usr/share/lintian/shell foo
 

Modified: trunk/testset/maintainer-scripts/debian/prerm
===================================================================
--- trunk/testset/maintainer-scripts/debian/prerm	2005-07-23 14:35:37 UTC (rev 452)
+++ trunk/testset/maintainer-scripts/debian/prerm	2005-07-23 15:47:49 UTC (rev 453)
@@ -4,7 +4,7 @@
        update-alternatives --remove dummy /usr/bin/dummy-alternative
 fi
 
-if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/maintainer-scripts ]; the
+if ([ "$1" = "upgrade" ] || [ "$1" = "remove" ]) && [ -L /usr/doc/maintainer-scripts ]; the
 n
         rm -f /usr/doc/maintainer-scripts
 fi
@@ -21,7 +21,15 @@
 fi
 
 function foo( ) {
-   echo "foo"
+   local bar
+   echo "foo" &>/dev/null
 }
 
 source $FOO
+
+trap "echo hi" EXIT HUP 3
+
+if [[ "$2" = "purge" ]]; then
+    kill -HUP $$
+fi
+

Modified: trunk/testset/tags.libbaz
===================================================================
--- trunk/testset/tags.libbaz	2005-07-23 14:35:37 UTC (rev 452)
+++ trunk/testset/tags.libbaz	2005-07-23 15:47:49 UTC (rev 453)
@@ -12,5 +12,7 @@
 W: libbaz source: changelog-should-mention-nmu
 W: libbaz source: source-nmu-has-incorrect-version-number 1
 W: libbaz1: missing-depends-line
+W: libbaz1: possible-bashism-in-maintainer-script postinst:6 '[ -d /usr/doc -a ! -e /usr/doc/$PKG -a '
+W: libbaz1: possible-bashism-in-maintainer-script prerm:5 '[ \( "$1" = "upgrade" -o "$1" = "remove" \) -a '
 W: libbaz1: postinst-should-not-set-usr-doc-link
 W: libbaz1: zero-byte-file-in-doc-directory usr/share/doc/README.Debian

Modified: trunk/testset/tags.maintainer-scripts
===================================================================
--- trunk/testset/tags.maintainer-scripts	2005-07-23 14:35:37 UTC (rev 452)
+++ trunk/testset/tags.maintainer-scripts	2005-07-23 15:47:49 UTC (rev 453)
@@ -5,7 +5,7 @@
 E: maintainer-scripts: debian-changelog-file-contains-invalid-email-address jeroen@mordor
 E: maintainer-scripts: forbidden-config-interpreter #!/usr/bin/python
 E: maintainer-scripts: interpreter-without-predep control/config #!/usr/bin/python
-E: maintainer-scripts: maintainer-script-does-not-check-for-existence-of-wm-menu-config postinst:28
+E: maintainer-scripts: maintainer-script-does-not-check-for-existence-of-wm-menu-config postinst:31
 E: maintainer-scripts: maintainer-shell-script-fails-syntax-check prerm
 E: maintainer-scripts: no-copyright-file
 E: maintainer-scripts: wrong-debian-qa-group-name QA group <packages@qa.debian.org>
@@ -13,18 +13,24 @@
 W: maintainer-scripts source: changelog-should-mention-qa
 W: maintainer-scripts source: qa-upload-has-incorrect-version-number 7-0.1
 W: maintainer-scripts: config-does-not-load-confmodule
-W: maintainer-scripts: deprecated-chown-usage postinst:30 'chown root.root'
-W: maintainer-scripts: maintainer-script-calls-deprecated-wm-menu-config postinst:28
+W: maintainer-scripts: deprecated-chown-usage postinst:33 'chown root.root'
+W: maintainer-scripts: maintainer-script-calls-deprecated-wm-menu-config postinst:31
 W: maintainer-scripts: missing-debconf-dependency
 W: maintainer-scripts: no-debconf-templates
-W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:12 '. /usr/share/lintian/shell foo'
-W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:15 'read'
-W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:17 'H[0]='
-W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:18 '${H[0]}'
-W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:20 '${H[@]}'
+W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:15 '. /usr/share/lintian/shell foo'
+W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:18 'read'
+W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:20 'H[0]='
+W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:21 '${H[0]}'
+W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:23 '${H[@]}'
+W: maintainer-scripts: possible-bashism-in-maintainer-script postinst:4 '[ -d /usr/doc -a ! -e /usr/doc/maintainer-scripts -a '
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:19 '[ "$2" == '
 W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:23 'function foo( )'
-W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:27 'source $FOO'
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:24 '   local '
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:25 '&>'
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:28 'source $FOO'
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:30 'trap "echo hi" EXIT HUP 3'
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:32 '[['
+W: maintainer-scripts: possible-bashism-in-maintainer-script prerm:33 '    kill -HUP'
 W: maintainer-scripts: postinst-does-not-load-confmodule
 W: maintainer-scripts: postinst-should-not-set-usr-doc-link
 W: maintainer-scripts: postrm-does-not-purge-debconf



Reply to: