Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 390699 - emerge "Jobs: ..." xterm titles do not include hostname
Summary: emerge "Jobs: ..." xterm titles do not include hostname
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 381649
  Show dependency tree
 
Reported: 2011-11-16 04:00 UTC by Allen Parker
Modified: 2011-11-17 06:27 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
2 line patch that readds the hostname if it exists in the user (hostname_display.patch,546 bytes, text/plain)
2011-11-16 04:29 UTC, Allen Parker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Allen Parker 2011-11-16 04:00:53 UTC
Due to the --quiet-build=y default change, the hostname is no longer displayed/output during emerge. My suggestion would be to prepend it to self.xterm_titles in JobStatusDisplay.py

Reproducible: Always

Steps to Reproduce:
1. export HOSTNAME=$(hostname)
2. emerge foo -v --quiet-build=n (note xterm title)
3. emerge foo -qv (note xterm title)
Actual Results:  
$hostname: emerge: (1 of N) cat/pkg $action

Expected Results:  
Jobs: 0 of N complete, Load avg: N N N

$hostname: Jobs: 0 of N complete, Load avg: N N N
Comment 1 Allen Parker 2011-11-16 04:29:35 UTC
Created attachment 292735 [details]
2 line patch that readds the hostname if it exists in the user
Comment 2 Allen Parker 2011-11-16 04:30:11 UTC
Comment on attachment 292735 [details]
2 line patch that readds the hostname if it exists in the user

if $HOSTNAME exists in the users's environment, this 2 liner will display their hostname before "Jobs: "
Comment 3 Fabian Groffen gentoo-dev 2011-11-16 07:31:09 UTC
how about asking python for the hostname of the system, instead of relying on a environment variable?

sth like

from socket import gethostname
print gethostname()
Comment 4 Allen Parker 2011-11-16 07:33:18 UTC
(In reply to comment #3)
> how about asking python for the hostname of the system, instead of relying on a
> environment variable?
> 
> sth like
> 
> from socket import gethostname
> print gethostname()

KISS? not to mention, with my method, you can always overload the HOSTNAME variable to read whatever you want (which I've used to shorten hostnames on the fly).
Comment 5 Fabian Groffen gentoo-dev 2011-11-16 07:36:13 UTC
ok, put differently: your approach doesn't work on my configuration.

% echo $HOSTNAME
HOSTNAME: Undefined variable.

So your patch doesn't solve the problem.

It seems you want to configure an arbitrary prefix of the xterm title, which maybe goes better via make.conf then.
Comment 6 Allen Parker 2011-11-16 07:41:42 UTC
(In reply to comment #5)
> ok, put differently: your approach doesn't work on my configuration.
> 
> % echo $HOSTNAME
> HOSTNAME: Undefined variable.
> 
> So your patch doesn't solve the problem.
> 
> It seems you want to configure an arbitrary prefix of the xterm title, which
> maybe goes better via make.conf then.

1, read the source, portage expects you to define the $HOSTNAME variable if you're going to get the prepend, if you'd like to explore pym/_emerge/emergelog.py, you'll find that it's you that's broken, not my "arbitrary" use of the variable $HOSTNAME.

2, define $HOSTNAME and it'll work for you, or unset if you prefer NOT having it show up... it's defined on all of my systems. If you're confused about this, please see my first entry on this bug.
Comment 7 Fabian Groffen gentoo-dev 2011-11-16 15:09:21 UTC
No need to get rude.  If you found my suggestion offending, then I apologise for that.  It was meant informational only.
Comment 8 Zac Medico gentoo-dev 2011-11-16 15:22:19 UTC
I think socked.gethostname() would be good if we wanted this to be unconditional, but controlling it with the HOSTNAME environment variable is nice, since that way the hostname is omitted for people who don't care about it.

(In reply to comment #1)
> Created attachment 292735 [details]
> 2 line patch that readds the hostname if it exists in the user

If I'm not mistaken, this patch affects the "Jobs: ... Load Avg.." display that's shown on stdout (not just the xterm title). Was that intended?
Comment 9 Allen Parker 2011-11-16 15:52:48 UTC
(In reply to comment #8)
> I think socked.gethostname() would be good if we wanted this to be
> unconditional, but controlling it with the HOSTNAME environment variable is
> nice, since that way the hostname is omitted for people who don't care about
> it.
> 
> (In reply to comment #1)
> > Created attachment 292735 [details]
> > 2 line patch that readds the hostname if it exists in the user
> 
> If I'm not mistaken, this patch affects the "Jobs: ... Load Avg.." display
> that's shown on stdout (not just the xterm title). Was that intended?

Yup, I noticed that behavior from it. Nonetheless, the patch isn't expected to be perfect, it's expected to work in a short amount of time and be simple. If you want to add a FEATURES keyword to manage its behavior and make it integrated the way emergelog's xtermTitle is, that's your choice as the main dev for the package. I made it work, you can make it elegant ;)

Either way, without the steady migration towards --quiet-build=y, this behavioral oddity wouldn't have come to light: xterm titles are displayed no matter what if you don't have FEATURES=notitles. In the past you just had to live with build noise if you wanted the hostname displayed in the xterm title.
Comment 10 Zac Medico gentoo-dev 2011-11-16 16:16:31 UTC
(In reply to comment #9)
> Either way, without the steady migration towards --quiet-build=y, this
> behavioral oddity wouldn't have come to light: xterm titles are displayed no
> matter what if you don't have FEATURES=notitles. In the past you just had to
> live with build noise if you wanted the hostname displayed in the xterm title.

Oh, I understand why that is now. It's because JobStatusDisplay.display() returns early when self.quiet is True, which is how it behaves when all of the build output is being echoed to stdout.
Comment 11 Zac Medico gentoo-dev 2011-11-16 16:18:40 UTC
(In reply to comment #9)
> Yup, I noticed that behavior from it. Nonetheless, the patch isn't expected to
> be perfect, it's expected to work in a short amount of time and be simple. If
> you want to add a FEATURES keyword to manage its behavior and make it
> integrated the way emergelog's xtermTitle is, that's your choice as the main
> dev for the package. I made it work, you can make it elegant ;)

How about if I just make it omit the hostname from the stdout display? That way, the only change will be to the xterm titles, which is the thing that prompted you to file the bug in the first place.
Comment 12 Allen Parker 2011-11-16 16:20:28 UTC
(In reply to comment #11)
> How about if I just make it omit the hostname from the stdout display? That
> way, the only change will be to the xterm titles, which is the thing that
> prompted you to file the bug in the first place.

Sounds a-ok to me. Thanks.
Comment 14 Zac Medico gentoo-dev 2011-11-17 06:27:25 UTC
This is fixed in 2.1.10.35 and 2.2.0_alpha75.