Bug#426165: apt: Could use a blocking fd to read from the pipe from dpkg
Hi!
If I read the history correctly, then I see the following changes to code:
In 2005 a loop reading child process' (dpkg) output was added, together
with a call to usleep(1000) that slows an idle loop down. This was made
in https://salsa.debian.org/apt-team/apt/-/commit/75ef8f1417.
In 2006 this bug was reported.
In 2007 a call to select() was added in the loop to postpone read()
calls until more data from the child process is available. This was made
in https://salsa.debian.org/apt-team/apt/-/commit/090c656632. Notice
that select() was later replaced with pselect().
Also in 2007 the call to usleep() call in the loop was finally removed.
This was done in https://salsa.debian.org/apt-team/apt/-/commit/7fdafa0f34.
I didn't run reporter's test with powertop before 090c656632 or after
7fdafa0f34 so I don't know if/how much the problem was reduced. It would
be kind of difficult for me to install Debian's version from 2006 to
reproduce the issue in the original apt version.
Kamil
Reply to: