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

Bug#341537: apt: Problem identified. [patch]



Package: apt
Version: 0.6.43.3
Followup-For: Bug #341537


First of all, I can confirm this bug.

Problem appears to be on
methods/gzip.cc
lines 110-124

Upon write failure on destination file, the method exits from reading
loop and proceeds to wait for gzip chils process to finish. But said
process will *not* finish, since it is blocked on a pipe write, thereby
deadlocking both processes.

Solution *should* be to close GzOut fd on line 113, before breaking out
of the loop. That should give the gzip process a SIGPIPE, killing it and
allowing the following wait to complete.

So, the following (untested) patch should work. Sorry, my current
machine is way too slow to try to compile and test.

----------------------------------------------
--- gzip.cc     2005-10-19 14:19:09.000000000 -0500
+++ gzip-fixed.cc       2006-05-19 17:50:27.000000000 -0500
@@ -111,6 +111,7 @@
       if (To.Write(Buffer,Count) == false)
       {
         Failed = true;
+        FromGz.Close();
         break;
       }
    }
----------------------------------------------

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable')
Architecture: i386 (i586)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.4.20
Locale: LANG=es_MX, LC_CTYPE=es_MX (charmap=ISO-8859-1)

Versions of packages apt depends on:
ii  libc6                       2.3.6-7      GNU C Library: Shared libraries
ii  libgcc1                     1:4.1.0-1+b1 GCC support library
ii  libstdc++6                  4.1.0-1+b1   The GNU Standard C++ Library v3

Versions of packages apt recommends:
ii  debian-archive-keyring        2006.01.18 GnuPG archive keys of the Debian a

-- no debconf information



Reply to: