lintian: r983 - in trunk: checks collection debian depcheck frontend lib reporting unpack
Author: rra
Date: 2007-10-16 06:06:55 +0200 (Tue, 16 Oct 2007)
New Revision: 983
Modified:
trunk/checks/binaries
trunk/checks/changelog-file
trunk/checks/conffiles
trunk/checks/control-file
trunk/checks/control-files
trunk/checks/copyright-file
trunk/checks/cruft
trunk/checks/deb-format
trunk/checks/debconf
trunk/checks/debhelper
trunk/checks/debian-readme
trunk/checks/description
trunk/checks/etcfiles
trunk/checks/fields
trunk/checks/files
trunk/checks/huge-usr-share
trunk/checks/infofiles
trunk/checks/init.d
trunk/checks/manpages
trunk/checks/md5sums
trunk/checks/menu-format
trunk/checks/menus
trunk/checks/nmu
trunk/checks/po-debconf
trunk/checks/rules
trunk/checks/scripts
trunk/checks/shared-libs
trunk/checks/spelling
trunk/checks/standards-version
trunk/collection/changelog-file
trunk/collection/debian-readme
trunk/collection/diffstat
trunk/collection/file-info
trunk/collection/md5sums
trunk/collection/scripts
trunk/collection/source-control-file
trunk/debian/changelog
trunk/depcheck/deppages.pl
trunk/depcheck/report2html.pl
trunk/frontend/lintian
trunk/lib/Lab.pm
trunk/lib/Manual_refs.pm
trunk/lib/Read_pkglists.pm
trunk/lib/Util.pm
trunk/reporting/harness
trunk/reporting/html_reports
trunk/unpack/list-binpkg
trunk/unpack/list-srcpkg
trunk/unpack/list-udebpkg
trunk/unpack/unpack-binpkg-l1
trunk/unpack/unpack-srcpkg-l1
Log:
* {checks,collection,depcheck,frontend,lib,reporting,unpack}/*:
+ [RA] Use the three-argument form of open uniformly, whether needed
or not, to head off further quoting and whitespace interpretation
bugs.
Modified: trunk/checks/binaries
===================================================================
--- trunk/checks/binaries 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/binaries 2007-10-16 04:06:55 UTC (rev 983)
@@ -42,7 +42,7 @@
my %KLIBC;
# read architecture file
-if (open(IN,"fields/architecture")) {
+if (open(IN, '<', "fields/architecture")) {
chop($arch = <IN>);
close(IN);
} else {
@@ -54,7 +54,7 @@
my $file;
# read data from objdump-info file
-open(IN,"objdump-info")
+open(IN, '<', "objdump-info")
or fail("cannot find objdump-info for $type package $pkg");
while (<IN>) {
chop;
@@ -159,7 +159,8 @@
if @sonames && !$match_found;
# process all files in package
-open(IN,"file-info") or fail("cannot find file-info for $type package $pkg");
+open(IN,, '<', "file-info")
+ or fail("cannot find file-info for $type package $pkg");
while (<IN>) {
chop;
Modified: trunk/checks/changelog-file
===================================================================
--- trunk/checks/changelog-file 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/changelog-file 2007-10-16 04:06:55 UTC (rev 983)
@@ -40,7 +40,8 @@
my %is_a_symlink;
# Read file info...
-open(IN,"file-info") or fail("cannot find file-info for $type package $pkg");
+open(IN, '<', "file-info")
+ or fail("cannot find file-info for $type package $pkg");
while (<IN>) {
chop;
@@ -87,7 +88,7 @@
# together at random it seems here
# Read package contents...
-open(IN,"index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chop;
@@ -179,7 +180,8 @@
}
# is this a native Debian package?
-open(IN,"fields/version") or fail("cannot open fields/version file for reading: $!");
+open(IN, '<', "fields/version")
+ or fail("cannot open fields/version file for reading: $!");
chop(my $version = <IN>);
close(IN);
@@ -307,7 +309,8 @@
# one within 3000 chars of EOF and on the last page (^L), but that's a bit
# pesky to replicate. Demanding a match of $prefix and $suffix ought to
# be enough to avoid false positives.
-open IN, "changelog" or fail("cannot find changelog for $type package $pkg");
+open (IN, '<', "changelog")
+ or fail("cannot find changelog for $type package $pkg");
my ($prefix, $suffix);
while (<IN>) {
Modified: trunk/checks/conffiles
===================================================================
--- trunk/checks/conffiles 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/conffiles 2007-10-16 04:06:55 UTC (rev 983)
@@ -37,7 +37,7 @@
my %conffiles = ();
-open(IN,$cf) or fail("cannot open $cf for reading: $!");
+open(IN, '<', $cf) or fail("cannot open $cf for reading: $!");
while (<IN>) {
chop;
next if m/^\s*$/o;
Modified: trunk/checks/control-file
===================================================================
--- trunk/checks/control-file 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/control-file 2007-10-16 04:06:55 UTC (rev 983)
@@ -42,7 +42,8 @@
# Check that each field is only used once:
my $seen_fields = {};
-open (CONTROL, "debfiles/control") or fail "Couldn't read debfiles/control: $!";
+open (CONTROL, '<', "debfiles/control")
+ or fail "Couldn't read debfiles/control: $!";
while (<CONTROL>) {
s/\s*\n$//;
next if /^\#/;
Modified: trunk/checks/control-files
===================================================================
--- trunk/checks/control-files 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/control-files 2007-10-16 04:06:55 UTC (rev 983)
@@ -58,7 +58,7 @@
my %ctrl_alt = $type eq 'udeb' ? %ctrl_deb : %ctrl_udeb;
# process control-index file
-open(IN,"control-index") or fail("cannot open control-index file: $!");
+open(IN, '<', "control-index") or fail("cannot open control-index file: $!");
while (<IN>) {
chop;
Modified: trunk/checks/copyright-file
===================================================================
--- trunk/checks/copyright-file 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/copyright-file 2007-10-16 04:06:55 UTC (rev 983)
@@ -37,47 +37,47 @@
use common_data;
# Read package contents...
-open(IN,"index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chop;
if (m,usr/(share/)?doc/$ppkg/copyright(\.\S+)?(\s+\-\>\s+.*)?$,) {
my ($ext,$link) = ($2,$3);
-
+
$ext = '' if (! defined $ext);
#an extension other than .gz doesn't count as copyright file
next unless ($ext eq '') or ($ext eq '.gz');
$found = 1;
-
+
#search for an extension
if ($ext eq '.gz') {
tag "copyright-file-compressed", "";
last;
}
-
+
#make sure copyright is not a symlink
if ($link) {
tag "copyright-file-is-symlink", "";
last;
}
-
+
#otherwise, pass
if (($ext eq '') and not $link) {
# everything is ok.
last;
}
fail("unhandled case: $_");
-
+
} elsif (m,usr/share/doc/$ppkg \-\>\s+(\S+),) {
my ($link) = ($1);
-
+
$found = 1;
-
+
# check if this symlink references a directory elsewhere
if ($link =~ m,^(\.\.)?/,) {
tag "usr-share-doc-symlink-points-outside-of-usr-share-doc", "$link";
last;
}
-
+
# link might point to a subdirectory of another /usr/share/doc
# directory
$link =~ s,/.*,,;
@@ -85,12 +85,12 @@
# this case is allowed, if this package depends on link
# and both packages come from the same source package
- if (not open (VERSION, "fields/version")) {
+ if (not open (VERSION, '<', "fields/version")) {
fail("Can't open fields/version: $!");
} else {
- chomp(my $our_version = <VERSION>);
+ chomp(my $our_version = <VERSION>);
close VERSION;
-
+
# depend on $link pkg?
if ((not depends_on($link, $our_version)) &&
not (exists($known_essential{$link}) &&
@@ -101,7 +101,7 @@
last;
}
}
-
+
# We can only check if both packages come from the same source
# if our source package is currently unpacked in the lab, too!
if (-d "source") { # yes, it's unpacked
@@ -116,7 +116,7 @@
} else { # no, source is not available
tag "cannot-check-whether-usr-share-doc-symlink-points-to-foreign-package", "";
}
-
+
# everything is ok.
last;
} elsif (m,usr/doc/copyright/$ppkg$,) {
@@ -132,7 +132,7 @@
}
# check contents of copyright file
-open(IN,"copyright") or fail("cannot open copyright file copyright: $!");
+open(IN, '<', "copyright") or fail("cannot open copyright file copyright: $!");
# gulp whole file
local $/ = undef;
$_ = <IN>;
@@ -218,14 +218,14 @@
my $f = "fields/depends";
if (-f $f) {
- open(I,$f) or die "cannot open depends file $f: $!";
+ open(I, '<', $f) or die "cannot open depends file $f: $!";
chop($deps = <I>);
close(I);
}
$f = "fields/pre-depends";
if (-f $f) {
- open(I,$f) or die "cannot open pre-depends file $f: $!";
+ open(I, '<', $f) or die "cannot open pre-depends file $f: $!";
chop($predeps = <I>);
close(I);
}
Modified: trunk/checks/cruft
===================================================================
--- trunk/checks/cruft 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/cruft 2007-10-16 04:06:55 UTC (rev 983)
@@ -91,7 +91,8 @@
# This doens't really belong here, but there isn't a better place at the
# moment to put this check.
-open (VERSION, "fields/version") or fail("cannot open fields/version: $!");
+open (VERSION, '<', "fields/version")
+ or fail("cannot open fields/version: $!");
chomp(my $version = <VERSION>);
close VERSION;
$version =~ s/^\d+://; #Remove epoch
@@ -103,7 +104,7 @@
# Check if this is a documentation package that's not arch: all. This doesn't
# really belong here either.
my $arch;
-if (open IN, "fields/architecture") {
+if (open IN, '<', "fields/architecture") {
chop($arch = <IN>);
close IN;
if ($pkg =~ /-docs?$/ && $arch ne 'all') {
@@ -116,7 +117,7 @@
# depend on autoconf and automake and then use autoreconf to update
# config.guess and config.sub, and automake depends on autotools-dev.
$atdinbd = 0;
-if (open IN, "fields/build-depends") {
+if (open IN, '<', "fields/build-depends") {
my $bd;
chop($bd = <IN>);
close IN;
@@ -141,7 +142,7 @@
# includes many of these problems in its test suite.
sub check_diffstat {
my ($diffstat) = @_;
- open(STAT, $diffstat) or fail("cannot open $diffstat: $!");
+ open(STAT, '<', $diffstat) or fail("cannot open $diffstat: $!");
local $_;
while (<STAT>) {
my ($file) = (m,^\s+(.*?)\s+\|,)
@@ -215,7 +216,7 @@
tag "configure-generated-file-in-source", $name;
} elsif ($name =~ m,^(.+/)?config.(?:guess|sub)$, and not $atdinbd) {
my $b = basename $name;
- open F, $b or die "can't open $name: $!";
+ open (F, '<', $b) or die "can't open $name: $!";
while (<F>) {
last if $. > 10; # it's on the 6th line, but be a bit more lenient
if (/^(?:timestamp|version)='(\d+)(.+)'$/ and $1 < 2004) {
Modified: trunk/checks/deb-format
===================================================================
--- trunk/checks/deb-format 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/deb-format 2007-10-16 04:06:55 UTC (rev 983)
@@ -3,17 +3,17 @@
# Copyright (C) 2004 Denis Barbier
# Based on a check provided by Marc 'HE' Brockschmidt.
# Code cleared up a bit, and fix one thinko by Jeroen van Wolffelaar
-#
+#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program. If not, you can find it on the World Wide
# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
@@ -29,7 +29,7 @@
my $pkg = shift;
my $type = shift;
-if (open (LIST, "ar t deb |")) {
+if (open (LIST, '-|', qw/ar t deb/)) {
while (<LIST>) {
chomp;
tag "deb-data-member-wrongly-compressed", ""
Modified: trunk/checks/debconf
===================================================================
--- trunk/checks/debconf 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/debconf 2007-10-16 04:06:55 UTC (rev 983)
@@ -68,7 +68,7 @@
my $usespreinst='';
my $usesmultiselect='';
-if (open(PREINST, "control/preinst")) {
+if (open(PREINST, '<', "control/preinst")) {
while (<PREINST>) {
s/#.*//; # Not perfect for Perl, but should be OK
if (m,/usr/share/debconf/confmodule, or
@@ -97,7 +97,7 @@
# Consider every package to depend on itself.
my $version;
if (-f "fields/version") {
- open(IN, "fields/version") or fail("Can't open fields/version: $!");
+ open(IN, '<', "fields/version") or fail("Can't open fields/version: $!");
chomp($_ = <IN>);
$version = "$pkg (= $_)";
close IN;
@@ -107,7 +107,7 @@
for my $field (qw(depends pre-depends)) {
if (-f "fields/$field") {
- open(IN, "fields/$field") or fail("Can't open fields/$field: $!");
+ open(IN, '<', "fields/$field") or fail("Can't open fields/$field: $!");
chomp($_ = <IN>);
close IN;
$_ .= ", $version" if defined $version;
@@ -140,7 +140,8 @@
# First check that templates look valid
if ($seentemplates) {
- open(TMPL, "control/templates") or fail("Can't open control/templates: $!");
+ open(TMPL, '<', "control/templates")
+ or fail("Can't open control/templates: $!");
local $/ = "\n\n";
while (<TMPL>) {
chomp;
@@ -347,7 +348,7 @@
for my $file (qw(config postinst)) {
my $potential_makedev = {};
- if (open(IN, "control/$file")) {
+ if (open(IN, '<', "control/$file")) {
my $usesconfmodule='';
my $obsoleteconfmodule='';
my $db_input='';
@@ -419,7 +420,7 @@
}
}
-if (open(POSTRM, "control/postrm")) {
+if (open(POSTRM, '<', "control/postrm")) {
my $db_purge='';
while (<POSTRM>) {
@@ -460,7 +461,7 @@
return 0 if ($pkg eq "debconf") || ($type eq 'udeb');
-open(SCRIPTS, "scripts") or fail("cannot open lintian scripts file: $!");
+open(SCRIPTS, '<', "scripts") or fail("cannot open lintian scripts file: $!");
while (<SCRIPTS>) {
chomp;
@@ -468,7 +469,7 @@
my ($calls_env, $interpreter, $filename) = m/^(env )?(\S*) (.*)$/
or fail("bad line in scripts file: $_");
- open(IN, "< unpacked/$filename") or fail("cannot open $filename: $!");
+ open(IN, '<', "unpacked/$filename") or fail("cannot open $filename: $!");
while (<IN>) {
s/#.*//; # Not perfect for Perl, but should be OK
if (m,/usr/share/debconf/confmodule, or
Modified: trunk/checks/debhelper
===================================================================
--- trunk/checks/debhelper 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/debhelper 2007-10-16 04:06:55 UTC (rev 983)
@@ -78,7 +78,7 @@
dh_usrlocal
);
-open(RULES, "debfiles/rules") or fail("cannot read debian/rules: $!");
+open(RULES, '<', "debfiles/rules") or fail("cannot read debian/rules: $!");
my $dhcompatvalue;
while (<RULES>) {
if (m/^\s+(dh_\w+)/) {
@@ -148,9 +148,8 @@
or fail("Can't open debfiles directory.");
while (defined(my $file=readdir(DEBIAN))) {
if ($file =~ m/^(?:(.*)\.)?(?:post|pre)(?:inst|rm)$/) {
-
my $binpkg = $1 || '';
- open(IN,"debfiles/$file")
+ open(IN, '<', "debfiles/$file")
or fail("Can't open debfiles/$file: $!");
my $seentag = '';
while (<IN>) {
@@ -160,13 +159,13 @@
}
}
close IN;
-
+
if ((! $seentag) and $needtomodifyscripts) {
tag "maintainer-script-lacks-debhelper-token", "debian/$file"
unless $binpkg && $pkgs{$binpkg} && ($pkgs{$binpkg} =~ /udeb/i);
}
} elsif ($file =~ m/^compat$/) {
- open IN, "debfiles/$file"
+ open (IN, '<', "debfiles/$file")
or fail("Can't open debfiles/$file: $!");
$compat = <IN>;
close IN;
@@ -203,7 +202,7 @@
# something earlier than 2 know what they're doing. Skip CDBS packages since
# CDBS creates pycompat internally at build time.
if ($seendhpython && !$usescdbspython) {
- if (open(PYCOMPAT, "debfiles/pycompat")) {
+ if (open(PYCOMPAT, '<', "debfiles/pycompat")) {
local $/;
my $pycompat = <PYCOMPAT>;
close PYCOMPAT;
Modified: trunk/checks/debian-readme
===================================================================
--- trunk/checks/debian-readme 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/debian-readme 2007-10-16 04:06:55 UTC (rev 983)
@@ -32,7 +32,7 @@
# read the file in one go
local $/ = undef;
-if (open(IN,"README.Debian")) {
+if (open(IN, '<', "README.Debian")) {
$readme = <IN>;
close(IN);
}
Modified: trunk/checks/description
===================================================================
--- trunk/checks/description 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/description 2007-10-16 04:06:55 UTC (rev 983)
@@ -42,7 +42,7 @@
return 0;
}
-open(IN,$cf) or fail("cannot open $cf for reading: $!");
+open(IN, '<', $cf) or fail("cannot open $cf for reading: $!");
# 1st line contains synopsis
chop($synopsis = <IN>);
Modified: trunk/checks/etcfiles
===================================================================
--- trunk/checks/etcfiles 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/etcfiles 2007-10-16 04:06:55 UTC (rev 983)
@@ -33,7 +33,7 @@
my $conffiles = "control/conffiles";
# load conffiles
-if (open(IN,$conffiles)) {
+if (open(IN, '<', $conffiles)) {
while (<IN>) {
chop;
next if m/^\s*$/o;
@@ -44,7 +44,7 @@
}
# Read package contents...
-open(IN,"index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chop;
Modified: trunk/checks/fields
===================================================================
--- trunk/checks/fields 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/fields 2007-10-16 04:06:55 UTC (rev 983)
@@ -125,14 +125,13 @@
#---- Package
if ($type eq "binary"){
- if (not open (FH, "fields/package")) {
+ if (not open (FH, '<', "fields/package")) {
tag "no-package-name", "";
} else {
my $name = <FH>;
close FH;
unfold("package", \$name);
-
tag "bad-package-name", "" unless $name =~ /^[A-Z0-9][-+\.A-Z0-9]+$/i;
tag "package-not-lowercase", "" if ($name =~ /[A-Z]/)
}
@@ -140,7 +139,7 @@
#---- Version
-if (not open (FH, "fields/version")) {
+if (not open (FH, '<', "fields/version")) {
tag "no-version-field", "";
} else {
$version = <FH>;
@@ -177,7 +176,7 @@
#---- Architecture
-if (not open (FH, "fields/architecture")) {
+if (not open (FH, '<', "fields/architecture")) {
tag "no-architecture-field", "";
} else {
my $archs = <FH>;
@@ -212,7 +211,7 @@
#---- Subarchitecture (udeb)
-if (open(FH, "fields/subarchitecture")) {
+if (open(FH, '<', "fields/subarchitecture")) {
my $subarch = <FH>;
close(FH);
@@ -223,7 +222,7 @@
#---- Uploaders
for my $f (qw(maintainer uploaders)) {
- if (not open (FH, "fields/$f")) {
+ if (not open (FH, '<', "fields/$f")) {
tag "no-maintainer-field", "" if $f eq "maintainer";
} else {
my $maintainer = <FH>;
@@ -246,14 +245,14 @@
#---- Source
if ($type eq "source") {
- if (not open (FH, "fields/source")) {
+ if (not open (FH, '<', "fields/source")) {
tag "no-source-field", "";
} else {
my $source = <FH>;
close FH;
-
+
unfold("source", \$source);
-
+
if ($type eq 'source') {
if ($source ne $pkg) {
tag "source-field-does-not-match-pkg-name", "$_";
@@ -264,13 +263,13 @@
(?:\((?:\d+:)?(?:[-\.+:A-Z0-9]+?)(?:-[\.+A-Z0-9]+)?\))?\s*$/ix) { #Version
tag "source-field-malformed", "$source";
}
- }
+ }
}
}
#---- Essential
-if (open (FH, "fields/essential")) {
+if (open (FH, '<', "fields/essential")) {
my $essential = <FH>;
close FH;
@@ -284,7 +283,7 @@
#---- Section
-if (not open (FH, "fields/section")) {
+if (not open (FH, '<', "fields/section")) {
tag "no-section-field", "" if $type eq "binary";
} else {
my $section = <FH>;
@@ -299,7 +298,7 @@
} else {
my @parts = split /\//, $section, 2;
-
+
if ($parts[0] =~ /non-US/i) {
tag "non-us-spelling", "" if ($parts[0] ne "non-US");
if ($parts[1] and not $known_non_us_parts{$parts[1]}) {
@@ -318,7 +317,7 @@
#---- Priority
-if (not open (FH, "fields/priority")) {
+if (not open (FH, '<', "fields/priority")) {
tag "no-priority-field", "" if $type eq "binary";
} else {
my $priority = <FH>;
@@ -337,7 +336,7 @@
#---- Installer-Menu-Item (udeb)
-if (open(FH, "fields/installer-menu-item")) {
+if (open(FH, '<', "fields/installer-menu-item")) {
my $menu_item = <FH>;
close(FH);
@@ -355,7 +354,7 @@
my $metapackage = 0;
if ($type eq 'binary' && $arch_indep) {
$metapackage = 1;
- open IN, "index" or fail("cannot open index file index: $!");
+ open (IN, '<', "index") or fail("cannot open index file index: $!");
local $_;
local $/ = "\n";
while (<IN>) {
@@ -368,7 +367,7 @@
if (($type eq "binary") || ($type eq 'udeb')) {
my (%deps, %fields);
for my $field (qw(depends pre-depends recommends suggests conflicts provides replaces)) {
- if (open(FH, "fields/$field")) {
+ if (open(FH, '<', "fields/$field")) {
#Get data and clean it
my $data = <FH>;
unfold($field, \$data);
@@ -525,7 +524,7 @@
#Get number of arch-indep packages:
my $arch_indep_packages = 0;
my $arch_dep_packages = 0;
- if (not open(CONTROL, "debfiles/control")) {
+ if (not open(CONTROL, '<', "debfiles/control")) {
fail("Can't open debfiles/control: $!");
} else {
local $/ = "\n"; #Read this linewise
@@ -543,7 +542,8 @@
# values are the tags to use or the empty string to use the default
# tag.
my (%needed, %needed_clean, %allowed_clean, $bypass_needed_clean);
- open (RULES, "debfiles/rules") or fail("cannot read debfiles/rules: $!");
+ open (RULES, '<', "debfiles/rules")
+ or fail("cannot read debfiles/rules: $!");
my $target = "none";
local $/ = "\n"; # Read this linewise
my @rules = qw(clean binary-arch build-arch);
@@ -611,7 +611,7 @@
my %depend;
for my $field (qw(build-depends build-depends-indep build-conflicts build-conflicts-indep)) {
- if (open(FH, "fields/$field")) {
+ if (open(FH, '<', "fields/$field")) {
#Get data and clean it
my $data = <FH>;
unfold($field, \$data);
@@ -717,7 +717,8 @@
#
# This is confusing. There should be a better way to do this.
if (-e "fields/build-depends" && $arch_dep_packages == 0 && !$bypass_needed_clean) {
- open(FH, "fields/build-depends") or fail("cannot read fields/build-depends: $!");
+ open(FH, '<', "fields/build-depends")
+ or fail("cannot read fields/build-depends: $!");
my $build_depends = <FH>;
close FH;
my @packages = split /\s*,\s*/, $build_depends;
@@ -737,7 +738,7 @@
#----- Origin
-if (open(FH, "fields/origin")) {
+if (open(FH, '<', "fields/origin")) {
my $origin = <FH>;
close(FH);
@@ -748,7 +749,7 @@
#----- Bugs
-if (open(FH, "fields/bugs")) {
+if (open(FH, '<', "fields/bugs")) {
my $bugs = <FH>;
close FH;
@@ -759,7 +760,7 @@
#----- Python-Version
-if (open(FH, "fields/python-version")) {
+if (open(FH, '<', "fields/python-version")) {
my $pyversion = <FH>;
close FH;
Modified: trunk/checks/files
===================================================================
--- trunk/checks/files 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/files 2007-10-16 04:06:55 UTC (rev 983)
@@ -41,7 +41,7 @@
my %script = ();
# read data from objdump-info file
-open(IN,"objdump-info")
+open(IN, '<', "objdump-info")
or fail("cannot find objdump-info for $type package $pkg");
while (<IN>) {
chop;
@@ -59,12 +59,12 @@
close(IN);
#Get source package name, if possible
-if (open (SOURCE, "fields/source")) {
+if (open (SOURCE, '<', "fields/source")) {
chomp ($source_pkg = (<SOURCE> || ""));
}
# find out which files are scripts
-open(SCRIPTS, "scripts") or fail("cannot open lintian scripts file: $!");
+open(SCRIPTS, '<', "scripts") or fail("cannot open lintian scripts file: $!");
while (<SCRIPTS>) {
chop;
m/^(\S*) (.*)$/ or fail("bad line in scripts file: $_");
@@ -76,7 +76,7 @@
my $warned_x11_predepends = 0;
# Read package contents...
-open(IN,"index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chop;
@@ -158,7 +158,7 @@
# --------------- /etc/X11/Xresources/
elsif ($file =~ m,^etc/X11/Xresources,) {
my $needs_conflicts = 1;
- if (open(CONFLICTS, "fields/conflicts")) {
+ if (open(CONFLICTS, '<', "fields/conflicts")) {
my $line = <CONFLICTS>;
if ($line =~ m/xbase \(.+?\)/) {
$needs_conflicts = 0;
@@ -251,7 +251,7 @@
elsif ($file =~ m,^usr/(?:include|lib)/X11/,
&& !$warned_x11_predepends && $pkg ne 'x11-common') {
my $pre_depends = '';
- if (open (FH, "fields/pre-depends")) {
+ if (open (FH, '<', "fields/pre-depends")) {
$pre_depends = <FH>;
close FH;
$pre_depends =~ s/\n//g;
@@ -473,7 +473,7 @@
# check if it's one of the Python proper packages
unless (defined $is_python) {
$is_python = 0;
- if (open(SOURCE, "fields/source")) {
+ if (open(SOURCE, '<', "fields/source")) {
$_ = <SOURCE>;
$is_python = 1 if /^python(\d\.\d)?($|\s)/;
close(SOURCE);
@@ -487,7 +487,7 @@
# check if it's the "perl" package itself
unless (defined $is_perl) {
$is_perl = 0;
- if (open(SOURCE, "fields/source")) {
+ if (open(SOURCE, '<', "fields/source")) {
$_ = <SOURCE>;
$is_perl = 1 if /^perl($|\s)/;
close(SOURCE);
Modified: trunk/checks/huge-usr-share
===================================================================
--- trunk/checks/huge-usr-share 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/huge-usr-share 2007-10-16 04:06:55 UTC (rev 983)
@@ -36,7 +36,7 @@
my $arch;
# read architecture file
-if (open(IN,"fields/architecture")) {
+if (open(IN, '<', "fields/architecture")) {
chop($arch = <IN>);
close(IN);
}
Modified: trunk/checks/infofiles
===================================================================
--- trunk/checks/infofiles 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/infofiles 2007-10-16 04:06:55 UTC (rev 983)
@@ -46,7 +46,8 @@
check_script("postrm", \%postrm) if (-f "control/postrm");
# Read file info...
-open IN, "file-info" or fail("cannot find file-info for $type package $pkg");
+open (IN, '<', "file-info")
+ or fail("cannot find file-info for $type package $pkg");
while (<IN>) {
chop;
@@ -61,7 +62,7 @@
close IN;
# Read package contents...
-open IN, "index" or fail("cannot open index file index: $!");
+open (IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chop;
@@ -167,7 +168,7 @@
my ($no_check_menu,$no_check_installdocs);
my $interp;
- open(IN,"control/$script") or
+ open(IN, '<', "control/$script") or
fail("cannot open maintainer script control/$script for reading: $!");
$interp = <IN>;
if ($interp =~ m,^\#\!\s*/bin/(a|ba|k|pdk)?sh,) {
Modified: trunk/checks/init.d
===================================================================
--- trunk/checks/init.d 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/init.d 2007-10-16 04:06:55 UTC (rev 983)
@@ -55,7 +55,7 @@
my $exclude_r = qr/if\s+\[\s+-x\s+\S*update-rc\.d/;
# read postinst control file
-if (open(IN,$postinst)) {
+if (open(IN, '<', $postinst)) {
while (<IN>) {
next if /$exclude_r/o;
s/\#.*$//o;
@@ -75,7 +75,7 @@
close(IN);
# read preinst control file
-if (open(IN,$preinst)) {
+if (open(IN, '<', $preinst)) {
while (<IN>) {
next if /$exclude_r/o;
s/\#.*$//o;
@@ -88,7 +88,7 @@
}
# read postrm control file
-if (open(IN,$postrm)) {
+if (open(IN, '<', $postrm)) {
while (<IN>) {
next if /$exclude_r/o;
s/\#.*$//o;
@@ -105,7 +105,7 @@
}
# read prerm control file
-if (open(IN,$prerm)) {
+if (open(IN, '<', $prerm)) {
while (<IN>) {
next if /$exclude_r/o;
s/\#.*$//o;
@@ -128,7 +128,7 @@
}
# load conffiles
-if (open(IN,$conffiles)) {
+if (open(IN, '<', $conffiles)) {
while (<IN>) {
chop;
next if m/^\s*$/o;
@@ -152,7 +152,8 @@
my $initd_file = "init.d/$_";
if (-f $initd_file) {
# yes! check it...
- open(IN,$initd_file) or fail("cannot open init.d file $initd_file: $!");
+ open(IN, '<', $initd_file)
+ or fail("cannot open init.d file $initd_file: $!");
my (%tag, %lsb);
while (defined(my $l = <IN>)) {
if ($l =~ m/^\#\#\# BEGIN INIT INFO/) {
Modified: trunk/checks/manpages
===================================================================
--- trunk/checks/manpages 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/manpages 2007-10-16 04:06:55 UTC (rev 983)
@@ -38,7 +38,8 @@
my %manpage;
# Read file info...
-open(IN,"file-info") or fail("cannot find file-info for $type package $pkg");
+open(IN, '<', "file-info")
+ or fail("cannot find file-info for $type package $pkg");
while (<IN>) {
chop;
@@ -53,7 +54,7 @@
close(IN);
# Read package contents...
-open(IN,"index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chop;
@@ -178,7 +179,7 @@
}
}
} else { # not a symlink
- open MANFILE, "zcat unpacked/\Q$file\E 2>/dev/null |"
+ open (MANFILE, '-|', "zcat unpacked/\Q$file\E 2>/dev/null")
or fail("cannot open $file: $!");
my @manfile = ();
while (<MANFILE>) { push @manfile, $_; }
Modified: trunk/checks/md5sums
===================================================================
--- trunk/checks/md5sums 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/md5sums 2007-10-16 04:06:55 UTC (rev 983)
@@ -47,7 +47,8 @@
}
# read in md5sums control file
-open(C, $control) or fail("cannot open md5sums control file $control: $!");
+open(C, '<', $control)
+ or fail("cannot open md5sums control file $control: $!");
while (<C>) {
chop;
next if m/^\s*$/;
@@ -60,7 +61,7 @@
close(C);
# read in md5sums info file
-open(C, "md5sums") or fail("cannot open md5sums info file: $!");
+open(C, '<', "md5sums") or fail("cannot open md5sums info file: $!");
while (<C>) {
chop;
next if m/^\s*$/;
@@ -74,7 +75,7 @@
# read in conffiles
if (-f "control/conffiles") {
- open(C, "control/conffiles")
+ open(C, '<', "control/conffiles")
or fail("cannot open control file conffiles: $!");
while (<C>) {
chop;
Modified: trunk/checks/menu-format
===================================================================
--- trunk/checks/menu-format 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/menu-format 2007-10-16 04:06:55 UTC (rev 983)
@@ -389,7 +389,7 @@
# of every file in the package to use to verify that the command referenced by
# a menu item or desktop entry is there.
my @desktop_files;
-open(IN, "index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chomp;
my ($perm, $owner, $size, $date, $time, $file) = split(' ', $_, 6);
@@ -426,7 +426,7 @@
next if $basename eq "README"; # README is a special case
my $menufile_line ="";
- open (IN, $menufile) or
+ open (IN, '<', $menufile) or
fail("cannot open menu file $menufile for reading.");
# line below is commented out in favour of the while loop
# do { $_=<IN>; } while defined && (m/^\s* \#/ || m/^\s*$/);
@@ -695,7 +695,7 @@
$iconfile = "unpacked/usr/share/pixmaps/$icon";
}
- if (! open IN, $iconfile) {
+ if (! open (IN, '<', $iconfile)) {
tag "menu-icon-missing", "$icon";
return;
}
@@ -731,7 +731,8 @@
sub VerifyDesktopFile {
my ($desktopfile, $file) = @_;
my %vals;
- open (DESKTOP, "unpacked/$file") or fail("cannot open desktop file $file: $!");
+ open (DESKTOP, '<', "unpacked/$file")
+ or fail("cannot open desktop file $file: $!");
my ($line, $saw_first);
while (defined ($line = <DESKTOP>)) {
chomp $line;
Modified: trunk/checks/menus
===================================================================
--- trunk/checks/menus 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/menus 2007-10-16 04:06:55 UTC (rev 983)
@@ -71,7 +71,7 @@
}
# read package contents
-open(IN,"index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chomp;
my ($perm,$owner,$size,$date,$time,$file) = split(' ', $_, 6);
@@ -194,7 +194,7 @@
}
my $realfile = delink ($file);
- # openoffic.org-dev-doc has thousands of files listed so
+ # openoffice.org-dev-doc has thousands of files listed so
# try to use the hash if possible.
my $found;
if ($realfile =~ /[*?]/) {
@@ -370,7 +370,7 @@
my ($no_check_menu,$no_check_installdocs,$no_check_wmmenu,$calls_wmmenu);
my $interp;
- open(IN,"control/$script") or
+ open(IN, '<', "control/$script") or
fail("cannot open maintainer script control/$script for reading: $!");
$interp = <IN>;
if ($interp =~ m,^\#\!\s*/bin/(a|ba|k|pdk)?sh,) {
Modified: trunk/checks/nmu
===================================================================
--- trunk/checks/nmu 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/nmu 2007-10-16 04:06:55 UTC (rev 983)
@@ -40,7 +40,8 @@
return 0 unless -f "debfiles/changelog";
}
-open CHANGELOG, "debfiles/changelog" or fail("Failed opening changelog");
+open (CHANGELOG, '<', "debfiles/changelog")
+ or fail("Failed opening changelog");
<CHANGELOG>;
my $firstline = 1;
while (<CHANGELOG>) {
@@ -97,7 +98,7 @@
}
sub getfield {
- return undef if not open FIELD, "fields/".shift;
+ return undef if not open (FIELD, '<', "fields/" . shift);
my $field = <FIELD>;
close FIELD;
$field =~ s/\n$//;
Modified: trunk/checks/po-debconf
===================================================================
--- trunk/checks/po-debconf 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/po-debconf 2007-10-16 04:06:55 UTC (rev 983)
@@ -40,7 +40,7 @@
if ($file =~ m/templates\.\w\w(_\w\w)?$/) {
push (@lang_templates, $file);
} else {
- open(PO, "< debfiles/$file")
+ open(PO, '<', "debfiles/$file")
or fail("Can't open debfiles/$file file.");
while (<PO>) {
tag "translated-default-field", "$file: $."
@@ -73,7 +73,7 @@
# check).
my $missing_files = 0;
my $yada = 0;
-if (open (RULES, 'debfiles/rules')) {
+if (open (RULES, '<', 'debfiles/rules')) {
local $_;
while (<RULES>) {
if (m%^\t\s*(?:perl debian/)?yada\s%) {
@@ -84,7 +84,7 @@
}
if (!$yada && -f "debfiles/po/POTFILES.in") {
- open(POTFILES,"debfiles/po/POTFILES.in")
+ open(POTFILES, '<', "debfiles/po/POTFILES.in")
or fail("Can't open debfiles/po/POTFILES.in.");
while (<POTFILES>) {
chomp;
@@ -129,7 +129,7 @@
unless ($file =~ /^[a-z]{2,2}(_[A-Z]{2,2})?\.po$/);
local ($/) = "\n\n";
$_ = '';
- open(PO, "< debfiles/po/$file")
+ open(PO, '<', "debfiles/po/$file")
or fail("Can't open debfiles/po/$file file.");
while (<PO>) {
last if m/^msgstr/m;
Modified: trunk/checks/rules
===================================================================
--- trunk/checks/rules 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/rules 2007-10-16 04:06:55 UTC (rev 983)
@@ -36,7 +36,7 @@
return 0 unless -f "debfiles/rules";
}
-open(RULES, '< debfiles/rules') or fail("Failed opening rules: $!");
+open(RULES, '<', 'debfiles/rules') or fail("Failed opening rules: $!");
# Check for required #!/usr/bin/make -f opening line. Allow -r or -e; a
# strict reading of Policy doesn't allow either, but they seem harmless.
Modified: trunk/checks/scripts
===================================================================
--- trunk/checks/scripts 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/scripts 2007-10-16 04:06:55 UTC (rev 983)
@@ -207,7 +207,7 @@
my $pkg = shift;
my $type = shift;
-open(INDEX, "index") or fail("cannot open lintian index file: $!");
+open(INDEX, '<', "index") or fail("cannot open lintian index file: $!");
while (<INDEX>) {
next unless (m/^-[rw-]*[xs]/);
chop;
@@ -221,7 +221,8 @@
# Urgle... this is ambiguous, since the sequence ": " can occur in
# the output of file and also in the filename.
# Fortunately no filenames containing ": " currently occur in Debian packages.
-open(FILEINFO, "file-info") or fail("cannot open lintian file-info file: $!");
+open(FILEINFO, '<', "file-info")
+ or fail("cannot open lintian file-info file: $!");
while (<FILEINFO>) {
m/^(.*?): (.*)/ or fail("bad line in file-info: $_");
my $file = $1;
@@ -233,7 +234,7 @@
foreach my $depfield ('suggests', 'recommends', 'depends', 'pre-depends',
'provides') {
$deps{$depfield} = '';
- if (open(IN, "fields/$depfield")) {
+ if (open(IN, '<', "fields/$depfield")) {
$_ = join('', <IN>);
close(IN);
chomp;
@@ -247,7 +248,7 @@
$all_deps .= $pkg;
$deps{all} = Dep::parse($all_deps);
-open(SCRIPTS, "scripts") or fail("cannot open lintian scripts file: $!");
+open(SCRIPTS, '<', "scripts") or fail("cannot open lintian scripts file: $!");
while (<SCRIPTS>) {
chop;
@@ -390,7 +391,7 @@
);
}
-open(SCRIPTS, "control-scripts")
+open(SCRIPTS, '<', "control-scripts")
or fail("cannot open lintian control-scripts file: $!");
# Handle control scripts. This is an edited version of the code for
@@ -465,7 +466,7 @@
# print "E: something" unless exists $maintainer_scripts{$file}
# now scan the file contents themselves
- open C, "$filename"
+ open (C, '<', "$filename")
or fail("cannot open maintainer script $filename for reading: $!");
my %warned;
@@ -682,7 +683,7 @@
sub script_is_evil_and_wrong {
my ($filename) = @_;
my $ret = 0;
- open IN, $filename or fail("cannot open $filename: $!");
+ open (IN, '<', $filename) or fail("cannot open $filename: $!");
my $i = 0;
local $_;
while (<IN>) {
Modified: trunk/checks/shared-libs
===================================================================
--- trunk/checks/shared-libs 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/shared-libs 2007-10-16 04:06:55 UTC (rev 983)
@@ -85,7 +85,7 @@
my $type = shift;
# 1st step: get info about shared libraries installed by this package
-open(IN,"objdump-info")
+open(IN, '<', "objdump-info")
or fail("cannot find objdump-info for $type package $pkg");
while (<IN>) {
chop;
@@ -115,7 +115,8 @@
}
close(IN);
-open IN, "file-info" or fail("cannot find file-info for $type package $pkg");
+open (IN, '<', "file-info")
+ or fail("cannot find file-info for $type package $pkg");
while (<IN>) {
chomp;
# with file names containing colons and spaces, we're fucked.
@@ -129,7 +130,7 @@
# 2nd step: read package contents
my %files;
-open(IN,"index") or fail("cannot open index file index: $!");
+open(IN, '<', "index") or fail("cannot open index file index: $!");
while (<IN>) {
chop;
@words = split(/\s+/o, $_, 6);
@@ -204,7 +205,7 @@
# that's missing, we'll already be complaining elsewhere.
if (exists $objsomething{$cur_file}) {
if (not defined $STACK{$cur_file}) {
- if (open(FH, "fields/architecture")) {
+ if (open(FH, '<', "fields/architecture")) {
my $arch = <FH>;
close FH;
chomp $arch;
@@ -311,7 +312,7 @@
my %shlibs_control_used;
my %shlibs_control;
my @shlibs_depends;
- open(SHLIBS,$shlibs_control_file) or fail("cannot open shlibs control file $shlibs_control_file for reading: $!");
+ open(SHLIBS, '<', $shlibs_control_file) or fail("cannot open shlibs control file $shlibs_control_file for reading: $!");
while (<SHLIBS>) {
chop;
next if m/^\s*$/ or /^#/;
@@ -364,13 +365,13 @@
# Deduplicate the list of dependencies before warning so that we don't
# dupliate warnings.
my $provides = $pkg;
- if (open (VERSION, 'fields/version')) {
+ if (open (VERSION, '<', 'fields/version')) {
my $version = <VERSION>;
close VERSION;
chomp $version;
$provides .= " (= $version)";
}
- if (open (PROVIDES, 'fields/provides')) {
+ if (open (PROVIDES, '<', 'fields/provides')) {
my $line = <PROVIDES>;
close PROVIDES;
chomp $line;
Modified: trunk/checks/spelling
===================================================================
--- trunk/checks/spelling 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/spelling 2007-10-16 04:06:55 UTC (rev 983)
@@ -324,28 +324,28 @@
# Check defined(), because for some reason <CPY> returns the undefined
# value if the file is length 0.
-if (open(DESC, "fields/description")) {
+if (open(DESC, '<', "fields/description")) {
my $description = <DESC>;
close(DESC);
spelling_check("spelling-error-in-description", $description)
if defined($description);
}
-if (open(CPY, "copyright")) {
+if (open(CPY, '<', "copyright")) {
my $copyright = <CPY>;
close(CPY);
spelling_check("spelling-error-in-copyright", $copyright)
if defined($copyright);
}
-if (open(RMD, "README.Debian")) {
+if (open(RMD, '<', "README.Debian")) {
my $readme = <RMD>;
close(RMD);
spelling_check("spelling-error-in-readme-debian", $readme)
if defined($readme);
}
-#if (open(CHG, "changelog.Debian")) {
+#if (open(CHG, '<', "changelog.Debian")) {
# $changelog = <CHG>;
# close(CHG);
# spelling_check("spelling-error-in-debian-changelog", $changelog)
Modified: trunk/checks/standards-version
===================================================================
--- trunk/checks/standards-version 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/checks/standards-version 2007-10-16 04:06:55 UTC (rev 983)
@@ -89,7 +89,7 @@
return 0;
}
-open(IN,$std) or fail("cannot open $std for reading: $!");
+open(IN, '<', $std) or fail("cannot open $std for reading: $!");
chop($_ = <IN>);
close(IN);
Modified: trunk/collection/changelog-file
===================================================================
--- trunk/collection/changelog-file 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/collection/changelog-file 2007-10-16 04:06:55 UTC (rev 983)
@@ -82,8 +82,8 @@
or fail("error in gzip");
} elsif (-f $chl && -l $chl) {
local $_;
- open (CHL, "< $chl") or fail("cannot open $chl: $!");
- open (COPY, '> changelog') or fail("cannot create changelog: $!");
+ open (CHL, '<', $chl) or fail("cannot open $chl: $!");
+ open (COPY, '>', 'changelog') or fail("cannot create changelog: $!");
print COPY while <CHL>;
close CHL;
close COPY;
Modified: trunk/collection/debian-readme
===================================================================
--- trunk/collection/debian-readme 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/collection/debian-readme 2007-10-16 04:06:55 UTC (rev 983)
@@ -49,7 +49,7 @@
if (not defined $file) {
# no README found
- open(DUMMY, ">README.Debian");
+ open(DUMMY, '>', "README.Debian");
close(DUMMY);
} elsif ($file =~ m/\.gz$/) {
use lib "$ENV{'LINTIAN_ROOT'}/lib";
Modified: trunk/collection/diffstat
===================================================================
--- trunk/collection/diffstat 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/collection/diffstat 2007-10-16 04:06:55 UTC (rev 983)
@@ -34,7 +34,7 @@
-f "fields/version" or fail("diffstat invoked in wrong directory");
-open V, "fields/version" or fail("cannot open fields/version: $!");
+open (V, '<', "fields/version") or fail("cannot open fields/version: $!");
my $ver = <V>; chomp $ver;
close V;
@@ -43,7 +43,7 @@
my $diff_file = "${pkg}_${ver}.diff.gz";
unless (-f $diff_file) {
# we have to write an empty file so that the checks don't crap out. <sigh>
- open D, ">diffstat"; close D;
+ open (D, '>', "diffstat"); close D;
exit 0;
}
@@ -53,11 +53,11 @@
"debian-patch"
);
-open STAT, ">diffstat" or fail("cannot open scripts output file: $!");
+open (STAT, '>', "diffstat") or fail("cannot open scripts output file: $!");
# diffstat is noisy on stderr if its stdout is not a tty.
# Shut it up by redirecting stderr to /dev/null.
open STDERR, ">/dev/null";
-open DIFF, "diffstat -p1 debian-patch |"
+open (DIFF, '-|', qw/diffstat -p1 debian-patch/)
or fail("cannot open pipe to diffstat on debian-patch: $!");
# Copy all except last line to the STAT file
my $previous;
Modified: trunk/collection/file-info
===================================================================
--- trunk/collection/file-info 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/collection/file-info 2007-10-16 04:06:55 UTC (rev 983)
@@ -38,7 +38,7 @@
my $XARGS=FileHandle->new;
pipeline_open($XARGS, (sub { exec 'xargs', '-0r', 'file' }), "../file-info")
or fail("cannot fork: $!");
-open(INDEX, "../index")
+open(INDEX, '<', "../index")
or fail("cannot open index file: $!");
while (<INDEX>) {
chop;
Modified: trunk/collection/md5sums
===================================================================
--- trunk/collection/md5sums 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/collection/md5sums 2007-10-16 04:06:55 UTC (rev 983)
@@ -38,7 +38,7 @@
my $XARGS=FileHandle->new;
pipeline_open($XARGS, (sub { exec 'xargs', '-0r', 'md5sum' }), "../md5sums")
or fail("cannot fork: $!");
-open(INDEX, "../index")
+open(INDEX, '<', "../index")
or fail("cannot open index file: $!");
while (<INDEX>) {
next unless m/^-/;
Modified: trunk/collection/scripts
===================================================================
--- trunk/collection/scripts 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/collection/scripts 2007-10-16 04:06:55 UTC (rev 983)
@@ -21,8 +21,8 @@
use strict;
-open(SCRIPTS, ">scripts") or fail("cannot open scripts output file: $!");
-open(INDEX, "index") or fail("cannot open index file: $!");
+open(SCRIPTS, '>', "scripts") or fail("cannot open scripts output file: $!");
+open(INDEX, '<', "index") or fail("cannot open index file: $!");
my $file;
my $magic;
@@ -39,7 +39,7 @@
$file =~ s/ link to .*//; # cut off info about hard links
# This used to call fail() instead of next. However, the check to
# see if all files in the index can be opened should be done elsewhere.
- open(FILE, "unpacked/$file") or next;
+ open(FILE, '<', "unpacked/$file") or next;
if (read(FILE, $magic, 2) and $magic eq '#!' and not eof(FILE)) {
$scriptpath = <FILE>;
chomp($scriptpath);
@@ -66,7 +66,7 @@
close(INDEX);
close(SCRIPTS);
-open(SCRIPTS, ">control-scripts")
+open(SCRIPTS, '>', "control-scripts")
or fail("cannot open control-scripts output file: $!");
opendir(CONTROL, "control")
@@ -74,7 +74,7 @@
for $file (readdir CONTROL) {
next unless -f "control/$file";
- open(FILE, "control/$file") or fail("cannot open control/$file: $!");
+ open(FILE, '<', "control/$file") or fail("cannot open control/$file: $!");
if (read(FILE, $magic, 2) and $magic eq '#!') {
$scriptpath = <FILE>;
$scriptpath =~ s/^\s*(\S*).*/$1/s;
Modified: trunk/collection/source-control-file
===================================================================
--- trunk/collection/source-control-file 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/collection/source-control-file 2007-10-16 04:06:55 UTC (rev 983)
@@ -44,7 +44,7 @@
or fail( "can't create dir control/$pkg_name: $!" );
for my $field (keys %$_) {
my $field_file = "control/$pkg_name/$field";
- open F, ">", "$field_file"
+ open (F, '>', "$field_file")
or fail("cannot open file $field_file for writing: $!");
print F $_->{$field},"\n";
close F;
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/debian/changelog 2007-10-16 04:06:55 UTC (rev 983)
@@ -1,5 +1,10 @@
lintian (1.23.36) UNRELEASED; urgency=low
+ * {checks,collection,depcheck,frontend,lib,reporting,unpack}/*:
+ + [RA] Use the three-argument form of open uniformly, whether needed
+ or not, to head off further quoting and whitespace interpretation
+ bugs.
+
* checks/files{.desc,}:
+ [RA] Catch .DS_Store.gz files as well.
+ [RA] Warn about ._ Mac OS X resource files in the package.
@@ -17,7 +22,7 @@
two versioned relationships in the same direction. Thanks to
Raphael Hertzog for the analysis and fix. (Closes: #446768)
- -- Russ Allbery <rra@debian.org> Mon, 15 Oct 2007 20:11:15 -0700
+ -- Russ Allbery <rra@debian.org> Mon, 15 Oct 2007 20:59:47 -0700
lintian (1.23.35) unstable; urgency=low
Modified: trunk/depcheck/deppages.pl
===================================================================
--- trunk/depcheck/deppages.pl 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/depcheck/deppages.pl 2007-10-16 04:06:55 UTC (rev 983)
@@ -57,7 +57,7 @@
my %bug_used = ();
my %bugs = ();
-open(BUGS, "$LINTIAN_ROOT/depcheck/buglist") or die("buglist");
+open(BUGS, '<', "$LINTIAN_ROOT/depcheck/buglist") or die("buglist");
while (<BUGS>) {
chop;
my $bugline = $_;
@@ -69,7 +69,7 @@
}
close(BUGS);
-open(HTML, ">$HTML_TMP_DIR/depcheck.html") or die("depcheck.html");
+open(HTML, '>', "$HTML_TMP_DIR/depcheck.html") or die("depcheck.html");
print HTML <<EOT;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN">
@@ -135,7 +135,7 @@
print HTML "\n";
- open(REPORT, "$LOG_DIR/Depcheck-$arch") or die("Depcheck-$arch");
+ open(REPORT, '<', "$LOG_DIR/Depcheck-$arch") or die("Depcheck-$arch");
&genreport;
close(REPORT);
}
Modified: trunk/depcheck/report2html.pl
===================================================================
--- trunk/depcheck/report2html.pl 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/depcheck/report2html.pl 2007-10-16 04:06:55 UTC (rev 983)
@@ -20,7 +20,7 @@
my %bugs;
if (my $buglist = shift) {
- open(BUGS, $buglist) or die($buglist);
+ open(BUGS, '<', $buglist) or die($buglist);
while (<BUGS>) {
chop;
my $bugline = $_;
Modified: trunk/frontend/lintian
===================================================================
--- trunk/frontend/lintian 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/frontend/lintian 2007-10-16 04:06:55 UTC (rev 983)
@@ -350,7 +350,7 @@
# read configuration file
if ($LINTIAN_CFG) {
- open(CFG,$LINTIAN_CFG)
+ open(CFG, '<', $LINTIAN_CFG)
or fail("cannot open configuration file $LINTIAN_CFG for reading: $!");
while (<CFG>) {
chop;
@@ -572,7 +572,7 @@
# note: if any E:/W: lines are added above this point, this block needs to
# be moved up
if ($lintian_info) {
- open(OUTPUT_PIPE,"| $lintian_info_cmd") or fail("cannot open output pipe to $lintian_info_cmd: $!");
+ open(OUTPUT_PIPE, '|-', $lintian_info_cmd) or fail("cannot open output pipe to $lintian_info_cmd: $!");
select OUTPUT_PIPE;
}
# }}}
@@ -1096,7 +1096,7 @@
print STDERR "warning: no packages found in distribution directory\n";
}
} elsif ($packages_file) { # process all packages listed in packages file?
- open(IN,$packages_file)
+ open(IN, '<', $packages_file)
or fail("cannot open packages file $packages_file for reading: $!");
while (<IN>) {
chop;
@@ -1272,7 +1272,7 @@
unless ($no_override)
- { if ( open(O,"$base/override") )
+ { if ( open(O, '<', "$base/override") )
{
while (<O>) {
chomp;
@@ -1377,7 +1377,7 @@
}
my $timestamp = $stat[9];
- unless (open(STATUS,">$base/.lintian-status")) {
+ unless (open(STATUS, '>', "$base/.lintian-status")) {
print STDERR "internal error: could not create status file $base/.lintian-status for package $pkg: $!\n";
$exit_code = 2;
next PACKAGE;
@@ -1575,7 +1575,7 @@
sub read_file {
my $t;
- open(T,$_[0]) or return;
+ open(T, '<', $_[0]) or return;
chop($t = <T>);
close(T) or return;
Modified: trunk/lib/Lab.pm
===================================================================
--- trunk/lib/Lab.pm 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/lib/Lab.pm 2007-10-16 04:06:55 UTC (rev 983)
@@ -242,7 +242,7 @@
# create an empty file
# --okay, okay, this is not exactly what `touch' does :-)
sub _touch {
- open(T,">$_[0]") or return 0;
+ open(T, '>', $_[0]) or return 0;
close(T) or return 0;
return 1;
Modified: trunk/lib/Manual_refs.pm
===================================================================
--- trunk/lib/Manual_refs.pm 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/lib/Manual_refs.pm 2007-10-16 04:06:55 UTC (rev 983)
@@ -30,8 +30,8 @@
my $lib = defined $ENV{LINTIAN_ROOT} ? "$ENV{LINTIAN_ROOT}/" : "";
-open REFS, "$ {lib}lib/manual_refs" or
- die "Could not open manual_refs: $!";
+open (REFS, '<', "${lib}lib/manual_refs")
+ or die "Could not open manual_refs: $!";
while(<REFS>) {
chomp;
Modified: trunk/lib/Read_pkglists.pm
===================================================================
--- trunk/lib/Read_pkglists.pm 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/lib/Read_pkglists.pm 2007-10-16 04:06:55 UTC (rev 983)
@@ -49,7 +49,7 @@
$src_list or ($src_list = "$LINTIAN_LAB/info/source-packages");
return unless -s $src_list;
- open(IN,$src_list) or fail("cannot open source list file $src_list: $!");
+ open(IN, '<', $src_list) or fail("cannot open source list file $src_list: $!");
# compatible file format?
my $f;
@@ -98,7 +98,7 @@
$bin_list or ($bin_list = "$LINTIAN_LAB/info/binary-packages");
return unless -s $bin_list;
- open(IN,$bin_list) or fail("cannot open binary list file $bin_list: $!");
+ open(IN, '<', $bin_list) or fail("cannot open binary list file $bin_list: $!");
# compatible file format?
my $f;
@@ -144,7 +144,7 @@
$udeb_list or ($udeb_list = "$LINTIAN_LAB/info/udeb-packages");
return unless -s $udeb_list;
- open(IN,$udeb_list) or fail("cannot open udeb list file $udeb_list: $!");
+ open(IN, '<', $udeb_list) or fail("cannot open udeb list file $udeb_list: $!");
# compatible file format?
my $f;
Modified: trunk/lib/Util.pm
===================================================================
--- trunk/lib/Util.pm 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/lib/Util.pm 2007-10-16 04:06:55 UTC (rev 983)
@@ -121,7 +121,7 @@
}
my $CONTROL = FileHandle->new;
- open($CONTROL,$file)
+ open($CONTROL, '<', $file)
or fail("cannot open control file $file for reading: $!");
my @data = parse_dpkg_control($CONTROL, $debconf_flag);
close($CONTROL)
@@ -170,7 +170,7 @@
sub slurp_entire_file {
my $file = shift;
- open(C,$file)
+ open(C, '<', $file)
or fail("cannot open file $file for reading: $!");
my $save = $/;
undef $/;
@@ -182,7 +182,7 @@
sub get_file_md5 {
my $file = shift;
- open FILE, $file or fail("Couldn't open $file");
+ open (FILE, '<', $file) or fail("Couldn't open $file");
my $md5 = Digest::MD5->new;
$md5->addfile(*FILE);
close FILE or fail("Couldn't close $file");
@@ -192,8 +192,8 @@
sub file_is_encoded_in_non_utf8 {
my ($file, $type, $pkg) = @_;
my $non_utf8 = 0;
-
- open ICONV, "env LANG=C iconv -f utf8 -t utf8 $file 2>&1 |"
+
+ open (ICONV, '-|', "env LANG=C iconv -f utf8 -t utf8 $file 2>&1")
or fail("failure while checking encoding of $file for $type package $pkg");
my $line = 1;
while (<ICONV>) {
Modified: trunk/reporting/harness
===================================================================
--- trunk/reporting/harness 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/reporting/harness 2007-10-16 04:06:55 UTC (rev 983)
@@ -73,7 +73,7 @@
or Die("cannot rotate log files");
# create new log file
-open(LOG,">$log_file")
+open(LOG, '>', $log_file)
or Die("cannot open log file $log_file for writing: $!");
# export Lintian's configuration
@@ -149,9 +149,9 @@
# process changes file and create list of packages to process
Log("Reading changes file...");
- open(IN,$changes_file)
+ open(IN, '<', $changes_file)
or Die("cannot open changes file $changes_file for reading: $!");
- open(OUT,">$list_file")
+ open(OUT, '>', $list_file)
or Die("cannot open list file $list_file for writing: $!");
while (<IN>) {
chop;
@@ -203,9 +203,9 @@
# update lintian.log
Log("Updating lintian.log...");
rename $lintian_log, $old_lintian_log;
- open(IN,$old_lintian_log)
+ open(IN, '<', $old_lintian_log)
or Die("cannot open old lintian.log $old_lintian_log for reading: $!");
- open(OUT,">$lintian_log")
+ open(OUT, '>', $lintian_log)
or Die("cannot open lintian.log $lintian_log for writing: $!");
my $copy_mode = 1;
while (<IN>) {
Modified: trunk/reporting/html_reports
===================================================================
--- trunk/reporting/html_reports 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/reporting/html_reports 2007-10-16 04:06:55 UTC (rev 983)
@@ -195,7 +195,7 @@
# Now, generate stub pages for every maintainer who has only clean packages.
# Opening the index to /dev/null is such a hack. Code refactoring is
# desperately needed here.
-open(I, '>/dev/null');
+open(I, '>', '/dev/null');
for my $maintainer (keys %maintainers) {
set_maintainer($maintainer);
print P "<p>All of this maintainer's packages are lintian-clean.</p>\n";
@@ -302,7 +302,7 @@
$stat->{'info'} = $num_info;
$stat->{'overridden'} = $num_overridden;
$stat->{'lintian-version'} = $LINTIAN_VERSION;
-open(OUT,">$statistics_file")
+open(OUT,'>', $statistics_file)
or die "cannot open statistics file $statistics_file for writing: $!";
for my $k (keys %$stat) {
printf OUT "%s: %s\n",$k,$stat->{$k};
@@ -310,7 +310,7 @@
close(OUT);
# create index page
-open(OUT,">$HTML_TMP_DIR/report-index.html")
+open(OUT,'>', "$HTML_TMP_DIR/report-index.html")
or die "cannot open index page $HTML_TMP_DIR/report-index.html for writing: $!";
print OUT <<"EOT_EOT_EOT";
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
@@ -387,7 +387,7 @@
# -------------------------------
sub open_maintainer_index {
- open(I,">$HTML_TMP_DIR/maintainers.html") or die "$!";
+ open(I, '>', "$HTML_TMP_DIR/maintainers.html") or die "$!";
print I <<EOH;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
@@ -416,7 +416,7 @@
# -------------------------------
sub open_tag_index {
- open(T,">$HTML_TMP_DIR/tags.html") or die "$!";
+ open(T, '>', "$HTML_TMP_DIR/tags.html") or die "$!";
print T <<EOH;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
@@ -452,7 +452,7 @@
close_maintainer();
$maint_file = $_[0];
- open(P,">$HTML_TMP_DIR/$maint_file") or die "$!";
+ open(P, '>', "$HTML_TMP_DIR/$maint_file") or die "$!";
my $t = quotehtml($maint);
@@ -548,7 +548,7 @@
# -------------------------------
sub open_qa_list {
- open(Q,">$HTML_TMP_DIR/qa-list.txt") or die "$!";
+ open(Q, '>', "$HTML_TMP_DIR/qa-list.txt") or die "$!";
}
sub close_qa_list {
@@ -565,7 +565,7 @@
sub open_tag_file {
my $tag = shift;
- open(P,">$HTML_TMP_DIR/T$tag.html") or die "$!";
+ open(P, '>', "$HTML_TMP_DIR/T$tag.html") or die "$!";
print P <<EOH;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
@@ -619,7 +619,7 @@
sub output_packages {
my ($l,$f,$r) = @_;
- open(I,">$HTML_TMP_DIR/$f") or die "$!";
+ open(I, '>', "$HTML_TMP_DIR/$f") or die "$!";
print I <<EOH;
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Modified: trunk/unpack/list-binpkg
===================================================================
--- trunk/unpack/list-binpkg 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/unpack/list-binpkg 2007-10-16 04:06:55 UTC (rev 983)
@@ -82,7 +82,7 @@
}
# open output file
-open(OUT,">$output_file")
+open(OUT, '>', $output_file)
or fail("cannot open list file $output_file for writing: $!");
print OUT "$BINLIST_FORMAT\n";
@@ -91,10 +91,11 @@
"binary-$LINTIAN_ARCH/Packages";
if (-e $packages) {
print "N: Parsing $packages ...\n" if $verbose;
- open(IN,"$packages") or fail("cannot open Packages file $packages: $!");
+ open(IN, '<', $packages) or fail("cannot open Packages file $packages: $!");
} elsif (-e "$packages.gz") {
print "N: Parsing $packages.gz ...\n" if $verbose;
- open(IN,"gzip -dc $packages.gz | ") or fail("cannot open Packages file $packages.gz: $!");
+ open (IN, '-|', 'gzip', '-dc', "$packages.gz")
+ or fail("cannot open Packages file $packages.gz: $!");
} else {
fail("No packages file $packages");
}
Modified: trunk/unpack/list-srcpkg
===================================================================
--- trunk/unpack/list-srcpkg 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/unpack/list-srcpkg 2007-10-16 04:06:55 UTC (rev 983)
@@ -78,13 +78,13 @@
}
# open output file
-open(OUT,">$output_file") or fail("cannot open list file $output_file for writing: $!");
+open(OUT, '>', $output_file) or fail("cannot open list file $output_file for writing: $!");
print OUT "$SRCLIST_FORMAT\n";
# parse Sources.gz to get list of packages
my $sources = "$LINTIAN_ARCHIVEDIR/dists/$LINTIAN_DIST/$LINTIAN_SECTION/source/Sources.gz";
print "N: Parsing $sources ...\n" if $verbose;
-open(IN,"zcat $sources|") or fail("Cannot open input pipe from zcat $sources: $!");
+open(IN, '-|', 'zcat', $sources) or fail("Cannot open input pipe from zcat $sources: $!");
my $line;
my %packages;
Modified: trunk/unpack/list-udebpkg
===================================================================
--- trunk/unpack/list-udebpkg 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/unpack/list-udebpkg 2007-10-16 04:06:55 UTC (rev 983)
@@ -83,7 +83,7 @@
}
# open output file
-open(OUT,">$output_file")
+open(OUT, '>', $output_file)
or fail("cannot open list file $output_file for writing: $!");
print OUT "$UDEBLIST_FORMAT\n";
@@ -92,10 +92,10 @@
"debian-installer/binary-$LINTIAN_ARCH/Packages";
if (-e $packages) {
print "N: Parsing $packages ...\n" if $verbose;
- open(IN,"$packages") or fail("cannot open Packages file $packages: $!");
+ open(IN, '<', $packages) or fail("cannot open Packages file $packages: $!");
} elsif (-e "$packages.gz") {
print "N: Parsing $packages.gz ...\n" if $verbose;
- open(IN,"gzip -dc \Q$packages\E.gz | ")
+ open(IN, '-|', 'gzip', '-dc', "$packages.gz")
or fail("cannot open Packages file $packages.gz: $!");
} else {
fail("No packages file $packages");
Modified: trunk/unpack/unpack-binpkg-l1
===================================================================
--- trunk/unpack/unpack-binpkg-l1 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/unpack/unpack-binpkg-l1 2007-10-16 04:06:55 UTC (rev 983)
@@ -87,7 +87,7 @@
# create control field files
for my $field (keys %$data) {
my $field_file = "$base_dir/fields/$field";
- open(F,">$field_file") or fail("cannot open file $field_file for writing: $!");
+ open(F, '>', $field_file) or fail("cannot open file $field_file for writing: $!");
print F $data->{$field},"\n";
close(F);
}
Modified: trunk/unpack/unpack-srcpkg-l1
===================================================================
--- trunk/unpack/unpack-srcpkg-l1 2007-10-16 03:13:13 UTC (rev 982)
+++ trunk/unpack/unpack-srcpkg-l1 2007-10-16 04:06:55 UTC (rev 983)
@@ -50,7 +50,7 @@
# create control field files
for my $field (keys %$data) {
my $field_file = "$base_dir/fields/$field";
- open(F,">$field_file") or fail("cannot open file $field_file for writing: $!");
+ open(F, '>', $field_file) or fail("cannot open file $field_file for writing: $!");
print F $data->{$field},"\n";
close(F);
}
Reply to: