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)
} else {
if(Debug == true)
std::clog << "rm " << DestFile << " # " << DescURI() << std::endl;
} else {
if(Debug == true)
std::clog << "rm " << DestFile << " # " << DescURI() << std::endl;
- if (RemoveFile("TransactionCommit", DestFile) == false)
+ if (RemoveFile("TransItem::TransactionCommit", DestFile) == false)
break;
case TransactionCommit:
if (EraseFileName.empty() == false)
break;
case TransactionCommit:
if (EraseFileName.empty() == false)
- RemoveFile("TransactionCommit", EraseFileName);
+ RemoveFile("AcqIndex::TransactionCommit", EraseFileName);
// methods like file:// give us an alternative (uncompressed) file
else if (Target.KeepCompressed == false && AltFilename.empty() == false)
{
// 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));
}
// 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
}
// 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
DestFile = "/dev/null";
}
DestFile = "/dev/null";
}
- if (EraseFileName.empty())
+ if (EraseFileName.empty() && Filename != AltFilename)
EraseFileName = Filename;
// queue uri for the next stage
EraseFileName = Filename;
// queue uri for the next stage
{
if (APT::String::Endswith(File, *ext) == true)
{
{
if (APT::String::Endswith(File, *ext) == true)
{
- std::string const unfile = File.substr(0, File.length() - ext->length() - 1);
+ std::string const unfile = File.substr(0, File.length() - ext->length());
if (stat(unfile.c_str(),&Buf) == 0)
{
AltRes.Size = Buf.st_size;
if (stat(unfile.c_str(),&Buf) == 0)
{
AltRes.Size = Buf.st_size;
exit
fi
chmod 555 aptarchive/dists/unstable/main/binary-all
exit
fi
chmod 555 aptarchive/dists/unstable/main/binary-all
-testsuccess aptget update
+testsuccess aptget update -o Debug::pkgAcquire::Worker=1
+cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output
+testsuccess grep '%0aAlt-Filename:%20' rootdir/tmp/update.output
# the release files aren't an IMS-hit, but the indexes are
redatereleasefiles '+1 hour'
# the release files aren't an IMS-hit, but the indexes are
redatereleasefiles '+1 hour'