The following commit has been merged in the master branch: commit ee5a72d4dc54074301da2a0ae9512a66212302eb Author: Raphael Geissert <atom...@gmail.com> Date: Sat May 8 22:36:52 2010 -0500
Correctly handle ELF binaries with whitespaces in their name Rewrite the 'strings' collection script in Perl to make it more robust. * collection/strings: + [RG] Correctly handle ELF binaries with whitespaces in their name. (LP: #540342) * lib/Lintian/Collect/Binary.pm: + [RG] Correctly handle ELF binaries with whitespaces in their name. diff --git a/collection/strings b/collection/strings index eac96ca..5a6a906 100755 --- a/collection/strings +++ b/collection/strings @@ -1,7 +1,7 @@ -#!/bin/sh -e +#!/usr/bin/perl -w # strings -- lintian collection script -# Copyright (C) 2009 Raphael Geissert <atom...@gmail.com> +# Copyright (C) 2009, 2010 Raphael Geissert <atom...@gmail.com> # # 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 @@ -19,22 +19,44 @@ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1301, USA. -[ $# -eq 2 ] || { - echo "Syntax: strings <pkg> <type>" - exit 1 +use strict; +use warnings; + +use lib "$ENV{'LINTIAN_ROOT'}/lib"; +use Util; +use Lintian::Command qw(spawn); +use Lintian::Command::Simple; + +($#ARGV == 1) or fail("syntax: strings <pkg> <type>"); + +-f "file-info" + or fail("file-info invoked in wrong directory"); + +unlink("elf-index"); +delete_dir("strings"); + +open(ELF_INDEX, '>', 'elf-index') + or fail("Could not open 'elf-index' for writing: $!\n"); + +open(FILE_INFO, '<', 'file-info') + or fail("Could not open 'file-info' for reading: $!\n"); + +while (<FILE_INFO>) { + next unless(m/^(.+?)\x00\s+[^,]*\bELF\b/); + my $bin = $1; + + print ELF_INDEX "$bin\n"; + + next if ($bin =~ m,^/usr/lib/debug/,); + + my $dir = $bin; + $dir =~ s,/[^/]+?$,,; + + Lintian::Command::Simple::run('mkdir', '-p', "strings/$dir") == 0 + or fail("Failed to create directory 'strings/$dir'\n"); + + spawn({out => "strings/$bin", fail => 'error'}, ['strings', "unpacked/$bin"]); } -[ ! -f elf-index ] || rm -f elf-index -exec >elf-index - -for bin in $(sed -rn 's/\x00\s+[^,]*\bELF\b.+$//g;T;p' file-info); do - echo "$bin" - case $bin in - /usr/lib/debug/*) - ;; - *) - mkdir -p "strings/$(dirname "$bin")" - strings "unpacked/$bin" > "strings/$bin" - ;; - esac -done +close(ELF_INDEX); +close(FILE_INFO); diff --git a/debian/changelog b/debian/changelog index 6a9df92..9be2f64 100755 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,10 @@ lintian (2.4.2) UNRELEASED; urgency=low + [RA] Fix typo in long description of duplicated-key-in-desktop-entry. Thanks, Niels Thykier. (Closes: #580700) + * collection/strings: + + [RG] Correctly handle ELF binaries with whitespaces in their name. + (LP: #540342) + * data/fields/virtual-packages: + [RA] Update to current unstable and add the old xserver-xorg video and input virtual packages. @@ -28,6 +32,8 @@ lintian (2.4.2) UNRELEASED; urgency=low + [RA] Set a PATH of /bin:/usr/bin if PATH is completely unset. Thanks, Carsten Hey. + * lib/Lintian/Collect/Binary.pm: + + [RG] Correctly handle ELF binaries with whitespaces in their name. * lib/Lintian/Relation.pm: + [RA] Rather than allowing only a package name or a substvar, allow substvars mixed into the package name. (Closes: #580494) diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm index 91b7b70..6b6feeb 100644 --- a/lib/Lintian/Collect/Binary.pm +++ b/lib/Lintian/Collect/Binary.pm @@ -192,7 +192,7 @@ sub objdump_info { next if m/^\s*$/o; - if (m,^-- \./(\S+)\s*$,o) { + if (m,^-- \./(.+)$,) { if ($file) { $objdump_info{$file->{name}} = $file; } diff --git a/t/tests/strings-elf-detection/debian/debian/rules b/t/tests/strings-elf-detection/debian/debian/rules index 0bc7778..c3c9f8a 100755 --- a/t/tests/strings-elf-detection/debian/debian/rules +++ b/t/tests/strings-elf-detection/debian/debian/rules @@ -1,10 +1,13 @@ #!/usr/bin/make -f +pkg=strings-elf-detection %: dh $@ binary: dh --before dh_install binary cp /bin/true . touch foo bar::ELF + mkdir -p debian/$(pkg)/usr/lib/foo + cp /bin/true debian/$(pkg)/usr/lib/foo/true\ false dh --remaining binary clean: -- Debian package checker -- To UNSUBSCRIBE, email to debian-lint-maint-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1oaxke-0002hi...@alioth.debian.org