[Bug 297825] make(1): Re-enable the PTY support for child jobs when parallel option (-j N) is specified (fix colored-ness in BSD make in cmake and other projects)
| Newsgroups | gmane.os.freebsd.bugs |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297825
Bug ID: 297825
Summary: make(1): Re-enable the PTY support for child jobs when
parallel option (-j N) is specified (fix colored-ness
in BSD make in cmake and other projects)
Product: Base System
Version: 15.1-STABLE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: [email protected]
Reporter: [email protected]
Created attachment 274065
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=274065&action=edit
patch
==> Problem Description
cmake-based projects don't show colored logs when run with BSD make: make -j 10
GNU make doesn't have the same problem and shows colored logs in all cases
because GNU make sets MAKE_TERMOUT/MAKE_TERMERR environment variables when jobs
are not run with the real terminal which BSD make doesn't do. cmake understands
these variables and turns colors on.
==> Attempted Solutions in FreeBSD in the Past (2011, 2014)
This commit added PTY use to make:
commit 366cd46cbed467a69102d1315cf545f6dc487d60
Author: Max Khon <[email protected]>
Date: Wed Dec 14 19:13:23 2011
job make: if stdout is a tty create a pty when running a command.
This commit reverted reverted the above solution:
commit 94f176ebd4a1d7fc2c96218819e3775bed9619d9
Author: Max Khon <[email protected]>
Date: Wed Dec 14 22:25:19 2011
Revert r228521: sometimes job output is lost
(see tools/regression/usr.bin/make/execution/joberr test).
openpty(fd + 0, fd + 1,...) version does not have this problem but
it sometimes enters an infinite sleep in "ttywait" state in tty_drain()
when make(1) closes slave pty.
This commit then fixed the tty_drain:
commit 383f423be14a539990496fa9d9e818666234b1ec
Author: Marcel Moolenaar <[email protected]>
Date: Wed Oct 8 19:30:38 2014
Fix draining in ttydev_leave():
1. ERESTART is not only returned when the revoke count changed. It
is also returned when a signal is received. While a change in
the revoke count should be ignored, a signal should not.
2. Waiting until the output queue is entirely drained can cause a
hang when the underlying device is stuck or broken.
Have tty_drain() take care of this by telling it when we're leaving.
When leaving, tty_drain() will use a timed wait to address point 2
above and it will check the revoke count to handle point 1 above.
The timeout is set to 1 second, which is arbitrary and long enough
to expect a change in the output queue.
Discussed with: jilles@
Reported by: Yamagi Burmeister <[email protected]>
However the original solution has never been re-introduced in make(1).
Re-introducing it in the attached patch.
--
You are receiving this mail because:
You are the assignee for the bug.