Forráskód Böngészése

dpkg-deb: Be more precise on deb member errors

Print a message when we've found the data member but do not know the
compression, and another one when there's an unknown member before the
data member.

This also stops resetting adminmember to -1 as a temporary sentinel,
so that we don't lose previous state.
Guillem Jover 13 éve
szülő
commit
cb8ed03bbf
2 módosított fájl, 10 hozzáadás és 7 törlés
  1. 1 0
      debian/changelog
  2. 9 7
      dpkg-deb/extract.c

+ 1 - 0
debian/changelog

@@ -9,6 +9,7 @@ dpkg (1.17.2) UNRELEASED; urgency=low
   * Version manpages-it in Replaces with (<< 2.80-4), now that the package
     does not ship the overlapping paths any more.
   * Automatically prepend needed spaces for continuation --force-help lines.
+  * Be more precise on deb format errors with data member in dpkg-deb.
 
  -- Guillem Jover <guillem@debian.org>  Sun, 28 Jul 2013 15:06:29 +0200
 

+ 9 - 7
dpkg-deb/extract.c

@@ -181,18 +181,20 @@ extracthalf(const char *debar, const char *dir,
 	if (strncmp(arh.ar_name, ADMINMEMBER, sizeof(arh.ar_name)) == 0)
 	  adminmember = 1;
 	else {
-	  adminmember = -1;
-
 	  if (strncmp(arh.ar_name, DATAMEMBER, strlen(DATAMEMBER)) == 0) {
 	    const char *extension = arh.ar_name + strlen(DATAMEMBER);
 
 	    adminmember= 0;
 	    decompressor = compressor_find_by_extension(extension);
-	  }
-
-          if (adminmember == -1 || decompressor == compressor_type_unknown)
-            ohshit(_("archive '%.250s' contains not understood data member %.*s, giving up"),
-                   debar, (int)sizeof(arh.ar_name), arh.ar_name);
+            if (decompressor == compressor_type_unknown)
+              ohshit(_("archive '%s' uses unknown compression for member '%.*s', "
+                       "giving up"),
+                     debar, (int)sizeof(arh.ar_name), arh.ar_name);
+          } else {
+            ohshit(_("archive '%s' has premature member '%.*s' before '%s', "
+                     "giving up"),
+                   debar, (int)sizeof(arh.ar_name), arh.ar_name, DATAMEMBER);
+          }
         }
         if (adminmember == 1) {
           if (ctrllennum != 0)