summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2019-11-27 19:57:08 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2019-11-27 21:56:33 +0100
commit62bfe5b6ca3ccfba6313d3f9ab4cb75a24a5557a (patch)
treea783495593357f4e08b8433d8e8bbe2229494115 /apt-pkg/acquire-item.cc
parentd88fb9fa233b1356c767d0183d91c821ee1ccd83 (diff)
Use correct filename on IMS-hit reverify for indices
If we have no old Release file, but old indices we can't compare hashsums with the new Release file and hence must request the indices again and have to react to IMS hits if they didn't change. We used to symlink the old index file to the partial directory, but that usually meant that we linked an uncompressed file to a compressed file, which not all uncompressors can deal with transparently resulting in strange failures. We could do without the symlink, but that would require changes in the codepaths dealing with failure as they would rename the file to FAILED.
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc17
1 files changed, 6 insertions, 11 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index a108eb213..062b39cad 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -3265,19 +3265,14 @@ void pkgAcqIndex::StageDownloadDone(string const &Message)
// we need to verify the file against the current Release file again
// on if-modfied-since hit to avoid a stale attack against us
- if(StringToBool(LookupTag(Message,"IMS-Hit"),false) == true)
+ if (StringToBool(LookupTag(Message, "IMS-Hit"), false))
{
- // copy FinalFile into partial/ so that we check the hash again
- string const FinalFile = GetExistingFilename(GetFinalFileNameFromURI(Target.URI));
- if (symlink(FinalFile.c_str(), DestFile.c_str()) != 0)
- _error->WarningE("pkgAcqIndex::StageDownloadDone", "Symlinking final file %s back to %s failed", FinalFile.c_str(), DestFile.c_str());
- else
- {
- EraseFileName = DestFile;
- Filename = DestFile;
- }
+ Filename = GetExistingFilename(GetFinalFileNameFromURI(Target.URI));
+ EraseFileName = DestFile = flCombine(flNotFile(DestFile), flNotDir(Filename));
+ if (symlink(Filename.c_str(), DestFile.c_str()) != 0)
+ _error->WarningE("pkgAcqIndex::StageDownloadDone", "Symlinking file %s to %s failed", Filename.c_str(), DestFile.c_str());
Stage = STAGE_DECOMPRESS_AND_VERIFY;
- Desc.URI = "store:" + Filename;
+ Desc.URI = "store:" + DestFile;
QueueURI(Desc);
SetActiveSubprocess(::URI(Desc.URI).Access);
return;