Author: djpig
Date: 2006-05-12 23:43:54 +0000 (Fri, 12 May 2006)
New Revision: 309

Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/dpkg-deb/info.c
Log:
Don't spew out garbage from dpkg-deb, if the second argument
to -I is a absolute filename. Based on a patch by Ian Eure.
Closes: #35573


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2006-05-12 17:22:44 UTC (rev 308)
+++ trunk/ChangeLog     2006-05-12 23:43:54 UTC (rev 309)
@@ -1,5 +1,10 @@
 2006-05-12  Frank Lichtenheld  <[EMAIL PROTECTED]>
 
+       * dpkg-deb/info.c (info_spew): Prepend the name of the
+       directory we're in to the control component name. This
+       way we don't spew out garbage if we get an absolute
+       path as component name.
+
        * scripts/dpkg-scanpackages.pl: Print usage
        information on stderr instead of stdout in
        case of error. Only print it on stdout if

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-05-12 17:22:44 UTC (rev 308)
+++ trunk/debian/changelog      2006-05-12 23:43:54 UTC (rev 309)
@@ -20,6 +20,9 @@
   * Improve the description of --show-format in dpkg-deb
     man page and add a pointer to the complete description
     of the option in dpkg-query.
+  * Don't spew out garbage from dpkg-deb, if the second argument
+    to -I is a absolute filename. Based on a patch by Ian Eure.
+    Closes: #35573
 
   [ Nicolas François ]
   * fix typos in the Russian man pages. Thanks to Stepan Golosunov.

Modified: trunk/dpkg-deb/info.c
===================================================================
--- trunk/dpkg-deb/info.c       2006-05-12 17:22:44 UTC (rev 308)
+++ trunk/dpkg-deb/info.c       2006-05-12 23:43:54 UTC (rev 309)
@@ -86,22 +86,35 @@
 static void info_spew(const char *debar, const char *directory,
                       const char *const *argv) {
   const char *component;
+  size_t pathlen;
+  char *controlfile = NULL;
   FILE *co;
   int re= 0;
 
   while ((component= *argv++) != 0) {
-    co= fopen(component,"r");
+    pathlen = strlen(directory) + strlen(component) + 2;
+    controlfile = (void *) realloc((void *) controlfile, pathlen);
+    if (!controlfile)
+      ohshite(_("realloc failed (%ld bytes)"), pathlen);
+    memset(controlfile, 0, sizeof(controlfile));
+
+    strcat(controlfile, directory);
+    strcat(controlfile, "/");
+    strcat(controlfile, component);
+    co= fopen(controlfile,"r");
+
     if (co) {
       stream_fd_copy(co, 1, -1, _("info_spew"));
     } else if (errno == ENOENT) {
       if (fprintf(stderr, _("dpkg-deb: `%.255s' contains no control component 
`%.255s'\n"),
-                  debar, component) == EOF) werr("stderr");
+                 debar, component) == EOF) werr("stderr");
       re++;
     } else {
       ohshite(_("open component `%.255s' (in %.255s) failed in an unexpected 
way"),
-              component, directory);
+             component, directory);
     }
   }
+  free(controlfile);
   if (re==1)
     ohshit(_("One requested control component is missing"));
   else if (re>1)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to