diff options
-rw-r--r-- | dselect/methods/Dselect/Ftp.pm | 6 | ||||
-rwxr-xr-x | dselect/methods/ftp/install | 12 | ||||
-rwxr-xr-x | dselect/mkcurkeys.pl | 4 | ||||
-rw-r--r-- | scripts/Dpkg/Arch.pm | 8 | ||||
-rwxr-xr-x | scripts/dpkg-checkbuilddeps.pl | 2 | ||||
-rwxr-xr-x | scripts/dpkg-distaddfile.pl | 4 | ||||
-rwxr-xr-x | scripts/dpkg-scansources.pl | 2 | ||||
-rw-r--r-- | src/t/100_dpkg_divert.t | 8 | ||||
-rw-r--r-- | test/100_critic.t | 1 |
9 files changed, 25 insertions, 22 deletions
diff --git a/dselect/methods/Dselect/Ftp.pm b/dselect/methods/Dselect/Ftp.pm index fc21d1522..568e5f6f8 100644 --- a/dselect/methods/Dselect/Ftp.pm +++ b/dselect/methods/Dselect/Ftp.pm @@ -41,7 +41,9 @@ sub read_config { my ($code, $conf); local($/); - open(VARS, $vars) || die "Couldn't open $vars : $!\nTry to relaunch the 'Access' step in dselect, thanks.\n"; + open(VARS, '<', $vars) || + die "Couldn't open $vars : $!\n" . + "Try to relaunch the 'Access' step in dselect, thanks.\n"; $code = <VARS>; close VARS; @@ -66,7 +68,7 @@ sub store_config { # Check that config is completed return if not $config{'done'}; - open(VARS, ">$vars") || die "Couldn't open $vars in write mode : $!\n"; + open(VARS, '>', $vars) || die "Couldn't open $vars in write mode : $!\n"; print VARS Dumper(\%config); close VARS; } diff --git a/dselect/methods/ftp/install b/dselect/methods/ftp/install index 08bb84426..fdb1fc547 100755 --- a/dselect/methods/ftp/install +++ b/dselect/methods/ftp/install @@ -61,7 +61,7 @@ mkpath(["$methdir/$config{'dldir'}"], 0, 0755); my %md5sums; if (-f "$methdir/md5sums") { local $/; - open(MD5SUMS, "$methdir/md5sums") || + open(MD5SUMS, '<', "$methdir/md5sums") || die "Couldn't read file $methdir/md5sums"; my $code = <MD5SUMS>; close MD5SUMS; @@ -114,7 +114,7 @@ print "Processing status file...\n"; my %curpkgs; sub procstatus { my (%flds, $fld); - open (STATUS, "$vardir/status") or die "Could not open status file"; + open (STATUS, '<', "$vardir/status") or die "Could not open status file"; while (%flds = getblk(\*STATUS), %flds) { if($flds{'status'} =~ /^install ok/) { my $cs = (split(/ /, $flds{'status'}))[2]; @@ -156,7 +156,7 @@ sub procpkgfile { my $dist = shift; my(@files,@sizes,@md5sums,$pkg,$ver,$fl,$nfs,$fld); my(%flds); - open(PKGFILE, "$fn") or die "Could not open package file $fn"; + open(PKGFILE, '<', $fn) or die "Could not open package file $fn"; while(%flds = getblk(\*PKGFILE), %flds) { $pkg = $flds{'package'}; $ver = $curpkgs{$pkg}; @@ -466,7 +466,7 @@ sub getdebinfo($) { my $type = chkdeb($fn); my ($pkg, $ver); if($type == 1) { - open(PKGFILE, "dpkg-deb --field $fn |"); + open(PKGFILE, '-|', "dpkg-deb --field $fn"); my %fields = getblk(\*PKGFILE); close(PKGFILE); $pkg = $fields{'package'}; @@ -474,7 +474,7 @@ sub getdebinfo($) { if($fields{'package_revision'}) { $ver .= '-' . $fields{'package_revision'}; } return $pkg, $ver; } elsif ( $type == 2) { - open(PKGFILE, "dpkg-split --info $fn|"); + open(PKGFILE, '-|', "dpkg-split --info $fn"); while(<PKGFILE>) { /Part of package:\s*(\S+)/ and $pkg = $+; /\.\.\. version:\s*(\S+)/ and $ver = $+; @@ -623,7 +623,7 @@ foreach (keys %md5sums) { next if (-f $_); delete $md5sums{$_}; } -open(MD5SUMS, ">$methdir/md5sums") || +open(MD5SUMS, '>', "$methdir/md5sums") || die "Can't open $methdir/md5sums in write mode : $!\n"; print MD5SUMS Dumper(\%md5sums); close MD5SUMS; diff --git a/dselect/mkcurkeys.pl b/dselect/mkcurkeys.pl index 369c6ccc4..244544c80 100755 --- a/dselect/mkcurkeys.pl +++ b/dselect/mkcurkeys.pl @@ -27,7 +27,7 @@ $#ARGV == 1 || die ("usage: mkcurkeys.pl <filename> <curses.h>"); my (%over, %base, %name); -open(OV,"<$ARGV[0]") || die $!; +open(OV, '<', $ARGV[0]) || die $!; while (<OV>) { chomp; /^#/ && next; # skip comments @@ -45,7 +45,7 @@ for (my $i = 1, my $let = 'A'; $i <= 26; $i++, $let++) { our ($k, $v); -open(NCH,"<$ARGV[1]") || die $!; +open(NCH, '<', $ARGV[1]) || die $!; while (<NCH>) { s/\s+$//; m/#define KEY_(\w+)\s+\d+\s+/ || next; diff --git a/scripts/Dpkg/Arch.pm b/scripts/Dpkg/Arch.pm index 75f90cc3b..b2538b4ec 100644 --- a/scripts/Dpkg/Arch.pm +++ b/scripts/Dpkg/Arch.pm @@ -146,7 +146,7 @@ sub read_cputable local $_; local $/ = "\n"; - open CPUTABLE, "$pkgdatadir/cputable" + open CPUTABLE, '<', "$pkgdatadir/cputable" or syserr(_g("cannot open %s"), "cputable"); while (<CPUTABLE>) { if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) { @@ -170,7 +170,7 @@ sub read_ostable local $_; local $/ = "\n"; - open OSTABLE, "$pkgdatadir/ostable" + open OSTABLE, '<', "$pkgdatadir/ostable" or syserr(_g("cannot open %s"), "ostable"); while (<OSTABLE>) { if (m/^(?!\#)(\S+)\s+(\S+)\s+(\S+)/) { @@ -196,7 +196,7 @@ sub abitable_load() # it does not exist, as that will only mean the other tables do not have # an entry needing to be overridden. This way we do not require a newer # dpkg by libdpkg-perl. - if (open ABITABLE, "$pkgdatadir/abitable") { + if (open ABITABLE, '<', "$pkgdatadir/abitable") { while (<ABITABLE>) { if (m/^(?!\#)(\S+)\s+(\S+)/) { $abibits{$1} = $2; @@ -220,7 +220,7 @@ sub read_triplettable() local $_; local $/ = "\n"; - open TRIPLETTABLE, "$pkgdatadir/triplettable" + open TRIPLETTABLE, '<', "$pkgdatadir/triplettable" or syserr(_g("cannot open %s"), "triplettable"); while (<TRIPLETTABLE>) { if (m/^(?!\#)(\S+)\s+(\S+)/) { diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl index 5bb4c375b..16fe751f1 100755 --- a/scripts/dpkg-checkbuilddeps.pl +++ b/scripts/dpkg-checkbuilddeps.pl @@ -123,7 +123,7 @@ sub parse_status { my $facts = Dpkg::Deps::KnownFacts->new(); local $/ = ''; - open(STATUS, "<$status") || syserr(_g("cannot open %s"), $status); + open(STATUS, '<', $status) || syserr(_g("cannot open %s"), $status); while (<STATUS>) { next unless /^Status: .*ok installed$/m; diff --git a/scripts/dpkg-distaddfile.pl b/scripts/dpkg-distaddfile.pl index ae0c3b92a..b49f4b048 100755 --- a/scripts/dpkg-distaddfile.pl +++ b/scripts/dpkg-distaddfile.pl @@ -84,8 +84,8 @@ sysopen($lockfh, "debian/control", O_WRONLY) || file_lock($lockfh, "debian/control"); $fileslistfile="./$fileslistfile" if $fileslistfile =~ m/^\s/; -open(Y, "> $fileslistfile.new") || syserr(_g("open new files list file")); -if (open(X,"< $fileslistfile")) { +open(Y, '>', "$fileslistfile.new") || syserr(_g("open new files list file")); +if (open(X, '<', $fileslistfile)) { while (<X>) { s/\n$//; next if m/^(\S+) / && $1 eq $file; diff --git a/scripts/dpkg-scansources.pl b/scripts/dpkg-scansources.pl index 67050e69c..e67f50c85 100755 --- a/scripts/dpkg-scansources.pl +++ b/scripts/dpkg-scansources.pl @@ -309,7 +309,7 @@ sub main { load_src_override $Src_override, $override; load_override_extra $Extra_override_file if defined $Extra_override_file; - open FIND, "find -L \Q$dir\E -name '*.dsc' -print |" + open FIND, '-|', "find -L \Q$dir\E -name '*.dsc' -print" or syserr(_g("cannot fork for %s"), "find"); while (<FIND>) { chomp; diff --git a/src/t/100_dpkg_divert.t b/src/t/100_dpkg_divert.t index 0fdf4bc92..114a1840f 100644 --- a/src/t/100_dpkg_divert.t +++ b/src/t/100_dpkg_divert.t @@ -48,20 +48,20 @@ sub cleanup { sub install_diversions { my ($txt) = @_; - open(O, "> $admindir/diversions"); + open(O, '>', "$admindir/diversions"); print O $txt; close(O); } sub install_filelist { my ($pkg, $arch, @files) = @_; - open(L, "> $admindir/info/$pkg.list"); + open(L, '>', "$admindir/info/$pkg.list"); for my $file (@files) { print L "$file\n"; } close(L); # Only installed packages have their files list considered. - open(S, ">> $admindir/status"); + open(S, '>>', "$admindir/status"); print S <<"EOF"; Package: $pkg Status: install ok installed @@ -134,7 +134,7 @@ sub diversions_pack { sub diversions_eq { my (@expected) = split /^/, shift; - open(O, "$admindir/diversions"); + open(O, '<', "$admindir/diversions"); my (@contents) = <O>; close(O); diff --git a/test/100_critic.t b/test/100_critic.t index b4c103120..cc6b6d838 100644 --- a/test/100_critic.t +++ b/test/100_critic.t @@ -50,6 +50,7 @@ my @policies = qw( Documentation::RequirePackageMatchesPodName InputOutput::ProhibitInteractiveTest InputOutput::ProhibitOneArgSelect + InputOutput::ProhibitTwoArgOpen InputOutput::RequireEncodingWithUTF8Layer Miscellanea::ProhibitFormats Miscellanea::ProhibitUnrestrictedNoCritic |