Просмотр исходного кода

dpkg: Remove filtered files on upgrade

Because the filtered file is left in the new file list, the code that
verifies if the old file is present (maybe with a different name) in
the new list matches the stat information. So we mark and treat filtered
files as if they were already not present on the file system.

Reported-by: Martin Pitt <martin.pitt@ubuntu.com>
Signed-off-by: Guillem Jover <guillem@debian.org>
Guillem Jover лет назад: 16
Родитель
Сommit
58b91fbb00
3 измененных файлов с 6 добавлено и 0 удалено
  1. 1 0
      src/archives.c
  2. 1 0
      src/filesdb.h
  3. 4 0
      src/processarc.c

+ 1 - 0
src/archives.c

@@ -626,6 +626,7 @@ int tarobject(struct TarInfo *ti) {
 
   if (filter_should_skip(ti)) {
     nifd->namenode->flags &= ~fnnf_new_inarchive;
+    nifd->namenode->flags |= fnnf_filtered;
     tarfile_skip_one_forward(ti);
 
     return 0;

+ 1 - 0
src/filesdb.h

@@ -71,6 +71,7 @@ struct filenamenode {
     fnnf_placed_on_disk=      000040, /* new file has been placed on the disk */
     fnnf_deferred_fsync =     000200,
     fnnf_deferred_rename =    000400,
+    fnnf_filtered =           001000, /* path being filtered */
   } flags; /* Set to zero when a new node is created. */
   const char *oldhash; /* valid iff this namenode is in the newconffiles list */
   struct stat *filestat;

+ 4 - 0
src/processarc.c

@@ -740,6 +740,10 @@ void process_archive(const char *filename) {
 	    "upgrade/downgrade", fnamevb.buf);
 
       for (cfile= newfileslist; cfile; cfile= cfile->next) {
+	/* If the file has been filtered then treat it as if it didn't exist
+	 * on the file system. */
+	if (cfile->namenode->flags & fnnf_filtered)
+	  continue;
 	if (!cfile->namenode->filestat) {
 	  struct stat tmp_stat;