From: Raphael Hertzog Date: Fri, 18 Jan 2008 18:16:53 +0000 (+0100) Subject: Fix many syserr(), warning(), error() and subprocerr() calls in Dpkg::Shlibs::* X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d7b9b78dcb7b85ff79e020bfc859f6515629f53;p=dpkg Fix many syserr(), warning(), error() and subprocerr() calls in Dpkg::Shlibs::* --- diff --git a/ChangeLog b/ChangeLog index 2a9fc0fa..40d9a106 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-01-18 Raphael Hertzog + + * scripts/Dpkg/Shlibs/SymbolFile.pm, + scripts/Dpkg/Shlibs/Objdump.pm, scripts/Dpkg/Shlibs.pm: Update and + fix many syserr(), error(), warning() and subprocerr() calls to + the new style where the sprintf call is integrated. Uniformize + some error messages at the same time. + 2008-01-18 Raphael Hertzog * scripts/Dpkg/Shlibs/SymbolFile.pm (load): Parse *@ diff --git a/scripts/Dpkg/Shlibs.pm b/scripts/Dpkg/Shlibs.pm index 3d20e139..633be70a 100644 --- a/scripts/Dpkg/Shlibs.pm +++ b/scripts/Dpkg/Shlibs.pm @@ -48,8 +48,7 @@ parse_ldso_conf("/etc/ld.so.conf") if -e "/etc/ld.so.conf"; my %visited; sub parse_ldso_conf { my $file = shift; - open my $fh, "<", $file - or syserr(sprintf(_g("couldn't open %s"), $file)); + open my $fh, "<", $file or syserr(_g("cannot open %s"), $file); $visited{$file}++; while (<$fh>) { next if /^\s*$/; @@ -68,7 +67,7 @@ sub parse_ldso_conf { } } } - close $fh or syserr(sprintf(_g("couldn't close %s"), $file));; + close $fh; } # find_library ($soname, \@rpath, $format, $root) diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm index 859be1cd..35a05ac4 100644 --- a/scripts/Dpkg/Shlibs/Objdump.pm +++ b/scripts/Dpkg/Shlibs/Objdump.pm @@ -79,15 +79,14 @@ sub get_object { return $format{$file}; } } - close(P) or subprocerr(sprintf(_g("objdump on \`%s'"), $file)); + close(P) or subprocerr(_g("objdump on \`%s'"), $file); } } } sub is_elf { my ($file) = @_; - open(FILE, "<", $file) || - syserr(sprintf(_g("Can't open %s for test: %s"), $file, $!)); + open(FILE, "<", $file) || syserr(_g("cannot read %s"), $file); my ($header, $result) = ("", 0); if (read(FILE, $header, 4) == 4) { $result = 1 if ($header =~ /^\177ELF$/); @@ -146,7 +145,7 @@ sub _read { local $ENV{LC_ALL} = 'C'; open(my $objdump, "-|", "objdump", "-w", "-f", "-p", "-T", "-R", $file) - || syserr(sprintf(_g("Can't execute objdump: %s"), $!)); + || syserr(_g("cannot fork %s"), "objdump"); my $ret = $self->_parse($objdump); close($objdump); return $ret; @@ -187,7 +186,7 @@ sub _parse { if (/^\S+\s+(\S+)\s+(\S+)\s*$/) { $self->{dynrelocs}{$2} = $1; } else { - warning(sprintf(_g("Couldn't parse dynamic relocation record: %s"), $_)); + warning(_g("Couldn't parse dynamic relocation record: %s"), $_); } } elsif ($section eq "dyninfo") { if (/^\s*NEEDED\s+(\S+)/) { @@ -297,7 +296,7 @@ sub parse_dynamic_symbol { # Ignore some s390-specific output like # REG_G6 g R *UND* 0000000000000000 #scratch } else { - warning(sprintf(_g("Couldn't parse dynamic symbol definition: %s"), $line)); + warning(_g("Couldn't parse dynamic symbol definition: %s"), $line); } } diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index 036d2d67..a4c22952 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -102,13 +102,13 @@ sub load { $seen->{$file} = 1; open(my $sym_file, "<", $file) - || syserr(sprintf(_g("Can't open %s: %s"), $file)); + || syserr(_g("cannot open %s"), $file); my $object = $current_object; while (defined($_ = <$sym_file>)) { chomp($_); if (/^\s+(\S+)\s(\S+)(?:\s(\d+))?/) { if (not defined ($object)) { - error(sprintf(_g("Symbol information must be preceded by a header (file %s, line %s).", $file, $.))); + error(_g("Symbol information must be preceded by a header (file %s, line %s)."), $file, $.); } my $name = $1; # New symbol @@ -154,7 +154,7 @@ sub load { $self->create_object($object, "$2"); } } else { - warning(sprintf(_g("Failed to parse a line in %s: %s"), $file, $_)); + warning(_g("Failed to parse a line in %s: %s"), $file, $_); } } close($sym_file); @@ -168,7 +168,7 @@ sub save { $fh = \*STDOUT; } else { open($fh, ">", $file) - || syserr(sprintf(_g("Can't open %s for writing: %s"), $file, $!)); + || syserr(_g("cannot write %s"), $file); } $self->dump($fh, $with_deprecated); close($fh) if ($file ne "-");