Package: apt Version: 0.7.16 Tags: patch When installing a large list of software on an newly installed lenny system, I often see apt hanging at the end of downloading.
While testing apt methods manually for the next bug report you will get in some minutes, I also found the methods not accepting my commands from the stdin typed in by terminal but just waiting indefinitely. This happens because the terminal gives the data line by line to the apt method and ReadMessages puts each line on its own into PartialMessages, so it never sees a \n\n in any of those, thus hanging indefinitly. This bug is fixed by the attached patch. I've not yet had the time to check (and with things only sometimes happening (though lately 3 times after each other) it will also be impossible to check if that also fixed the original problem, but I deem it highly likely that this bug can also cause problems with identical behaviour). Hochachtungsvoll, Bernhard R. Link
=== modified file 'apt-pkg/contrib/strutl.cc' --- apt-pkg/contrib/strutl.cc 2008-10-03 18:57:25 +0000 +++ apt-pkg/contrib/strutl.cc 2008-11-08 16:25:33 +0000 @@ -696,9 +696,11 @@ End += Res; // Look for the end of the message - for (char *I = Buffer; I + 1 < End; I++) + for (char *I = Buffer; I < End; I++) { - if (I[0] != '\n' || I[1] != '\n') + if (I == Buffer && I[0] == '\n' && PartialMessage[PartialMessage.length()-1] ) + PartialMessage = PartialMessage.substr(0, PartialMessage.length()-1); + else if (I[0] != '\n' || I == End || I[1] != '\n') continue; // Pull the message out