[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] dpkg: copy old control file during --configure
From:       Tobias Waldekranz <tobias () waldekranz ! com>
Date:       2013-09-18 12:33:36
Message-ID: 20130918123336.GB7317 () gmail ! com
[Download RAW message or body]

In write_status_file it was assumed that the deb_file_t had a valid
control_file. However, this is not the case when running
--configure. This lead dpkg to write a status-line without any
preceding control information.

This patch uses the control information read from the old status file
if none is found in the deb_file_t struct.

Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
---
 archival/dpkg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/archival/dpkg.c b/archival/dpkg.c
index ed86f33..1b7cc6d 100644
--- a/archival/dpkg.c
+++ b/archival/dpkg.c
@@ -847,9 +847,12 @@ static void write_status_file(deb_file_t **deb_file)
 					i = 0;
 					while (deb_file[i] != NULL) {
 						if (strcmp(package_name, name_hashtable[package_hashtable[deb_file[i]->package]->name]) == 0) {
+							/* if we're --configuring no deb file has been read, so copy control from status */
+							char *control_out = deb_file[i]->control_file ? : control_buffer;
+
 							/* Write a status file entry with a modified status */
 							/* remove trailing \n's */
-							write_buffer_no_status(new_status_file, deb_file[i]->control_file);
+							write_buffer_no_status(new_status_file, control_out);
 							set_status(status_num, "ok", 2);
 							fprintf(new_status_file, "Status: %s\n\n",
 									name_hashtable[status_hashtable[status_num]->status]);
-- 
1.8.4.357.g8d83871.dirty

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic