Bug#31958: falsely reporting corrupt deb-file

1999-01-15 Thread Edwin Martin
Package: dpkg
Version: 1.4.0.23.2 (i386 elf)

dpkg reports a .deb file is corrupted, while I'm certain it isn't
I downloaded the file from different places and in different ways
(Netscape and binary ftp). The locations I tried are:
 ftp://ftp.debian.org/debian/dists/proposed-updates/netstd_3.07-2hamm.4_i386.deb

 ftp://ftp.cistron.nl/pub/debian/stable/binary-i386/net/netstd_3.07-2hamm.2.deb

Here's a transcript:

> tweety:/usr/src# dpkg -i netstd_3_07-2hamm_4_i386.deb
> dpkg-deb: file looks like it might be an archive which has been
> dpkg-deb:corrupted by being downloaded in ASCII mode
> dpkg-deb: `netstd_3_07-2hamm_4_i386.deb' is not a debian format archive
> dpkg: error processing netstd_3_07-2hamm_4_i386.deb (--install):
>  subprocess dpkg-deb --control returned error exit status 2
> Errors were encountered while processing:
>  netstd_3_07-2hamm_4_i386.deb
>
I use Linux 2.0.34 and libc-2.0.7.so.




Objdump patch for dpkg-shlibdeps

1999-01-15 Thread Daniel Jacobowitz
This patch does two things, one more successfully/completely than the
other:

 - Use objdump instead of ldd, producing fewer bogus warnings/errors. 
   This part works fine, and shows no regressions that I could find.

 - Handle shared libraries which are in a package produced by this
   source which are not yet installed.  I haven't quite got it working
   in all cases yet.

Comments?

Dan

/\  /\
|   Daniel Jacobowitz|__| CMU, CS class of 2002  |
|   Debian GNU/Linux Developer__   Part-Time Systems Programmer  |
| [EMAIL PROTECTED] |  |[EMAIL PROTECTED] |
\/  \/
--- /usr/src/dpkg/dpkg-1.4.1/scripts/dpkg-shlibdeps.pl  Sun Nov  1 11:07:43 1998
+++ /usr/bin/dpkg-shlibdeps Sun Dec  6 19:24:59 1998
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 
-$dpkglibdir= ".";
-$version= '1.3.6'; # This line modified by Makefile
+$dpkglibdir= "/usr/lib/dpkg";
+$version= '1.4.1'; # This line modified by Makefile
 
 use POSIX;
 use POSIX qw(:errno_h :signal_h);
@@ -88,40 +88,79 @@
 
 for ($i=0;$i<=$#exec;$i++) {
 if (!isbin ($exec[$i])) { next; }
-defined($c= open(P,"-|")) || syserr("cannot fork for ldd");
-if (!$c) { exec("ldd","--",$exec[$i]); syserr("cannot exec ldd"); }
-$nthisldd=0;
+defined($c= open(P,"-|")) || syserr("cannot fork for objdump");
+if (!$c) { exec("objdump","-p","--",$exec[$i]); syserr("cannot exec 
objdump"); }
 while () {
-   chomp;
-   if (m,^\s+(\S+)\s+\=\>\s+\1$,) {
-   # shared libraries depend on themselves (unsure why)
-   # Only under old ld.so
-   $nthisldd++;
-   } elsif (m,\s+statically linked(\s+\(ELF\))?$,) {
-   $nthisldd++;
-   } elsif (m,^\s+(\S+)\.so\.(\S+)\s+=>\s+(/\S+)(\s+\(0x.+\))?$,) {
-   push(@libname,$1); push(@libsoname,$2); push(@libpath,$3);
-   push(@libf,$execf[$i]);
-   push(@libpaths,$3) if !$libpathadded{$3}++;
-   $nthisldd++;
-   } else {
-   &warn("unknown output from ldd on \`$exec[$i]': \`$_'");
-   }
+chomp;
+if (m,^\s*NEEDED\s+(\S+)\.so\.(\S+)$,) {
+push(@libname,$1); push(@libsoname,$2);
+push(@libf,$execf[$i]);
+push(@libfiles,"$1.so.$2");
+}
+}
+close(P); $? && subprocerr("objdump on \`$exec[$i]'");
+}
+
+# Now: See if it is in this package.  See if it is in any other package.
+sub searchdir {
+my $dir = shift;
+if(opendir(DIR, $dir)) {
+my @dirents = readdir(DIR);
+closedir(DIR);
+for (@dirents) {
+if ( -f "$dir/$_/DEBIAN/shlibs" ) {
+push(@curshlibs, "$dir/$_/DEBIAN/shlibs");
+last;
+} elsif ( $_ !~ /^\./ && -d "$dir/$_" ) {
+&searchdir("$dir/$_");
+}
+}
+}
+}
+
+$searchdir = $exec[0];
+$curpackdir = "debian/tmp";
+do { $searchdir =~ s,/[^/]*$,,; } while($searchdir =~ m,/, && ! -d 
"$searchdir/DEBIAN");
+if ($searchdir =~ m,/,) {
+$curpackdir = $searchdir;
+$searchdir =~ s,/[^/]*,,;
+&searchdir($searchdir);
+}
+
+if ($#curshlibs >= 0) {
+PRELIB: for ($i=0;$i<=$#libname;$i++) {
+for my $shlibsfile (@curshlibs) {
+if(scanshlibsfile($shlibsfile, $libname[$i], $libsoname[$i], 
$libf[$i])) {
+splice(@libname, $i, 1);
+splice(@libsoname, $i, 1);
+splice(@libf, $i, 1);
+splice(@libfiles, $i, 1);
+$i--;
+next PRELIB;
+}
+}
+if(scanshlibsfile($shlibslocal,$libname[$i],$libsoname[$i],$libf[$i]) 
+  || 
scanshlibsfile($shlibsoverride,$libname[$i],$libsoname[$i],$libf[$i])) {
+splice(@libname, $i, 1);
+splice(@libsoname, $i, 1);
+splice(@libf, $i, 1);
+splice(@libfiles, $i, 1);
+$i--;
+next PRELIB;
+}
 }
-close(P); $? && subprocerr("ldd on \`$exec[$i]'");
-$nthisldd || &warn("ldd on \`$exec[$i]' gave nothing on standard output");
 }
 
-if ($#libpaths >= 0) {
-grep(s/\[\?\*/\\$&/g, @libpaths);
+if ($#libfiles >= 0) {
+grep(s/\[\?\*/\\$&/g, @libname);
 defined($c= open(P,"-|")) || syserr("cannot fork for dpkg --search");
-if (!$c) { exec("dpkg","--search","--",@libpaths); syserr("cannot exec 
dpkg"); }
+if (!$c) { exec("dpkg","--search","--",map {"*/$_"} @libfiles); 
syserr("cannot exec dpkg"); }
 while () {
s/\n$//;
if (m/^local diversion |^diversion by/) {
&warn("diversions involved - output may be incorrect");
print(STDERR " $_\n") || syserr("write diversion info to stderr");
-   } elsif (m=^(\S+(, \S+)*): (/.+)$=) {
+   } elsif (m=^(\S+(, \S+)*): /.+/([^/]+)$=) {
$pathpackages{$+}= $1;
} else {
&warn("unknown output from dpkg 

Bug#31508: parsechangelog broken?

1999-01-15 Thread Julian Gilbey
On second thoughts, Christian's original patch avoids the need to look
at debian/substvars if it is not needed, so could be used *in
addition* to mine.  The full patch looks like this:

--- controllib.pl.orig  Fri Jan 15 01:08:51 1999
+++ controllib.pl   Fri Jan 15 01:10:15 1999
@@ -1,3 +1,4 @@
+use POSIX qw(:errno_h);
 
 $parsechangelog= 'dpkg-parsechangelog';
 
@@ -91,7 +91,7 @@
 sub outputclose {
 my ($dosubstvars) = @_;
 for $f (keys %f) { $substvar{"F:$f"}= $f{$f}; }
-if (length($varlistfile)) {
+if (length($varlistfile) and $dosubstvars) {
 $varlistfile="./$varlistfile" if $varlistfile =~ m/\s/;
 if (open(SV,"< $varlistfile")) {
 while () {
@@ -101,7 +102,7 @@
 $substvar{$1}= $';
 }
 close(SV);
-} elsif ($! !~ m/no such file or directory/i) {
+} elsif ($! != ENOENT) {
 &error("unable to open substvars file $varlistfile: $!");
 }
 }


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Julian Gilbey Email: [EMAIL PROTECTED]
   Dept of Mathematical Sciences, Queen Mary & Westfield College,
  Mile End Road, London E1 4NS, ENGLAND
  -*- Finger [EMAIL PROTECTED] for my PGP public key. -*-



Bug#31508: parsechangelog broken?

1999-01-15 Thread Julian Gilbey
> Package: dpkg-dev
> Version: 1.4.1
> Severity: important
> 
> Without the attached patch, I am unable to build packages with
> dpkg-buildpackage.
> 
>   Christian
> [...]

You've got a bug all right, but the problem was that you were using a
non-English locale and controllib.pl assumes that you will get English
error messages.  The following patch will fix the problem.

Wichert or someone else: could you please rebuild dpkg and upload it
with this patch?  It is a bit much for me to download for such a small
bug.

   Julian

--- controllib.pl.orig  Fri Jan 15 01:08:51 1999
+++ controllib.pl   Fri Jan 15 01:10:15 1999
@@ -1,3 +1,4 @@
+use POSIX qw(:errno_h);
 
 $parsechangelog= 'dpkg-parsechangelog';
 
@@ -101,7 +102,7 @@
 $substvar{$1}= $';
 }
 close(SV);
-} elsif ($! !~ m/no such file or directory/i) {
+} elsif ($! != ENOENT) {
 &error("unable to open substvars file $varlistfile: $!");
 }
 }

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Julian Gilbey Email: [EMAIL PROTECTED]
   Dept of Mathematical Sciences, Queen Mary & Westfield College,
  Mile End Road, London E1 4NS, ENGLAND
  -*- Finger [EMAIL PROTECTED] for my PGP public key. -*-