From de81b2e20f80bb5f42034863a9a974c815a45da5 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 18 Oct 2014 17:48:55 +0200 Subject: aborted reverify restores file owner and permission If we get an IMS hit for an InRelease file we use the file we already have and pass it into reverification, but this changes the permissions and on abort of the transaction they weren't switched back. This is now done, additionally, every file in partial which hasn't failed gets permission and owner changed for root access as well, as it is very well possible that the next invocation will (re)use these files. --- apt-pkg/acquire-item.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 78402249c..9a6e0af01 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -246,7 +246,7 @@ void pkgAcquire::Item::QueueURI(ItemDesc &Item) /*{{{*/ if (RealFileExists(DestFile)) { std::string SandboxUser = _config->Find("APT::Sandbox::User"); - ChangeOwnerAndPermissionOfFile("GetPartialFileName", DestFile.c_str(), + ChangeOwnerAndPermissionOfFile("Item::QueueURI", DestFile.c_str(), SandboxUser.c_str(), "root", 0600); } Owner->Enqueue(Item); @@ -1570,6 +1570,10 @@ void pkgAcqMetaBase::AbortTransaction() if(FileExists(PartialFile)) Rename(PartialFile, PartialFile + ".FAILED"); } + // fix permissions for existing files which were part of a reverify + // like InRelease files or files in partial we might work with next time + else if (FileExists((*I)->DestFile)) + ChangeOwnerAndPermissionOfFile("AbortTransaction", (*I)->DestFile.c_str(), "root", "root", 0644); } Transaction.clear(); } -- cgit v1.2.3