Hello,
[please Cc replies to me as I'm not subscribed to the list]
in apt-cache.cc, function DisplayRecord, at the beginning there's code
that selects a pkgCache::VerFileIterator to use to get the information:
// Find an appropriate file
pkgCache::VerFileIterator Vf = V.FileList();
for (; Vf.end() == false; Vf++)
if ((Vf.File()->Flags & pkgCache::Flag::NotSource) == 0)
break;
if (Vf.end() == true)
Vf = V.FileList();
Therefore I'd expect the information to be read from Vf, and in fact the
code proceeds to open the file pointed by it:
// Check and load the package list file
pkgCache::PkgFileIterator I = Vf.File();
if (I.IsOk() == false)
return _error->Error(_("Package file %s is out of sync."),I.FileName());
FileFd PkgF(I.FileName(),FileFd::ReadOnly);
if (_error->PendingError() == true)
return false;
Now I'd expect the code to read information from PkgF using the offset
and size information found in Vf. However this does not happen, and
V.FileList() is used instead:
// Read the record and then write it out again.
unsigned char *Buffer = new unsigned char[GCache->HeaderP->MaxVerFileSize+1];
Buffer[V.FileList()->Size] = '\n';
if (PkgF.Seek(V.FileList()->Offset) == false ||
PkgF.Read(Buffer,V.FileList()->Size) == false ||
fwrite(Buffer,1,V.FileList()->Size+1,stdout) < (size_t)(V.FileList()->Size+1))
{
delete [] Buffer;
return false;
}
Instinct would suggest a s/V.FileList()/Vf/g in this last bit: doesn't
it fail if Vf was selected not to be the first iterator from
V.FileList() ? Or is there something I am missing?
Ciao,
Enrico
--
GPG key: 1024D/797EBFAB 2000-12-05 Enrico Zini <enrico@debian.org>
Attachment:
signature.asc
Description: Digital signature