[PATCH] dpkg: copy old control file during --configure
Tobias Waldekranz
tobias at waldekranz.com
Wed Sep 18 12:33:36 UTC 2013
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 at 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
More information about the busybox
mailing list