public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
@ 2005-07-19 14:31 Jason Stubbs
  2005-07-20  6:38 ` Drake Wyrm
  0 siblings, 1 reply; 7+ messages in thread
From: Jason Stubbs @ 2005-07-19 14:31 UTC (permalink / raw
  To: gentoo-portage-dev


[-- Attachment #1.1: Type: text/plain, Size: 395 bytes --]

http://bugs.gentoo.org/show_bug.cgi?id=99527

(I'm sick of writing my name so it can be asumed that I am the author unless
I put an author line ;)

When logging is enabled, ebuild output is passed via tee. Running anything
that checks for terminal type inside of pkg_config therefore doesn't work
correctly. This patch disables logging during pkg_config altogether.

-- 
Jason Stubbs

[-- Attachment #1.2: 99527_skip_config_logging.patch --]
[-- Type: text/x-diff, Size: 853 bytes --]

diff -uNr portage-2.0.51.22-r2/pym/portage.py portage-patched/pym/portage.py
--- portage-2.0.51.22-r2/pym/portage.py	2005-07-19 19:35:16.789904000 +0900
+++ portage-patched/pym/portage.py	2005-07-19 23:21:06.729902000 +0900
@@ -2608,7 +2608,10 @@
 		return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile)
 	elif mydo in ["prerm","postrm","preinst","postinst","config"]:
 		mysettings.load_infodir(pkg_dir)
-		return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile)
+		if mydo=="config":
+			return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1)
+		else:
+			return spawn(EBUILD_SH_BINARY+" "+mydo,mysettings,debug=debug,free=1,logfile=logfile)
 
 	try:
 		mysettings["SLOT"],mysettings["RESTRICT"] = db["/"]["porttree"].dbapi.aux_get(mycpv,["SLOT","RESTRICT"])

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
  2005-07-19 14:31 [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527) Jason Stubbs
@ 2005-07-20  6:38 ` Drake Wyrm
  2005-07-20 12:28   ` Jason Stubbs
  2005-08-08  6:58   ` Zac Medico
  0 siblings, 2 replies; 7+ messages in thread
From: Drake Wyrm @ 2005-07-20  6:38 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 928 bytes --]

Jason Stubbs <jstubbs@gentoo.org> wrote:
> When logging is enabled, ebuild output is passed via tee. Running
> anything that checks for terminal type inside of pkg_config therefore
> doesn't work correctly. This patch disables logging during pkg_config
> altogether.

There was a thread about this recently, and I'm almost certain that my
input was lost in the noise. A cleaner way of accomplishing that is to
write the ebuild such that portions which need a terminal either attach
to a terminal (`make menuconfig </dev/tty >/dev/tty`) or simply check
for a terminal (`tty -s || die "I need a terminal."`). I almost never
use the `ebuild ... config` feature, but just on general principle I'd
rather the logging capability remain intact.

-- 
Batou: Hey, Major... You ever hear of "human rights"?
Kusanagi: I understand the concept, but I've never seen it in action.
  -- "Ghost in the Shell", Shirow Masamune

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
  2005-07-20  6:38 ` Drake Wyrm
@ 2005-07-20 12:28   ` Jason Stubbs
  2005-07-20 16:32     ` Drake Wyrm
  2005-08-08  6:58   ` Zac Medico
  1 sibling, 1 reply; 7+ messages in thread
From: Jason Stubbs @ 2005-07-20 12:28 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]

On Wednesday 20 July 2005 15:38, Drake Wyrm wrote:
> Jason Stubbs <jstubbs@gentoo.org> wrote:
> > When logging is enabled, ebuild output is passed via tee. Running
> > anything that checks for terminal type inside of pkg_config therefore
> > doesn't work correctly. This patch disables logging during pkg_config
> > altogether.
> 
> There was a thread about this recently, and I'm almost certain that my
> input was lost in the noise.

On -dev? I missed (aka skimmed through) most of that.

> A cleaner way of accomplishing that is to write the ebuild such that
> portions which need a terminal either attach to a terminal
> (`make menuconfig </dev/tty >/dev/tty`)

Forgive my ignorance, but how does this work when it comes to multiuser?

> or simply check for a terminal (`tty -s || die "I need a terminal."`).

The problem with this is that the only way to get it to work would be to
disable logging anyway.

> I almost never use the `ebuild ... config` feature, but just on general
> principle I'd rather the logging capability remain intact.

Well, `emerge --config atom` was recently added (well, made useful to be
specific) and I'm king of hoping that the config functionality of ebuilds
will be excercised more in the future, so I'd agree it's important to do it
right.

-- 
Jason Stubbs

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
  2005-07-20 12:28   ` Jason Stubbs
@ 2005-07-20 16:32     ` Drake Wyrm
  2005-07-20 23:39       ` Jason Stubbs
  0 siblings, 1 reply; 7+ messages in thread
From: Drake Wyrm @ 2005-07-20 16:32 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

Jason Stubbs <jstubbs@gentoo.org> wrote:
> On Wednesday 20 July 2005 15:38, Drake Wyrm wrote:
> > Jason Stubbs <jstubbs@gentoo.org> wrote:
> > > When logging is enabled, ebuild output is passed via tee. Running
> > > anything that checks for terminal type inside of pkg_config
> > > therefore doesn't work correctly. This patch disables logging
> > > during pkg_config altogether.
> > 
> > A cleaner way of accomplishing that is to write the ebuild such that
> > portions which need a terminal either attach to a terminal (`make
> > menuconfig </dev/tty >/dev/tty`)
> 
> Forgive my ignorance, but how does this work when it comes to
> multiuser?

You mean when there's multiple terminals in use? The device "/dev/tty"
has more magic. No matter what terminal you're using, even if stdin,
stdout, and stderr have been closed or redirected, "/dev/tty" is
_always_ your current terminal.

	{ echo foo >/dev/tty ; } </dev/null &>/dev/null

Still gets through! Or even more detached:

	( ( sleep 2 ; echo foo >/dev/tty ) & disown ) </dev/null &>/dev/null

The only way this can fail is if the terminal actually closes.

	( ( sleep 2 ; echo foo >/dev/tty || touch /tmp/wombat ) & \
	disown ) </dev/null &>/dev/null ; exit

Other apps use this, also. You may have noticed that when you drop to
shell from `less` and type `tty`, you're no longer attached to
/dev/pts/* or /dev/vc/*, but simply to /dev/tty. Do the same thing in
multiple xterms, and you'll find yourself with several terminals all
attached to unique instances of /dev/tty which have nothing to do with
each other. More magic.

-- 
Batou: Hey, Major... You ever hear of "human rights"?
Kusanagi: I understand the concept, but I've never seen it in action.
  -- "Ghost in the Shell", Shirow Masamune

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
  2005-07-20 16:32     ` Drake Wyrm
