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

Only rename StatError files in AbortTransaction()

This fixes a race that we see in travis when two copy operations
finish at about the same time but the bad one first. This lead to
a rename of the good one and triggers a error when apt tries to
verify the good version but can no longer find it.
Michael Vogt лет назад: 11
Родитель
Сommit
edd007cdfc
1 измененных файлов с 7 добавлено и 4 удалено
  1. 7 4
      apt-pkg/acquire-item.cc

+ 7 - 4
apt-pkg/acquire-item.cc

@@ -1545,10 +1545,13 @@ void pkgAcqMetaBase::AbortTransaction()
       if ((*I)->Status == pkgAcquire::Item::StatIdle)
          (*I)->Status = pkgAcquire::Item::StatDone;
 
-      // kill files in partial
-      std::string const PartialFile = GetPartialFileName(flNotDir((*I)->DestFile));
-      if(FileExists(PartialFile))
-         Rename(PartialFile, PartialFile + ".FAILED");
+      // kill failed files in partial
+      if ((*I)->Status == pkgAcquire::Item::StatError)
+      {
+         std::string const PartialFile = GetPartialFileName(flNotDir((*I)->DestFile));
+         if(FileExists(PartialFile))
+            Rename(PartialFile, PartialFile + ".FAILED");
+      }
    }
 }
 									/*}}}*/