On Fri, Aug 30, 2013 at 6:41 PM, Guillem Jover <[email protected]> wrote:
> Hi! > > [ Given the three variants, maybe this was sent by accident? Anyway. ] > On Fri, 2013-08-30 at 15:29:24 -0700, Shawn Landden wrote: > > This way a program reading from dpkg-query through a pipe will get the > > output in a single read() > > It would be good to know the motivation behind this. I'm guessing you are > finding some severe performance problem when dealing with the output? > > But I'd not merge something in this specific form, because it complicates > the code unnecessarily, and it's not using the available interfaces (like > ohshit[e], m_malloc, m_realloc, varbuf, etc) which avoid problems found > here such as memory leaks, unperformant string handling (strcat), etc. > > In any case I guess what you actually wanted might be something like > the attached patch, which switches stdout to be fully buffered in case > it's not a tty. If that'd help I guess I could consider adding code like > that to all commands, although conversely the problem then is that > programs reading from a pipe will not be able to process lines as they > come, and will stall on full buffers instead which might also slow > down the pipeline. > This would fix the issue I am running into. > > Thanks, > Guillem > -- --- Shawn Landden +1 360 389 3001 (SMS preferred)