@ 2005-07-20 23:39       ` Jason Stubbs
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Stubbs @ 2005-07-20 23:39 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]

On Thursday 21 July 2005 01:32, Drake Wyrm wrote:
> Jason Stubbs <jstubbs@gentoo.org> wrote:
> > On Wednesday 20 July 2005 15:38, Drake Wyrm wrote:
> > > Jason Stubbs <jstubbs@gentoo.org> wrote:
> > > > When logging is enabled, ebuild output is passed via tee. Running
> > > > anything that checks for terminal type inside of pkg_config
> > > > therefore doesn't work correctly. This patch disables logging
> > > > during pkg_config altogether.
> > > 
> > > A cleaner way of accomplishing that is to write the ebuild such that
> > > portions which need a terminal either attach to a terminal (`make
> > > menuconfig </dev/tty >/dev/tty`)
> > 
> > Forgive my ignorance, but how does this work when it comes to
> > multiuser?
> 
> You mean when there's multiple terminals in use? The device "/dev/tty"
> has more magic. No matter what terminal you're using, even if stdin,
> stdout, and stderr have been closed or redirected, "/dev/tty" is
> _always_ your current terminal.
> 
> 	{ echo foo >/dev/tty ; } </dev/null &>/dev/null
> 
> Still gets through! Or even more detached:
> 
> 	( ( sleep 2 ; echo foo >/dev/tty ) & disown ) </dev/null &>/dev/null
> 
> The only way this can fail is if the terminal actually closes.
> 
> 	( ( sleep 2 ; echo foo >/dev/tty || touch /tmp/wombat ) & \
> 	disown ) </dev/null &>/dev/null ; exit
> 
> Other apps use this, also. You may have noticed that when you drop to
> shell from `less` and type `tty`, you're no longer attached to
> /dev/pts/* or /dev/vc/*, but simply to /dev/tty. Do the same thing in
> multiple xterms, and you'll find yourself with several terminals all
> attached to unique instances of /dev/tty which have nothing to do with
> each other. More magic.

That works for me then. :)

--
Jason Stubbs

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
  2005-07-20  6:38 ` Drake Wyrm
  2005-07-20 12:28   ` Jason Stubbs
@ 2005-08-08  6:58   ` Zac Medico
  2005-08-08 11:59     ` Jason Stubbs
  1 sibling, 1 reply; 7+ messages in thread
From: Zac Medico @ 2005-08-08  6:58 UTC (permalink / raw
  To: gentoo-portage-dev

Drake Wyrm wrote:
> Jason Stubbs <jstubbs@gentoo.org> wrote:
> 
>>When logging is enabled, ebuild output is passed via tee. Running
>>anything that checks for terminal type inside of pkg_config therefore
>>doesn't work correctly. This patch disables logging during pkg_config
>>altogether.
> 
> 
> There was a thread about this recently, and I'm almost certain that my
> input was lost in the noise. A cleaner way of accomplishing that is to
> write the ebuild such that portions which need a terminal either attach
> to a terminal (`make menuconfig </dev/tty >/dev/tty`) or simply check
> for a terminal (`tty -s || die "I need a terminal."`). I almost never
> use the `ebuild ... config` feature, but just on general principle I'd
> rather the logging capability remain intact.
> 

Is this type of /dev/tty device functionality portable among all gentoo supported (non-Linux) operating systems?  This is a concern that comes to my mind.

Zac
-- 
gentoo-portage-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527)
  2005-08-08  6:58   ` Zac Medico
@ 2005-08-08 11:59     ` Jason Stubbs
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Stubbs @ 2005-08-08 11:59 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

On Monday 08 August 2005 15:58, Zac Medico wrote:
> Drake Wyrm wrote:
> > Jason Stubbs <jstubbs@gentoo.org> wrote:
> >>When logging is enabled, ebuild output is passed via tee. Running
> >>anything that checks for terminal type inside of pkg_config therefore
> >>doesn't work correctly. This patch disables logging during pkg_config
> >>altogether.
> >
> > There was a thread about this recently, and I'm almost certain that my
> > input was lost in the noise. A cleaner way of accomplishing that is to
> > write the ebuild such that portions which need a terminal either attach
> > to a terminal (`make menuconfig </dev/tty >/dev/tty`) or simply check
> > for a terminal (`tty -s || die "I need a terminal."`). I almost never
> > use the `ebuild ... config` feature, but just on general principle I'd
> > rather the logging capability remain intact.
>
> Is this type of /dev/tty device functionality portable among all gentoo
> supported (non-Linux) operating systems?  This is a concern that comes to
> my mind.

Good point. I often forget about 'those others'. ;)

By the way, you might want to drop by #gentoo-portage on irc.freenode.net 
sometime as a lot of discussion tends to happen there...

-- 
Jason Stubbs

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-08 12:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-19 14:31 [gentoo-portage-dev] PATCH: Disable logging during pkg_config (#99527) Jason Stubbs
2005-07-20  6:38 ` Drake Wyrm
2005-07-20 12:28   ` Jason Stubbs
2005-07-20 16:32     ` Drake Wyrm
2005-07-20 23:39       ` Jason Stubbs
2005-08-08  6:58   ` Zac Medico
2005-08-08 11:59     ` Jason Stubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox