]> git.donarmstrong.com Git - debhelper.git/commitdiff
r499: * dh_strip: run file using a safe pipe open, that will not expose any weird
authorjoey <joey>
Thu, 27 Dec 2001 02:22:58 +0000 (02:22 +0000)
committerjoey <joey>
Thu, 27 Dec 2001 02:22:58 +0000 (02:22 +0000)
     characters in filenames to a shell. Closes: #126491
   * fixed dh_testdir man page

debian/changelog
dh_strip
dh_testdir

index 62afa777c6821ba83c7091b0b0c74632fa8a0cf8..43624a7361835e04086bc5ce177a0574729dcab2 100644 (file)
@@ -1,3 +1,11 @@
+debhelper (3.0.53) unstable; urgency=low
+
+  * dh_strip: run file using a safe pipe open, that will not expose any weird
+    characters in filenames to a shell. Closes: #126491
+  * fixed dh_testdir man page
+
+ -- Joey Hess <joeyh@debian.org>  Wed, 26 Dec 2001 21:15:42 -0500
+
 debhelper (3.0.52) unstable; urgency=low
 
   * Typo, Closes: #122679
index 49f37230acc9f728eb0d5433c7488d16fa0a9027..a62e440d071d77b190f3f8249808a30757ea1338 100755 (executable)
--- a/dh_strip
+++ b/dh_strip
@@ -53,6 +53,17 @@ if (defined $ENV{DEB_BUILD_OPTIONS} && $ENV{DEB_BUILD_OPTIONS} =~ /nostrip/) {
        exit;
 }
 
+# I could just use `file $_[0]`, but this is safer
+sub get_file_type {
+       my $file=shift;
+       open (FILE, '-|') # handle all filenames safely
+               || exec('file', $file)
+               || die "can't exec file: $!";
+       my $type=<FILE>;
+       close FILE;
+       return $type;
+}
+
 # Check if a file is an elf binary, shared library, or static library,
 # for use by File::Find. It'll fill the following 3 arrays with anything
 # it finds:
@@ -70,7 +81,7 @@ sub testfile {
        # Does its filename look like a shared library?
        if (m/.*\.so.*?/) {
                # Ok, do the expensive test.
-               my $type=`file $_`;
+               my $type=get_file_type($_);
                if ($type=~m/.*ELF.*shared.*/) {
                        push @shared_libs, $fn;
                        return;
@@ -81,7 +92,7 @@ sub testfile {
        my (undef,undef,$mode,undef)=stat(_);
        if ($mode & 0111) {
                # Ok, expensive test.
-               my $type=`file $_`;
+               my $type=get_file_type($_);
                if ($type=~m/.*ELF.*executable.*/) {
                        push @executables, $fn;
                        return;
index cb3acc7d69f3f8fa9d680a351ec80a169f521b54..f10958038766a7d9c7daa568e6c7c8fbf2d4a9dd 100755 (executable)
@@ -11,7 +11,7 @@ use Debian::Debhelper::Dh_Lib;
 
 =head1 SYNOPSIS
 
-B<dh_testdir> [S<I<debhelper options>>] [S<I<file ...>]
+B<dh_testdir> [S<I<debhelper options>>] [S<I<file ...>>]
 
 =head1 DESCRIPTION