Bug#723705: apt: Saves some downloaded packages under truncated filenames
David Kalnischkies <kalnischkies+debian@gmail.com> (2013-09-19):
> On Thu, Sep 19, 2013 at 2:48 PM, Cyril Brulebois <kibi@debian.org> wrote:
> > Good luck fixing the scanner. :-)
>
> I have to test this a bit more, but I "fear" that could be the fix:
>
> diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
> index b91e868..e0802e3 100644
> --- a/apt-pkg/tagfile.cc
> +++ b/apt-pkg/tagfile.cc
> @@ -164,7 +164,7 @@ bool pkgTagFile::Fill()
> unsigned long long const dataSize = d->Size - ((d->End - d->Buffer) + 1);
> if (d->Fd.Read(d->End, dataSize, &Actual) == false)
> return false;
> - if (Actual != dataSize || d->Fd.Eof() == true)
> + if (Actual != dataSize)
> d->Done = true;
> d->End += Actual;
> }
That fixes the bug for that particular Packages.gz file indeed, thanks!
> The most interesting part will be writing a testcase for that…
> (the rest of the commit doesn't look completely bulletproof either, mmh)
Hmm, I think I'd make it possible to export all stanzas from that part
of apt (probably through the API, not necessarily from the command line);
then I'd compare what was read to what a different rfc822 parser would
have read. Throwing a few Packages.gz into the mix should ensure such
regression would be caught earl{y,ier}.
Mraw,
KiBi.
Reply to: