svn commit: r228157 - head/usr.bin/make

Max Khon fjoe at FreeBSD.org
Thu Dec 1 07:50:28 UTC 2011


Alexander,

On Thu, Dec 1, 2011 at 12:03 PM, Max Khon <fjoe at freebsd.org> wrote:

it would also be nice, if at some point, somebody could dive into the code
>>> to
>>> see why 'make buildkernel' will let clang produce coloured output, but
>>> 'make -j(N>1) buildkernel' doesn't (and why adding a -B switch to that
>>> command
>>> fixes it).
>>>
>>
>> This one is simple: job make (-jX) runs commands with stdin/stdout/stderr
>> redirected to pipes.
>> -B turns on compat mode for job make.
>>
>> This can be demonstrated by running make with -jX or -jX -B with the
>> following Makefile:
>> --- cut here ---
>> all:
>>         @if [ -t 1 ]; then echo "stdout is a tty"; else echo "stdout is
>> not a tty"; fi
>> --- cut here ---
>>
>> If you really want to see colored output in -jX case you should teach
>> clang to output ANSI color sequences not only in isatty(1) case, but also
>> when MAKE_JOBS_FIFO environment variable is present (it is set when make
>> runs in job mode).
>>
>
> This will not work for the cases when make(1) is itself redirected.
> Something like attached patch should work, but it blocks sometimes in
> "ttyout" state for some reason (needs more work).
>

It hangs when tty_drain() is called when make(1) closes slave pty. Looks
like a race condition there when tty_wait() is called from tty_drain().

If I exchange pty master and slave hangs disappear. So attached patch works
for me.
It may add performance penalty but I think that the impact will be
negligible.

Max
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpty2.diff
Type: text/x-patch
Size: 1197 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20111201/e64cd55c/openpty2.bin


More information about the svn-src-head mailing list