summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-04-14 16:01:56 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-04-14 16:15:39 +0200
commite169fa4a85e03b2b03bb1bdba716b96654ae6050 (patch)
tree5f7ceadd6f2b10091d4731577c4b444e9805e3b0 /apt-pkg/acquire-item.cc
parentc75e60ebb6bc7a578b57e7c4e01579798bae720b (diff)
fix Alt-Filename handling of file method
A silly of-by-one error in the stripping of the extension to check for the uncompressed filename broken in an attempt to support all compressions in commit a09f6eb8fc67cd2d836019f448f18580396185e5. Fixing this highlights also mistakes in the handling of the Alt-Filename in libapt which would cause apt to remove the file from the repository (if root has the needed rights – aka the disk isn't readonly or similar)
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index b2e578629..0569c6dda 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -437,7 +437,7 @@ bool pkgAcqTransactionItem::TransactionState(TransactionStates const state)
} else {
if(Debug == true)
std::clog << "rm " << DestFile << " # " << DescURI() << std::endl;
- if (RemoveFile("TransactionCommit", DestFile) == false)
+ if (RemoveFile("TransItem::TransactionCommit", DestFile) == false)
return false;
}
break;
@@ -470,7 +470,7 @@ bool pkgAcqIndex::TransactionState(TransactionStates const state)
break;
case TransactionCommit:
if (EraseFileName.empty() == false)
- RemoveFile("TransactionCommit", EraseFileName);
+ RemoveFile("AcqIndex::TransactionCommit", EraseFileName);
break;
}
return true;
@@ -2748,9 +2748,8 @@ void pkgAcqIndex::StageDownloadDone(string const &Message)
// methods like file:// give us an alternative (uncompressed) file
else if (Target.KeepCompressed == false && AltFilename.empty() == false)
{
- if (CurrentCompressionExtension != "uncompressed")
- DestFile.erase(DestFile.length() - (CurrentCompressionExtension.length() + 1));
Filename = AltFilename;
+ EraseFileName.clear();
}
// Methods like e.g. "file:" will give us a (compressed) FileName that is
// not the "DestFile" we set, in this case we uncompress from the local file
@@ -2780,7 +2779,7 @@ void pkgAcqIndex::StageDownloadDone(string const &Message)
DestFile = "/dev/null";
}
- if (EraseFileName.empty())
+ if (EraseFileName.empty() && Filename != AltFilename)
EraseFileName = Filename;
// queue uri for the next stage