string FinalFile = _config->FindDir("Dir::State::lists")+URItoFileName(Desc.URI);
- /* Downloaded invalid transindex => Error (LP: #346386) (Closes: #195301) */
+ /* Downloaded invalid transindex => Error (LP: #346386) (Closes: #627642) */
indexRecords SubIndexParser;
if (FileExists(DestFile) == true && !SubIndexParser.Load(DestFile)) {
Status = StatError;
}
/* Verify the index file for correctness (all indexes must
- * have a Package field) (LP: #346386) (Closes: #195301) */
+ * have a Package field) (LP: #346386) (Closes: #627642) */
{
FileFd fd(DestFile, FileFd::ReadOnly);
pkgTagSection sec;
pkgTagFile tag(&fd);
- if (_error->PendingError() || !tag.Step(sec)) {
- Status = StatError;
- _error->DumpErrors();
- Rename(DestFile,DestFile + ".FAILED");
- return;
- } else if (!sec.Exists("Package")) {
- Status = StatError;
- ErrorText = ("Encountered a section with no Package: header");
- Rename(DestFile,DestFile + ".FAILED");
- return;
- }
+ // Only test for correctness if the file is not empty (empty is ok)
+ if (fd.Size() > 0) {
+ if (_error->PendingError() || !tag.Step(sec)) {
+ Status = StatError;
+ _error->DumpErrors();
+ Rename(DestFile,DestFile + ".FAILED");
+ return;
+ } else if (!sec.Exists("Package")) {
+ Status = StatError;
+ ErrorText = ("Encountered a section with no Package: header");
+ Rename(DestFile,DestFile + ".FAILED");
+ return;
+ }
+ }
}
// Done, move it into position
void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
{
#if 0
- /* Reject invalid, existing Release files (LP: #346386) (Closes: #195301)
+ /* Reject invalid, existing Release files (LP: #346386) (Closes: #627642)
* FIXME: Disabled; it breaks unsigned repositories without hashes */
if (!verify && FileExists(DestFile) && !MetaIndexParser->Load(DestFile))
{
RunScripts("APT::Update::Auth-Failure");
return;
} else if (LookupTag(Message,"Message").find("NODATA") != string::npos) {
- /* Invalid signature file, reject (LP: #346386) (Closes: #195301) */
+ /* Invalid signature file, reject (LP: #346386) (Closes: #627642) */
_error->Error(_("GPG error: %s: %s"),
Desc.Description.c_str(),
LookupTag(Message,"Message").c_str());