Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 185930

Summary: emerge sends wget ouput to stderr
Product: Portage Development Reporter: Mark J. Olah <mjo>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: High    
Version: 2.1   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 181949, 187293    
Attachments: output of: emerge -quDN > /dev/null
direct all FETCHCOMMAND output to stdout

Description Mark J. Olah 2007-07-19 23:06:23 UTC
For the purposes of cron scripts I use the command:
/usr/bin/emerge -quND world > /dev/null

I would expect this to only leave me with the stderr output (regardless of the presence of the -q flag).  But I routinely get the output from some (not all?) of the wget commands portage executes.  No other extra output is observed.

I would expect that all of the output from wget should be directed to stdout.  Especially when the result of the wget command is successful.

I will attach sample output from the above command when run by cron.

-Mark
Comment 1 Mark J. Olah 2007-07-19 23:09:22 UTC
Created attachment 125395 [details]
output of: emerge -quDN > /dev/null
Comment 2 Andrew Gaffney (RETIRED) gentoo-dev 2007-07-19 23:13:20 UTC
This isn't a portage bug, per se. wget automatically sends the output to stderr.
Comment 3 Steve L 2007-07-19 23:22:29 UTC
You can try adding the -q option to FETCHCOMMAND and RESUMECOMMAND in make.conf. You can see the current values with portageq:
portageq envvar FETCHCOMMAND
/usr/bin/wget -t 5 -T 60 --passive-ftp -O ${DISTDIR}/${FILE} ${URI}
portageq envvar RESUMECOMMAND
/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O ${DISTDIR}/${FILE} ${URI}

I think this will work if you do:
export FETCHCOMMAND='/usr/bin/wget -q -t 5 -T 60 --passive-ftp -O ${DISTDIR}/${FILE} ${URI}'
export RESUMECOMMAND='/usr/bin/wget -q -c -t 5 -T 60 --passive-ftp -O ${DISTDIR}/${FILE} ${URI}'
/usr/bin/emerge -quND world > /dev/null

HTH.
Comment 4 Mark J. Olah 2007-07-19 23:28:35 UTC
Thanks for the suggestion Steve L.  I will try that.

However I still believe that this behavior is a bug.  The program is not as useful if extraneous information is being sent to stderr.  I'm sure anyone writing bash scripts to wrap emerge will run into all of this wget output where it shouldn't be.

I noticed in portage_exec.spawn(), the fd_pipes parameter can be used to redirect stderr to stdout for a particular command.  I realize this will of course redirect real wget errors to stdout too, but perhaps portage can send a message to stderr if the wget commmand's return status is an error.

-Mark
Comment 5 Zac Medico gentoo-dev 2007-07-21 04:22:29 UTC
Created attachment 125529 [details, diff]
direct all FETCHCOMMAND output to stdout

Thanks, this is fixed in svn r7331.
Comment 6 Zac Medico gentoo-dev 2007-07-22 22:56:21 UTC
This has been released in 2.1.3_rc9.