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

Bug#543873: marked as done ([checks/scripts] check example scripts too)



Your message dated Mon, 14 Sep 2009 07:32:10 +0000
with message-id <E1Mn62k-0008Mn-Qw@ries.debian.org>
and subject line Bug#543873: fixed in lintian 2.2.15
has caused the Debian Bug report #543873,
regarding [checks/scripts] check example scripts too
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
543873: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=543873
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: lintian
Version: 2.2.14
Severity: wishlist
Tags: patch

Hi,

Attached is a patch that enables most of the checks in 'scripts' for scripts 
shipped as examples (in /usr/share/doc/<package>/examples/).

It adds some new tags that mimic the 'main' tags, but are of pedantic severity.

In order to avoid clutter in the main flow, the patch adds a wrapper function, 
script_tag(), which checks if the filename looks like an example and uses the 
"example-" tag prefix if it does. This required a swap of the informational 
arguments when tagging as "wrong-path-for-interpreter".

I was not sure if 'pedantic' or 'info' is more suitable for Severity and 
decided to err on the less annoying side :) Feel free to adjust.


Thanks for considering,
        dam

-- System Information:
Debian Release: squeeze/sid
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (500, 'unstable'), (500, 'stable'), (450, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lintian depends on:
ii  binutils              2.19.51.20090805-1 The GNU assembler, linker and bina
ii  diffstat              1.47-1             produces graph of changes introduc
ii  dpkg-dev              1.15.3.1           Debian package development tools
ii  file                  5.03-1             Determines file type using "magic"
ii  gettext               0.17-7             GNU Internationalization utilities
ii  intltool-debian       0.35.0+20060710.1  Help i18n of RFC822 compliant conf
ii  libapt-pkg-perl       0.1.24             Perl interface to libapt-pkg
ii  libdigest-sha-perl    5.47-1             Perl extension for SHA-1/224/256/3
ii  libipc-run-perl       0.84-1             Perl module for running processes
ii  libparse-debianchange 1.1.1-2            parse Debian changelogs and output
ii  libtimedate-perl      1.1600-9           Time and date functions for Perl
ii  liburi-perl           1.37+dfsg-1        Manipulates and accesses URI strin
ii  man-db                2.5.6-1            on-line manual pager
ii  perl [libdigest-sha-p 5.10.0-25          Larry Wall's Practical Extraction 

lintian recommends no packages.

Versions of packages lintian suggests:
pn  binutils-multiarch            <none>     (no description available)
ii  libtext-template-perl         1.45-1     Text::Template perl module
ii  man-db                        2.5.6-1    on-line manual pager

-- no debconf information
diff --git a/checks/scripts b/checks/scripts
index eb1785b..b7f9250 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -276,6 +276,15 @@ our @bashism_regexs = (
     $LEADIN . qr'(sh|\$\{?SHELL\}?) [-+]O', # sh [-+]O
 );
 
+# a local function to help use separate tags for example scripts
+sub script_tag {
+    my( $tag, $filename, @rest ) = @_;
+
+    $tag = "example-$tag"
+        if $filename and $filename =~ m,usr/share/doc/[^/]+/examples/,;
+
+    tag( $tag, $filename, @rest );
+}
 
 sub run {
 
@@ -323,8 +332,12 @@ for my $filename (sort keys %{$info->scripts}) {
     $filename = './' . $filename;
     $scripts{$filename} = 1;
 
+    my $in_docs = $filename =~ m,usr/share/doc/,;
+    my $in_examples = $filename =~ m,usr/share/doc/[^/]+/examples/,;
+
     # no checks necessary at all for scripts in /usr/share/doc/
-    next if $filename =~ m,usr/share/doc/,;
+    # unless they are examples
+    next if $in_docs and !$in_examples;
 
     my ($base) = $interpreter =~ m,([^/]*)$,;
 
@@ -337,15 +350,15 @@ for my $filename (sort keys %{$info->scripts}) {
     # an absolute path and are not in a bin/ directory (/usr/bin, /bin etc)
     # They are probably not scripts after all.
     next if ($filename !~ m,(bin/|etc/init\.d/), and !$executable{$filename}
-             and !$is_absolute);
+             and !$is_absolute and !$in_examples);
 
     if ($interpreter eq "") {
-	tag("script-without-interpreter", $filename);
+	script_tag("script-without-interpreter", $filename);
 	next;
     }
 
     # Either they use an absolute path or they use '/usr/bin/env interp'.
-    tag("interpreter-not-absolute", $filename, "#!$interpreter")
+    script_tag("interpreter-not-absolute", $filename, "#!$interpreter")
 	unless $is_absolute;
     tag("script-not-executable", $filename)
 	unless ($executable{$filename}
@@ -356,13 +369,15 @@ for my $filename (sort keys %{$info->scripts}) {
 		or $filename =~ m,\.ex$,
 		or $filename eq './etc/init.d/skeleton'
 		or $filename =~ m,^\./etc/menu-methods,
-		or $filename =~ m,^\./etc/X11/Xsession\.d,);
+		or $filename =~ m,^\./etc/X11/Xsession\.d,)
+		or $in_docs;
 
     # Warn about csh scripts.
     tag("csh-considered-harmful", $filename)
         if (($base eq 'csh' or $base eq 'tcsh')
 	    and $executable{$filename}
-	    and $filename !~ m,^\./etc/csh/login\.d/,);
+	    and $filename !~ m,^\./etc/csh/login\.d/,)
+	    and !$in_docs;
 
     # Syntax-check most shell scripts, but don't syntax-check scripts that end
     # in .dpatch.  bash -n doesn't stop checking at exit 0 and goes on to blow
@@ -375,7 +390,7 @@ for my $filename (sort keys %{$info->scripts}) {
 	    and $base !~ m/^(z|t?c)sh$/) {
 
 	    if (check_script_syntax($interpreter, "unpacked/$filename")) {
-		tag("shell-script-fails-syntax-check", $filename);
+		script_tag("shell-script-fails-syntax-check", $filename);
 	    }
 	}
     }
@@ -398,20 +413,20 @@ for my $filename (sort keys %{$info->scripts}) {
     if ($data) {
 	my $expected = $data->[0] . '/' . $base;
 	unless ($interpreter eq $expected or defined $calls_env) {
-	    tag("wrong-path-for-interpreter",
-		"#!$interpreter != $expected", "($filename)");
+	    script_tag("wrong-path-for-interpreter", $filename,
+		"(#!$interpreter != $expected)");
 	}
     } elsif ($interpreter =~ m,/usr/local/,) {
-	tag("interpreter-in-usr-local", $filename, "#!$interpreter");
+	script_tag("interpreter-in-usr-local", $filename, "#!$interpreter");
     } elsif ($executable{'.' . $interpreter}) {
 	# Package installs the interpreter itself, so it's probably ok.  Don't
 	# emit any tag for this.
     } elsif ($base eq 'suidperl') {
 	tag("calls-suidperl-directly", $filename);
     } elsif ($interpreter eq '/bin/env') {
-	tag("script-uses-bin-env", $filename);
+	script_tag("script-uses-bin-env", $filename);
     } else {
-	tag("unusual-interpreter", $filename, "#!$interpreter");
+	script_tag("unusual-interpreter", $filename, "#!$interpreter");
     }
 
     # Do some additional checks on shell scripts in /etc.  This should
@@ -452,7 +467,7 @@ for my $filename (sort keys %{$info->scripts}) {
     # If we found the interpreter and the script is executable, check
     # dependencies.  This should be the last thing we do in the loop so that
     # we can use next for an early exit and reduce the nesting.
-    next unless ($data && $executable{$filename});
+    next unless ($data && $executable{$filename} and !$in_docs);
     if (!$versioned) {
 	my $depends = $data->[1];
 	if (not defined $depends) {
diff --git a/checks/scripts.desc b/checks/scripts.desc
index 21a4e5c..27932c4 100644
--- a/checks/scripts.desc
+++ b/checks/scripts.desc
@@ -12,6 +12,12 @@ Certainty: certain
 Info: This file starts with the #! sequence that identifies scripts, but
  it does not name an interpreter.
 
+Tag: example-script-without-interpreter
+Severity: pedantic
+Certainty: certain
+Info: This file starts with the #! sequence that identifies scripts, but
+ it does not name an interpreter.
+
 Tag: executable-not-elf-or-script
 Severity: normal
 Certainty: certain
@@ -33,6 +39,13 @@ Info: This script uses a relative path to locate its interpreter.
  This path will be taken relative to the caller's current directory, not
  the script's, so it is not likely to be what was intended.
 
+Tag: example-interpreter-not-absolute
+Severity: pedantic
+Certainty: certain
+Info: This script uses a relative path to locate its interpreter.
+ This path will be taken relative to the caller's current directory, not
+ the script's, so it is not likely to be what was intended.
+
 Tag: unusual-interpreter
 Severity: normal
 Certainty: possible
@@ -41,6 +54,14 @@ Info: This package contains a script for an interpreter that the Lintian
  interpreter.  If not, please file a wishlist bug on lintian so that the
  Lintian maintainers can add this interpreter to their list.
 
+Tag: example-unusual-interpreter
+Severity: pedantic
+Certainty: possible
+Info: This package contains an example script for an interpreter that the
+ Lintian maintainers have not heard of.  It could be a typo for a common
+ interpreter.  If not, please file a wishlist bug on lintian so that the
+ Lintian maintainers can add this interpreter to their list.
+
 Tag: script-uses-bin-env
 Severity: normal
 Certainty: certain
@@ -49,6 +70,13 @@ Info: This script uses /bin/env as its interpreter (used to find the
  systems; env is instead installed as /usr/bin/env.  Usually, the path to
  env in the script should be changed.
 
+Tag: example-script-uses-bin-env
+Severity: pedantic
+Certainty: certain
+Info: This example script uses /bin/env as its interpreter (used to find
+ the actual interpreter on the user's path).  There is no /bin/env on
+ Debian systems; env is instead installed as /usr/bin/env.
+
 Tag: forbidden-config-interpreter
 Severity: important
 Certainty: certain
@@ -90,6 +118,13 @@ Info: This package contains a script that looks for an interpreter in a
  directory in /usr/local.  Since Debian does not install anything in
  /usr/local, this is the wrong place to look.
 
+Tag: example-interpreter-in-usr-local
+Severity: pedantic
+Certainty: certain
+Info: This package contains an example script that looks for an
+ interpreter in a directory in /usr/local.  Since Debian does not install
+ anything in /usr/local, this is the wrong place to look.
+
 Tag: control-interpreter-in-usr-local
 Severity: serious
 Certainty: certain
@@ -153,6 +188,12 @@ Certainty: certain
 Info: The interpreter you used is installed at another location on Debian
  systems.
 
+Tag: example-wrong-path-for-interpreter
+Severity: pedantic
+Certainty: certain
+Info: The interpreter used is installed at another location on Debian
+ systems.
+
 Tag: gawk-script-but-no-gawk-dep
 Severity: important
 Certainty: certain
@@ -258,6 +299,14 @@ Info: Running this shell script with the shell's -n option set fails,
  .
  Run e.g. <tt>sh -n yourscript</tt> to see the errors yourself.
 
+Tag: example-shell-script-fails-syntax-check
+Severity: pedantic
+Certainty: certain
+Info: Running this shell script with the shell's -n option set fails,
+ which means that the script has syntax errors.
+ .
+ Run e.g. <tt>sh -n yourscript</tt> to see the errors yourself.
+
 Tag: maintainer-shell-script-fails-syntax-check
 Severity: serious
 Certainty: certain

--- End Message ---
--- Begin Message ---
Source: lintian
Source-Version: 2.2.15

We believe that the bug you reported is fixed in the latest version of
lintian, which is due to be installed in the Debian FTP archive:

lintian_2.2.15.dsc
  to pool/main/l/lintian/lintian_2.2.15.dsc
lintian_2.2.15.tar.gz
  to pool/main/l/lintian/lintian_2.2.15.tar.gz
lintian_2.2.15_all.deb
  to pool/main/l/lintian/lintian_2.2.15_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 543873@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Russ Allbery <rra@debian.org> (supplier of updated lintian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.8
Date: Mon, 14 Sep 2009 00:06:01 -0700
Source: lintian
Binary: lintian
Architecture: source all
Version: 2.2.15
Distribution: unstable
Urgency: low
Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
Changed-By: Russ Allbery <rra@debian.org>
Description: 
 lintian    - Debian package checker
Closes: 498138 534486 536434 537737 538716 539403 540594 541372 541744 542046 542072 542389 542584 543259 543262 543641 543779 543781 543873 544004 544221 544277 545219 545430 545716 545781 546404
Changes: 
 lintian (2.2.15) unstable; urgency=low
 .
   The "BTS cleanup" release.
 .
   * Summary of tag changes:
     + Added:
       - build-depends-on-non-build-package
       - desktop-entry-limited-to-environments
       - example-interpreter-in-usr-local (pedantic)
       - example-interpreter-not-absolute
       - example-script-without-interpreter
       - example-script-uses-bin-env
       - example-shell-script-fails-syntax-check (pedantic)
       - example-wrong-path-for-interpreter
       - example-unusual-interpreter (pedantic)
       - global-data-in-games-directory
       - init.d-script-does-not-provide-itself
       - init.d-script-possible-missing-stop
       - init.d-script-provides-virtual-facility
       - init.d-script-should-depend-on-virtual-facility
       - init.d-script-starts-in-stop-runlevel
       - ocaml-custom-executable
 .
   * checks/binaries{,.desc}:
     + [RA] Add a new check for OCaml bytecode executables.  Patch from
       Stéphane Glondu.  (Closes: #498138)
     + [RA] Allow ldconfig to be statically linked.
   * checks/changelog-file:
     + [RA] Don't warn about a symlinked changelog file if the version
       contains ubuntu.  Thanks, Benjamin Drung.  (Closes: #536434)
   * checks/common_data.pm:
     + [RA] Moved the essential package list to data/fields.
   * checks/copyright-file:
     + [RA] Use Lintian::Data to read the essential package list.
   * checks/debhelper:
     + [RA] Ignore whitespace when checking debian/compat, since Perl will
       when converting it to a number.  Thanks, Niels Thykier.
       (Closes: #545430)
   * checks/fields{,.desc}:
     + [RA] Exclude base-files from the needlesly-depends-on-awk tag
       and from the warning about depending on a virtual package without
       a real package for the awk virtual package.
     + [RA] Use Lintian::Data to read the essential package list.
     + [RA] Stop allowing unversioned build dependencies on coreutils.  The
       migration from fileutils is long since finished.
     + [RA] Check for build dependencies on packages that should not be
       used for builds.  (Closes: #540594)
     + [RA] Allow architecture-dependent metapackages, since it can be
       useful for metapackages to change dependencies based on the
       architecture.  Thanks, Vagrant Cascadian.  (Closes: #544004)
   * checks/files{,.desc}:
     + [RA] Suppress non-standard-dir-perm for /tmp, /var/tmp, /var/local,
       /var/lock, and /usr/src if they have their normal owner and
       permissions.  This suppresses some Lintian tags for base-files.
     + [RA] Allow base-files to ship /var/backups and /var/local.
     + [RA] Remove swfobject.js from the known packaged Javascript
       libraries.  The version in libjs-yui is old and the new version is
       not packaged.  Thanks, Giuseppe Iuculano.  (Closes: #542046)
     + [RA] Allow t1- and xfonts- as prefixes for font packages since the
       font regex is also looking for Type 1 fonts.  Thanks, Rogério
       Brito.  (Closes: #542389)
     + [RA] Stop looking for *.pcf files outside font packages.  The check
       wasn't triggering since PCF files are always compressed, and the
       situation for PCF font packages is more complex and not suitable for
       the same check.
     + [RA] Add mootools.js to embedded-javascript-library.  Patch from
       Marcelo Jorge Vieira (metal).  (Closes: #545716)
     + [RA] Check for putting data that should be in /usr/share under
       /usr/share/games.  Patch from Raphael Geissert.  (Closes: #534486)
   * checks/init.d{,.desc}:
     + [RA] Add new checks for starting in runlevels 0 and 6, providing a
       virtual facility, not providing a facility matching the script, not
       depending on a virtual facility, and inconsistent stop runlevels.
       Patch from Raphael Geissert.  (Closes: #544221)
   * checks/manpages{,.desc}:
     + [ADB] Add HTTPS to the list of recognised protocols for URLs in manpages
       which should not cause manpage-has-errors-from-man to be emitted.
       (Closes: #543641)
     + [RA] Document the MANWIDTH variable when running man by hand to
       check for man page errors.  (Closes: #542584)
     + [RA] Adjust the exclusion of pod2man's .IX macro for the new
       output format from groff.
   * checks/menu-format{,.desc}:
     + [RA] Add a pointer to desktop-file-validate in many of the tag
       descriptions for desktop tags.  (Closes: #539403)
     + [RA] Mention in the description of desktop-entry-invalid-category
       that whitespace isn't allowed and categories are case-sensitive.
     + [RA] Add a new check for desktop entries that are limited to
       multiple environments.  NotShowIn was probably intended instead.
       Thanks, Andrew Lee.  (Closes: #537737)
   * checks/rules:
     + [RA] Anchor the dh_quilt regex to not trigger on commented-out
       calls.  Patch from Cesare Tirabassi.  (Closes: #543259)
     + [RA] When checking for out-of-order debhelper calls, take into
       account the -p flag and only check within each package.  Thanks,
       Michael Koch.  (Closes: #545219)
   * checks/scripts{,.desc}:
     + [RA] Don't warn about missing dependencies on programs if the
       program invocation is followed by || true.  Thanks, Aurelien Jarno.
       (Closes: #541372)
     + [RA] Permit diversion of a man page as long as the package is
       installing a man page by the same name in the same numeric section,
       even if the specific section is different.  Thanks, Niko Tyni.
       (Closes: #543781)
     + [RA] Check example scripts for most of the same issues as scripts
       elsewhere in the package, but report problems with a different set
       of tags with info or pedantic severity.  Patch from Damyan Ivanov.
       (Closes: #543873)
     + [RA] Add seed.  Thanks, Josselin Mouette.  (Closes: #543779)
     + [RA] Add pike 7.8.  Thanks, Magnus Holmgren.  (Closes: #543262)
   * checks/shared-libs:
     + [RA] Allow ld.so to be executable.  (Closes: #538716)
 .
   * data/fields/essential:
     + [RA] New list of essential packages.
     + [RA] Add dash.  (Closes: #541744)
     + [RA] Add diffutils and remove diff.  (Closes: #544277)
   * data/fields/no-build-depends:
     + [RA] New list of packages that should not be used as build
       dependencies, currently containing only java-propose-classpath.
       Thanks, Josh Triplett.
   * data/files/fonts:
     + [RA] Refresh and include Type 1 fonts and packages as well.
 .
   * lib/Lintian/Collect/Binary.pm:
     + [RA] Stop looking for the special OCaml symbol.  OCaml custom
       binaries are now detected another way.  Patch from Stéphane Glondu.
   * lib/Lintian/Schedule.pm:
     + [RA] If declining to add a duplicate file to the Lintian check
       schedule, return success to avoid a spurious error message.  Patch
       from Raphael Geissert.  (Closes: #542072)
   * lib/Spelling.pm:
     + [RA] Add spelling correction for "aplication."  (Closes: #546404)
 .
   * private/refresh-fonts-data:
     + [RA] To match what checks/files looks for, also look for *.pfb files
       and packages starting with t1-.
 .
   * reporting/{html_reports,templates/clean.tmpl}:
     + [JP] Don't link to full report if the maintainer only has clean
       packages. (Closes: #545781)
Checksums-Sha1: 
 38fc94e3cad1c29999df654289185621b533447b 1167 lintian_2.2.15.dsc
 dd4ea7530a0e3dfc80000ca68b3c4b85e4e3ef9e 742286 lintian_2.2.15.tar.gz
 2f6552d9dc896e454c6927707aec276fbfd7faf9 475550 lintian_2.2.15_all.deb
Checksums-Sha256: 
 840333f514921fb768eb5523bd5f84960ce47da09ee3f750beccbd83c5c773c1 1167 lintian_2.2.15.dsc
 d869737a4cd48c050d9909e949c37a7439b7efe28628d64b94797808f9fbed5c 742286 lintian_2.2.15.tar.gz
 f580a17c80f92e9700c8ebd44ad6e8ac5407010d7f4e992b3ed31a9bc3bc7504 475550 lintian_2.2.15_all.deb
Files: 
 6bdfbba75275491e3bebb17d0755ef60 1167 devel optional lintian_2.2.15.dsc
 c7c611de80b362a588121b6182a262cc 742286 devel optional lintian_2.2.15.tar.gz
 29d69bfdd60a03b49643944311d68b1f 475550 devel optional lintian_2.2.15_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqt7coACgkQ+YXjQAr8dHbFVgCfSWlIT93hKYQbDIdZEdyjOVBm
KY8AoMgUg72m7WG6p1xJFu0LDl0J92SM
=cAzU
-----END PGP SIGNATURE-----



--- End Message ---

Reply to: