[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#723705: apt: Saves some downloaded packages under truncated filenames



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;
    }


The Eof check was added (by me of course) in
0aae6d14390193e25ab6d0fd49295bd7b131954f
as part of a fix up ~a month ago (at DebConf).

The idea is not that bad, but doesn't make that much sense either
as this bit is set by the FileFd based on Actual as well, so this is
basically doing the same check again – with the difference that the
HitEof bit can still linger from a previous Read we did at the end of the
file, but have seek'd away from it now (so as a fix for this we could just
as well fix the naming of zlib1g … ;) ).

The most interesting part will be writing a testcase for that…
(the rest of the commit doesn't look completely bulletproof either, mmh)


Best regards

David Kalnischkies


Reply to: