The following commit has been merged in the master branch:
commit 6257d864d6bc1c4ec3bea247178a78679a36f365
Author: Guillem Jover <[email protected]>
Date: Fri Sep 11 14:49:24 2009 +0200
dpkg-deb: Check and warn on duplicate conffiles
Closes: #131633
diff --git a/debian/changelog b/debian/changelog
index 58a8af2..9e74f46 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,7 @@ dpkg (1.15.5) UNRELEASED; urgency=low
* Update list of binaries dpkg checks on the PATH.
- Remove install-info, now a wrapper that will disappear soonish.
- Add programs used by dpkg itself: sh, rm, find, tar and dpkg-deb.
+ * Check and warn on duplicate conffiles in dpkg-deb. Closes: #131633
[ Raphaƫl Hertzog ]
* Add versioned dependency on base-files (>= 5.0.0) to dpkg-dev to ensure
diff --git a/dpkg-deb/build.c b/dpkg-deb/build.c
index c94daf5..0f084e2 100644
--- a/dpkg-deb/build.c
+++ b/dpkg-deb/build.c
@@ -115,6 +115,18 @@ file_info_new(const char *filename)
return fi;
}
+static struct file_info *
+file_info_find_name(struct file_info *list, const char *filename)
+{
+ struct file_info *node;
+
+ for (node = list; node; node = node->next)
+ if (strcmp(node->fn, filename) == 0)
+ return node;
+
+ return NULL;
+}
+
/*
* Read the next filename from a filedescriptor and create a file_info struct
* for it. If there is nothing to read return NULL.
@@ -341,6 +353,9 @@ void do_build(const char *const *argv) {
strcpy(controlfile, directory);
strcat(controlfile, "/" BUILDCONTROLDIR "/" CONFFILESFILE);
if ((cf= fopen(controlfile,"r"))) {
+ struct file_info *conffiles_head = NULL;
+ struct file_info *conffiles_tail = NULL;
+
while (fgets(conffilename,MAXCONFFILENAME+1,cf)) {
n= strlen(conffilename);
if (!n) ohshite(_("empty string from fgets reading conffiles"));
@@ -367,7 +382,19 @@ void do_build(const char *const *argv) {
warning(_("conffile '%s' is not a plain file"), conffilename);
warns++;
}
+
+ if (file_info_find_name(conffiles_head, conffilename))
+ warning(_("conffile name '%s' is duplicated"), conffilename);
+ else {
+ struct file_info *conffile;
+
+ conffile = file_info_new(conffilename);
+ add_to_filist(&conffiles_head, &conffiles_tail, conffile);
+ }
}
+
+ free_filist(conffiles_head);
+
if (ferror(cf)) ohshite(_("error reading conffiles file"));
fclose(cf);
} else if (errno != ENOENT) {
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]