Gentoo Archives: gentoo-portage-dev

From: Drake Wyrm <wyrm@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
Date: Wed, 20 Jul 2005 16:33:48
Message-Id: 20050720163238.GA22032@phaenix.haell.com
In Reply to: Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527) by Jason Stubbs
1 Jason Stubbs <jstubbs@g.o> wrote:
2 > On Wednesday 20 July 2005 15:38, Drake Wyrm wrote:
3 > > Jason Stubbs <jstubbs@g.o> wrote:
4 > > > When logging is enabled, ebuild output is passed via tee. Running
5 > > > anything that checks for terminal type inside of pkg_config
6 > > > therefore doesn't work correctly. This patch disables logging
7 > > > during pkg_config altogether.
8 > >
9 > > A cleaner way of accomplishing that is to write the ebuild such that
10 > > portions which need a terminal either attach to a terminal (`make
11 > > menuconfig </dev/tty >/dev/tty`)
12 >
13 > Forgive my ignorance, but how does this work when it comes to
14 > multiuser?
15
16 You mean when there's multiple terminals in use? The device "/dev/tty"
17 has more magic. No matter what terminal you're using, even if stdin,
18 stdout, and stderr have been closed or redirected, "/dev/tty" is
19 _always_ your current terminal.
20
21 { echo foo >/dev/tty ; } </dev/null &>/dev/null
22
23 Still gets through! Or even more detached:
24
25 ( ( sleep 2 ; echo foo >/dev/tty ) & disown ) </dev/null &>/dev/null
26
27 The only way this can fail is if the terminal actually closes.
28
29 ( ( sleep 2 ; echo foo >/dev/tty || touch /tmp/wombat ) & \
30 disown ) </dev/null &>/dev/null ; exit
31
32 Other apps use this, also. You may have noticed that when you drop to
33 shell from `less` and type `tty`, you're no longer attached to
34 /dev/pts/* or /dev/vc/*, but simply to /dev/tty. Do the same thing in
35 multiple xterms, and you'll find yourself with several terminals all
36 attached to unique instances of /dev/tty which have nothing to do with
37 each other. More magic.
38
39 --
40 Batou: Hey, Major... You ever hear of "human rights"?
41 Kusanagi: I understand the concept, but I've never seen it in action.
42 -- "Ghost in the Shell", Shirow Masamune

Replies