tech-userlevel archive

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

Re: make debugging output

On Tue, 28 Oct 2008, David Laight wrote:
> On Sat, Oct 18, 2008 at 11:57:46AM -0400, Steven M. Bellovin wrote:
> > > By default, make(1)'s debugging output goes to stdout.  Would it be OK
> > > to change the default to go to stderr?
> > 
> > I think that's reasonable, but with an important caveat: I think that
> > stdio should be set to be line-buffered in that case, to maintain
> > synchronization with debugging output.

What I did was: If any debugging flags are specified, then the debug
output is unbuffered and stdout is line buffered (unless stdout is the
debug output, in which case the previous rule takes precedence).  The
debug output is stderr by default.  If no debugging flags are specified,
then stdout retains its default buffering.

> Actually making the 'stdout' output of most of these tools line-buffered
> helps in other cases (eg when piped to tee, or written to a file that
> has tail runing on it).
> The cpu cost difference is probably immeasurable if any real work is
> being done.

I certainly wouldn't object if somebody went around and added
setlinebuf(stdout) in all tools whose stdout is used more for status
messages than for real work.

--apb (Alan Barrett)

Home | Main Index | Thread Index | Old Index