lintian: r936 - in trunk: checks debian lib
Author: rra
Date: 2007-08-01 02:57:32 +0200 (Wed, 01 Aug 2007)
New Revision: 936
Modified:
trunk/checks/debdiff
trunk/checks/debian-readme
trunk/checks/scripts
trunk/checks/spelling
trunk/debian/changelog
trunk/lib/Tags.pm
Log:
* checks/debdiff:
+ [RA] Replace all uses of tag_error and tag_warn with just tag.
* checks/debian-readme:
+ [RA] Replace all uses of tag_error and tag_warn with just tag.
+ [RA] Replace all uses of tag_error and tag_warn with just tag.
* checks/spelling:
+ [RA] Replace all uses of tag_error and tag_warn with just tag.
* lib/Tags.pm:
+ [RA] Replace any newlines in the extra information to the tag
function with \n.
Modified: trunk/checks/debdiff
===================================================================
--- trunk/checks/debdiff 2007-08-01 00:57:26 UTC (rev 935)
+++ trunk/checks/debdiff 2007-08-01 00:57:32 UTC (rev 936)
@@ -35,43 +35,25 @@
if ((not -f "${pkg}_${version}.diff.gz") and
($version =~ /-/) and ($version !~ /-0\.[^-]+$/) ) {
- tag_warn("native-package-with-dash-version");
+ tag("native-package-with-dash-version");
}
open(STAT, "diffstat") or fail("cannot open diffstat file: $!");
while (<STAT>) {
- chop;
-
- my $file;
-
- m/^\s+(.*?)\s+\|/
+ my ($file) = (m/^\s+(.*?)\s+\|/)
or fail("syntax error in diffstat file: $_");
- $file = $1;
- tag_warn("patch-failure-file-in-diff", $file)
+
+ tag("patch-failure-file-in-diff", $file)
if ($file =~ m/\.(orig|rej)$/);
- tag_warn("editor-backup-file-in-diff", $file)
+ tag("editor-backup-file-in-diff", $file)
if ($file =~ m%((^|/)\.[^/]+\.swp|~)$% && /\|\s+\d+\s+\++$/);
- tag_warn("diff-contains-substvars", $file)
+ tag("diff-contains-substvars", $file)
if ($file =~ m%^debian/substvars$%);
}
close(STAT) or fail("error reading diffstat file: $!");
} # </run>
-# ---------------------------------
-
-sub tag_warn {
- my $tag = shift;
- if ($#_ >= 0) {
- # We can't have newlines in a tag message, so turn them into \n
- map { s,\n,\\n, } @_;
- my $args = join(' ', @_);
- tag "$tag", "$args";
- } else {
- tag "$tag", "";
- }
-}
-
1;
Modified: trunk/checks/debian-readme
===================================================================
--- trunk/checks/debian-readme 2007-08-01 00:57:26 UTC (rev 935)
+++ trunk/checks/debian-readme 2007-08-01 00:57:32 UTC (rev 936)
@@ -45,37 +45,13 @@
")\n\n" .
".*<.*>,.*\n";
if ($readme =~ m/$template/iom) {
- tag_warn("readme-debian-is-debmake-template");
+ tag("readme-debian-is-debmake-template");
} elsif ($readme =~ m/^So far nothing to say/m) {
- tag_warn("readme-debian-contains-debmake-template");
+ tag("readme-debian-contains-debmake-template");
} elsif ($readme =~ m/^\s*-- [^<]*<[^> ]+.\@unknown>/m) {
- tag_warn("readme-debian-contains-debmake-default-email-address");
+ tag("readme-debian-contains-debmake-default-email-address");
}
}
-sub tag_error {
- my $tag = shift;
- if ($#_ >= 0) {
- # We can't have newlines in a tag message, so turn them into \n
- map { s,\n,\\n, } @_;
- my $args = join(' ', @_);
- tag "$tag", "$args";
- } else {
- tag "$tag", "";
- }
-}
-
-sub tag_warn {
- my $tag = shift;
- if ($#_ >= 0) {
- # We can't have newlines in a tag message, so turn them into \n
- map { s,\n,\\n, } @_;
- my $args = join(' ', @_);
- tag "$tag", "$args";
- } else {
- tag "$tag", "";
- }
-}
-
1;
Modified: trunk/checks/scripts
===================================================================
--- trunk/checks/scripts 2007-08-01 00:57:26 UTC (rev 935)
+++ trunk/checks/scripts 2007-08-01 00:57:32 UTC (rev 936)
@@ -275,14 +275,14 @@
and !$is_absolute);
if ($interpreter eq "") {
- tag_error("script-without-interpreter", $filename);
+ tag("script-without-interpreter", $filename);
next;
}
# either they use an absolute path or they call it as '/usr/bin/env interp'
- tag_error("interpreter-not-absolute", $filename, "#!$interpreter")
+ tag("interpreter-not-absolute", $filename, "#!$interpreter")
unless $is_absolute;
- tag_warn("script-not-executable", $filename)
+ tag("script-not-executable", $filename)
unless ($executable{$filename} or
$filename =~ m,usr/(lib|share)/.*\.pm, or
$filename =~ m,usr/(lib|share)/ruby/.*\.rb, or
@@ -295,11 +295,11 @@
defined $calls_env) {
# save us from some copy and paste
if ($base =~ /^(ruby|python)(?:\d\.\d)?$/) {
- tag_error("wrong-path-for-$1", $filename, "#!$interpreter");
+ tag("wrong-path-for-$1", $filename, "#!$interpreter");
} else {
- tag_error("wrong-path-for-interpreter",
- "#!$interpreter != $valid_interpreters{$base}",
- "($filename)");
+ tag("wrong-path-for-interpreter",
+ "#!$interpreter != $valid_interpreters{$base}",
+ "($filename)");
}
}
@@ -308,61 +308,61 @@
if (exists $interpreter_dependencies{$base}) {
my @deps = split(/,/,$interpreter_dependencies{$base});
if ($base eq 'php') {
- tag_error("php-script-but-no-php-cli-dep", $filename)
+ tag("php-script-but-no-php-cli-dep", $filename)
unless Dep::implies($deps{all}, Dep::parse($interpreter_dependencies{$base}));
} elsif ($base =~ /^(php\d?|(m|g)awk)/) {
- tag_error("$base-script-but-no-$deps[0]-dep", $filename)
+ tag("$base-script-but-no-$deps[0]-dep", $filename)
unless Dep::implies($deps{all}, Dep::parse($interpreter_dependencies{$base}));
} else {
- tag_error("missing-dep-for-interpreter",
- "$base => $deps[0]", "($filename)")
+ tag("missing-dep-for-interpreter",
+ "$base => $deps[0]", "($filename)")
unless Dep::implies($deps{all}, Dep::parse($interpreter_dependencies{$base}));
}
} elsif ($base =~ /^python(\d.\d)?$/) {
my $ver = $1 ? $1 : "";
- tag_error("python-script-but-no-python-dep", $filename)
+ tag("python-script-but-no-python-dep", $filename)
unless Dep::implies($deps{all}, Dep::parse("python$ver | python${ver}-minimal"));
} elsif ($base =~ /^ruby(\d.\d)?$/) {
my $ver = $1 ? $1 : "";
- tag_error("ruby-script-but-no-ruby-dep", $filename)
+ tag("ruby-script-but-no-ruby-dep", $filename)
unless Dep::implies($deps{all}, Dep::parse("ruby$ver"));
} elsif ($base eq 'perl' && $suid{$filename}) {
- tag_error("suid-perl-script-but-no-perl-suid-dep", $filename)
+ tag("suid-perl-script-but-no-perl-suid-dep", $filename)
unless Dep::implies($deps{all}, Dep::parse('perl-suid'));
} elsif ($base =~ m/^tclsh(\d+\.\d+)?$/) {
my $ver = $1 ? $1 : "";
if ($ver) {
- tag_error("tclsh-script-but-no-tclsh-dep", "$filename $base")
+ tag("tclsh-script-but-no-tclsh-dep", "$filename $base")
unless Dep::implies($deps{all}, Dep::parse("tcl$ver"));
} else {
- tag_error("tclsh-script-but-no-tclsh-dep", "$filename $base")
+ tag("tclsh-script-but-no-tclsh-dep", "$filename $base")
unless Dep::implies($deps{all}, Dep::parse("tcl8.3 | tcl8.4 | tclsh"));
}
} elsif ($base =~ m/^wish(\d+\.\d+)?$/) {
my $ver = $1 ? $1 : "";
if ($ver) {
- tag_error("wish-script-but-no-wish-dep", "$filename $base")
+ tag("wish-script-but-no-wish-dep", "$filename $base")
unless Dep::implies($deps{all}, Dep::parse("tk$ver"));
} else {
- tag_error("wish-script-but-no-wish-dep", "$filename $base")
+ tag("wish-script-but-no-wish-dep", "$filename $base")
unless Dep::implies($deps{all}, Dep::parse("tk8.3 | tk8.4 | wish"));
}
}
}
} elsif ($interpreter =~ m,/usr/local/,) {
- tag_error("interpreter-in-usr-local", $filename, "#!$interpreter");
+ tag("interpreter-in-usr-local", $filename, "#!$interpreter");
} elsif ($executable{'.' . $interpreter}) { # each key is './path/to/exe'
# Package installs the interpreter itself, so it's probably ok.
# Don't emit any tag for this.
} elsif ($base eq 'suidperl') {
- tag_error("calls-suidperl-directly", $filename);
+ tag("calls-suidperl-directly", $filename);
} elsif ($interpreter eq '/bin/env') {
- tag_warn("script-uses-bin-env", $filename);
+ tag("script-uses-bin-env", $filename);
} else {
- tag_warn("unusual-interpreter", $filename, "#!$interpreter");
+ tag("unusual-interpreter", $filename, "#!$interpreter");
}
- tag_warn("csh-considered-harmful", $filename)
+ tag("csh-considered-harmful", $filename)
if (($base eq 'csh' or $base eq 'tcsh') and $executable{$filename});
# Don't syntax-check scripts in /usr/src that end in .dpatch. bash -n
@@ -372,7 +372,7 @@
if (-x "$interpreter" && ! script_is_evil_and_wrong("unpacked/$filename")) {
if ($filename !~ m,^./usr/src/.*\.dpatch$,) {
if (check_script_syntax($interpreter, "unpacked/$filename")) {
- tag_error("shell-script-fails-syntax-check", $filename);
+ tag("shell-script-fails-syntax-check", $filename);
}
}
}
@@ -382,7 +382,7 @@
close(SCRIPTS);
foreach (keys %executable) {
- tag_warn("executable-not-elf-or-script", $_)
+ tag("executable-not-elf-or-script", $_)
unless ( $ELF{$_}
or $scripts{$_}
or $_ =~ m,^usr(/X11R6)?/man/,
@@ -409,15 +409,15 @@
my $base = $1;
if ($interpreter eq "") {
- tag_error("script-without-interpreter", $filename);
+ tag("script-without-interpreter", $filename);
next;
}
- tag_error("interpreter-not-absolute", $filename, "#!$interpreter")
+ tag("interpreter-not-absolute", $filename, "#!$interpreter")
unless ($interpreter =~ m|^/|);
if (exists $valid_interpreters{$base}) {
- tag_error("wrong-path-for-$base", $filename, "#!$interpreter")
+ tag("wrong-path-for-$base", $filename, "#!$interpreter")
unless ($interpreter eq $valid_interpreters{$base});
tag $file eq 'config'?
"forbidden-config-interpreter":"unusual-control-interpreter",
@@ -427,24 +427,23 @@
or $base eq 'perl');
if (exists $interpreter_dependencies{$base}) {
- tag_error("interpreter-without-predep", $filename,
+ tag("interpreter-without-predep", $filename,
"#!$interpreter")
unless Dep::implies($deps{'pre-depends'}, Dep::parse($interpreter_dependencies{$base}));
} elsif ($base eq 'python') {
- tag_error("interpreter-without-predep", $filename,
- "#!$interpreter")
+ tag("interpreter-without-predep", $filename, "#!$interpreter")
unless Dep::implies($deps{'pre-depends'}, Dep::parse('python | python-base'));
}
} elsif ($interpreter =~ m|/usr/local/|) {
- tag_error("interpreter-in-usr-local", $filename, "#!$interpreter");
+ tag("interpreter-in-usr-local", $filename, "#!$interpreter");
} else {
- tag_warn("unusual-interpreter", $filename, "#!$interpreter");
+ tag("unusual-interpreter", $filename, "#!$interpreter");
next; # no use doing further checks if it's not a known interpreter
}
# perhaps we should warn about *csh even if they're somehow screwed,
# but that's not really important...
- tag_warn("csh-considered-harmful", $filename)
+ tag("csh-considered-harmful", $filename)
if ($base eq 'csh' or $base eq 'tcsh');
my $shellscript = $base =~ /^((b|d)?a|t?c|(pd)?k)?sh$/ ? 1 : 0;
@@ -455,7 +454,7 @@
$checkbashisms = $base eq "sh" ? 1 : 0;
if (-x $valid_interpreters{$base}) {
if (check_script_syntax($interpreter, $filename)) {
- tag_error("maintainer-shell-script-fails-syntax-check", $file);
+ tag("maintainer-shell-script-fails-syntax-check", $file);
}
}
}
@@ -678,30 +677,6 @@
# -----------------------------------
-sub tag_error {
- my $tag = shift;
- if ($#_ >= 0) {
- # We can't have newlines in a tag message, so turn them into \n
- map { s,\n,\\n, } @_;
- my $args = join(' ', @_);
- tag "$tag", "$args";
- } else {
- tag "$tag", "";
- }
-}
-
-sub tag_warn {
- my $tag = shift;
- if ($#_ >= 0) {
- # We can't have newlines in a tag message, so turn them into \n
- map { s,\n,\\n, } @_;
- my $args = join(' ', @_);
- tag "$tag", "$args";
- } else {
- tag "$tag", "";
- }
-}
-
# Returns non-zero if the given file is not actually a shell script,
# just looks like one.
sub script_is_evil_and_wrong {
Modified: trunk/checks/spelling
===================================================================
--- trunk/checks/spelling 2007-08-01 00:57:26 UTC (rev 935)
+++ trunk/checks/spelling 2007-08-01 00:57:32 UTC (rev 936)
@@ -356,28 +356,15 @@
# -----------------------------------
-sub tag_error {
- my $tag = shift;
- if ($#_ >= 0) {
- # We can't have newlines in a tag message, so turn them into \n
- my @args = @_;
- map { s,\n,\\n, } @args;
- my $args = join ' ', @args;
- tag "$tag", "$args";
- } else {
- tag "$tag", "";
- }
-}
-
sub spelling_check {
my $tag = shift;
my $file = shift;
-
+
foreach my $word (split(/\s+/, $file)) {
# before lowercasing the word, check if it's a non-uppercased
# language name
if (exists $corrections_language_names{$word}) {
- tag_error($tag, $word, $corrections_language_names{$word});
+ tag($tag, $word, $corrections_language_names{$word});
}
$word = lc $word;
# try deleting the non-alphabetic parts from the word.
@@ -385,13 +372,13 @@
# at the beginning or end of the word.
$word =~ s/(^\')|[^\w\xc0-\xd6\xd8-\xf6\xf8-\xff\']+|(\'$)//g;
if (exists $corrections{$word}) {
- tag_error($tag, $word, $corrections{$word});
+ tag($tag, $word, $corrections{$word});
}
}
# special case for correcting a multi-word string
# $corrections{'Debian/GNU Linux'} = 'Debian GNU/Linux';
if ($file =~ m,Debian/GNU Linux,) {
- tag_error($tag, "Debian/GNU Linux", "Debian GNU/Linux");
+ tag($tag, "Debian/GNU Linux", "Debian GNU/Linux");
}
}
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2007-08-01 00:57:26 UTC (rev 935)
+++ trunk/debian/changelog 2007-08-01 00:57:32 UTC (rev 936)
@@ -9,6 +9,10 @@
+ [RA] Lower the severity of source-contains-CVS-dir to info, since
it's not worth repackaging upstream to fix this normally. Thanks,
Thijs Kinkhorst. (Closes: #434744)
+ * checks/debdiff:
+ + [RA] Replace all uses of tag_error and tag_warn with just tag.
+ * checks/debian-readme:
+ + [RA] Replace all uses of tag_error and tag_warn with just tag.
* checks/files{.desc,}:
+ [RA] Check for .git directories in binary packages.
* checks/menu-format{.desc,}:
@@ -30,10 +34,13 @@
description of maintainer-script-needs-depends-on-update-inetd.
Most packages should depend on inet-superserver. Leave the check
the same for the time being, however.
+ + [RA] Replace all uses of tag_error and tag_warn with just tag.
* checks/shared-libs:
+ [RA] Exclude udebs from dependency checking in the shlibs files
since binary packages may legitimately declare udeb dependencies on
other packages. Thanks, Loïc Minier. (Closes: #431395)
+ * checks/spelling:
+ + [RA] Replace all uses of tag_error and tag_warn with just tag.
* checks/version-substvars:
+ [RA] Don't skip other checks for binNMUability when warning about
the deprecated ${Source-Version} substvar. Thanks, Lior Kaplan.
@@ -43,8 +50,12 @@
+ [RA] Add \w+-backports to the known distribution list. Thanks,
Vincent Danjean. (Closes: #432268)
- -- Russ Allbery <rra@debian.org> Tue, 31 Jul 2007 17:46:55 -0700
+ * lib/Tags.pm:
+ + [RA] Replace any newlines in the extra information to the tag
+ function with \n.
+ --
+
lintian (1.23.32) unstable; urgency=low
The "stability of output" release.
Modified: trunk/lib/Tags.pm
===================================================================
--- trunk/lib/Tags.pm 2007-08-01 00:57:26 UTC (rev 935)
+++ trunk/lib/Tags.pm 2007-08-01 00:57:32 UTC (rev 936)
@@ -318,6 +318,9 @@
return 0;
}
+ # Newlines in @information would cause problems, so replace them with \n.
+ @information = map { s,\n,\\n,; $_ } @information;
+
my $tag_info = get_tag_info( $tag );
unless ($tag_info) {
warn "Tried to issue unknown tag $tag\n";
Reply to: