From owner-svn-src-head@FreeBSD.ORG Thu Dec 1 07:50:28 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 621C5106566B; Thu, 1 Dec 2011 07:50:28 +0000 (UTC) (envelope-from fjoe@samodelkin.net) Received: from mail-qw0-f47.google.com (mail-qw0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id CD0618FC13; Thu, 1 Dec 2011 07:50:27 +0000 (UTC) Received: by qaea17 with SMTP id a17so4368468qae.13 for ; Wed, 30 Nov 2011 23:50:27 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.34.13 with SMTP id j13mr971101qcd.248.1322725826959; Wed, 30 Nov 2011 23:50:26 -0800 (PST) Sender: fjoe@samodelkin.net Received: by 10.229.47.194 with HTTP; Wed, 30 Nov 2011 23:50:26 -0800 (PST) X-Originating-IP: [93.92.220.178] In-Reply-To: References: <201111301807.pAUI7cXI008371@svn.freebsd.org> <20111201001646.GA49249@freebsd.org> Date: Thu, 1 Dec 2011 14:50:26 +0700 X-Google-Sender-Auth: iCkeiL6wJdfLo7HV7Np28PDN_h0 Message-ID: From: Max Khon To: Alexander Best Content-Type: multipart/mixed; boundary=00163683411e0d1bb904b3031b21 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228157 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2011 07:50:28 -0000 --00163683411e0d1bb904b3031b21 Content-Type: text/plain; charset=ISO-8859-1 Alexander, On Thu, Dec 1, 2011 at 12:03 PM, Max Khon 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 --00163683411e0d1bb904b3031b21 Content-Type: text/x-patch; charset=US-ASCII; name="openpty2.diff" Content-Disposition: attachment; filename="openpty2.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gvngppto1 SW5kZXg6IHVzci5iaW4vbWFrZS9NYWtlZmlsZQo9PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSB1c3IuYmluL21ha2Uv TWFrZWZpbGUJKHJldmlzaW9uIDIyODE1NykKKysrIHVzci5iaW4vbWFrZS9NYWtlZmlsZQkod29y a2luZyBjb3B5KQpAQCAtNyw2ICs3LDggQEAKIFNSQ1M9CWFyY2guYyBidWYuYyBjb25kLmMgZGly LmMgZm9yLmMgaGFzaC5jIGhhc2hfdGFibGVzLmMgam9iLmMJXAogCWxzdC5jIG1haW4uYyBtYWtl LmMgcGFyc2UuYyBwcm9jLmMgc2hlbGwuYyBzdHIuYyBzdWZmLmMgdGFyZy5jCVwKIAl1dGlsLmMg dmFyLmMKK0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