[Bug 5324] New: dpkg creates empty .list files

bugzilla at busybox.net bugzilla at busybox.net
Wed Jun 20 11:42:11 UTC 2012


https://bugs.busybox.net/show_bug.cgi?id=5324

           Summary: dpkg creates empty .list files
           Product: Busybox
           Version: 1.19.x
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: root at odem.su
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


This bug was introduced in commit 
b768aeb164d361d1ca2c8f6c091e93442f072656
tar: make typical extraction less memory-hungry

My workaround (this patch also implements proprly sorting of filenames):

diff --git a/archival/dpkg.c b/archival/dpkg.c
index 2a6a7b3..0604637 100644
@@ -1666,6 +1666,7 @@ static void unpack_package(deb_file_t *deb_file)
     init_archive_deb_data(archive_handle);
     archive_handle->dpkg__sub_archive->accept = conffile_list;
     archive_handle->dpkg__sub_archive->filter = filter_rename_config;
+    archive_handle->dpkg__sub_archive->reject = (void *) 1; /* dirty hack */
     archive_handle->dpkg__sub_archive->action_data = data_extract_all_prefix;
     archive_handle->dpkg__sub_archive->dpkg__buffer = (char*)"/"; /* huh? */
     archive_handle->dpkg__sub_archive->ah_flags |= ARCHIVE_UNLINK_OLD;
@@ -1674,11 +1675,14 @@ static void unpack_package(deb_file_t *deb_file)
     /* Create the list file */
     list_filename = xasprintf("/var/lib/dpkg/info/%s.%s", package_name,
"list");
     out_stream = xfopen_for_write(list_filename);
+    archive_handle->dpkg__sub_archive->passed =
+        llist_rev(archive_handle->dpkg__sub_archive->passed);
     while (archive_handle->dpkg__sub_archive->passed) {
+        char *filename =
llist_pop(&archive_handle->dpkg__sub_archive->passed);
         /* the leading . has been stripped by data_extract_all_prefix already
*/
-        fputs(archive_handle->dpkg__sub_archive->passed->data, out_stream);
+        fputs(filename, out_stream);
         fputc('\n', out_stream);
-        archive_handle->dpkg__sub_archive->passed =
archive_handle->dpkg__sub_archive->passed->link;
+        free(filename);
     }
     fclose(out_stream);

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list