Author: djpig
Date: 2006-05-19 22:46:39 +0000 (Fri, 19 May 2006)
New Revision: 336
Modified:
trunk/ChangeLog
trunk/debian/changelog
trunk/src/help.c
trunk/src/main.h
trunk/src/remove.c
Log:
Don't drop directories that contain our conffiles too early from
our file listing. Otherwise we might leave them behind on purge
if we share them with other packages.
Closes: #174180, #198128, #198522, #318825, #366178
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-05-19 22:11:08 UTC (rev 335)
+++ trunk/ChangeLog 2006-05-19 22:46:39 UTC (rev 336)
@@ -16,6 +16,15 @@
2006-05-19 Frank Lichtenheld <[EMAIL PROTECTED]>
+ * src/help.c (hasdirectoryconffiles): New function
+ to test wether a directory contains conffiles of
+ a given package.
+ * src/main.h: Add declaration of hasdirectoryconffiles.
+ * src/remove.c (removal_bulk_remove_files): Don't
+ drop directories from our file list that hold
+ our conffiles.
+ (removal_bulk_remove_leftover_dirs) Likewise.
+
* utils/enoent.c: Add a comment at the top of the
file explaining why we use this odd program at all.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2006-05-19 22:11:08 UTC (rev 335)
+++ trunk/debian/changelog 2006-05-19 22:46:39 UTC (rev 336)
@@ -42,6 +42,10 @@
* When building packages with dpkg-deb give a more useful error
message in case a conffile entry has leading whitespace. Patch
by David Lopez Moreno. Closes: #281562
+ * Don't drop directories that contain our conffiles too early from
+ our file listing. Otherwise we might leave them behind on purge
+ if we share them with other packages.
+ Closes: #174180, #198128, #198522, #318825, #366178
[ Nicolas François ]
* fix typos in the Russian man pages. Thanks to Stepan Golosunov.
Modified: trunk/src/help.c
===================================================================
--- trunk/src/help.c 2006-05-19 22:11:08 UTC (rev 335)
+++ trunk/src/help.c 2006-05-19 22:46:39 UTC (rev 336)
@@ -403,6 +403,26 @@
putc('\n',stderr);
}
+int hasdirectoryconffiles(struct filenamenode *file, struct pkginfo *pkg) {
+ /* Returns 1 if the directory contains conffiles belonging to pkg, 0
otherwise. */
+ struct conffile *conff;
+ size_t namelen;
+
+ debug(dbg_veryverbose, "hasdirectoryconffiles `%s' (from %s)", file->name,
+ pkg->name);
+ namelen = strlen(file->name);
+ for (conff= pkg->installed.conffiles; conff; conff= conff->next) {
+ if (!strncmp(file->name,conff->name,namelen)) {
+ debug(dbg_veryverbose, "directory %s has conffile %s from %s",
+ file->name, conff->name, pkg->name);
+ return 1;
+ }
+ }
+ debug(dbg_veryverbose, "hasdirectoryconffiles no");
+ return 0;
+}
+
+
int isdirectoryinuse(struct filenamenode *file, struct pkginfo *pkg) {
/* Returns 1 if the file is used by packages other than pkg, 0 otherwise. */
struct filepackages *packageslump;
Modified: trunk/src/main.h
===================================================================
--- trunk/src/main.h 2006-05-19 22:11:08 UTC (rev 335)
+++ trunk/src/main.h 2006-05-19 22:46:39 UTC (rev 336)
@@ -203,6 +203,7 @@
const char *ifok, const char *iffallback);
void clear_istobes(void);
int isdirectoryinuse(struct filenamenode *namenode, struct pkginfo *pkg);
+int hasdirectoryconffiles(struct filenamenode *namenode, struct pkginfo *pkg);
enum debugflags {
dbg_general= 00001,
Modified: trunk/src/remove.c
===================================================================
--- trunk/src/remove.c 2006-05-19 22:11:08 UTC (rev 335)
+++ trunk/src/remove.c 2006-05-19 22:46:39 UTC (rev 336)
@@ -240,7 +240,11 @@
* package which uses it. Other files should only be listed
* in this package (but we don't check).
*/
- if (isdirectoryinuse(namenode,pkg)) continue;
+ if (hasdirectoryconffiles(namenode,pkg)) {
+ push_leftover(&leftover,namenode);
+ continue;
+ }
+ if (isdirectoryinuse(namenode,pkg)) continue;
}
debug(dbg_eachfiledetail, "removal_bulk removing `%s'", fnvb.buf);
if (!rmdir(fnvb.buf) || errno == ENOENT || errno == ELOOP) continue;
@@ -350,6 +354,10 @@
* package which uses it. Other files should only be listed
* in this package (but we don't check).
*/
+ if (hasdirectoryconffiles(namenode,pkg)) {
+ push_leftover(&leftover,namenode);
+ continue;
+ }
if (isdirectoryinuse(namenode,pkg)) continue;
}
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]