Bug#48545: dpkg-shlibdeps should abstract file type checking
Package: dpkg-dev
Version: 1.4.1.18
Severity: wishlist
sub isbin {
open (F, $_[0]) || die("unable to open '$_[0]' for test");
if (read (F, $d, 4) != 4) {
die ("unable to read first four bytes of '$_[0]' as magic
number");
}
if ($d =~ /^\177ELF$/) { # ELF binary
It seems that this ought to be abstracted in some way, possibly
through the use of file. These are the sorts of things that are a
PITA to track down if for some reason they end up changing.
return 1;
} elsif ($d =~ /^\#\!..$/) { # shell script
This regexp just seems plain wrong. I know, for instance, that '
#!/bin/sh' functions...
return 0;
} elsif (unpack ('N', $d) == 0xcafebabe) { # JAVA binary
More hardcoding...
return 0;
} else {
die("unrecognized file type for '$_[0]'");
}
}
Thanks,
Dave
-- System Information
Debian Release: potato
Architecture: i386
Kernel: Linux chimchim 2.2.13 #2 Sat Oct 23 20:51:55 PDT 1999 i586
Versions of packages dpkg-dev depends on:
ii perl-5.005 [perl5] 5.005.03-4 Larry Wall's Practical Extracting
Reply to: