Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 96644 - tee construction in the spawn method will almost always return 0
Summary: tee construction in the spawn method will almost always return 0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Release Media
Classification: Unclassified
Component: Installer (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Gentoo Linux Installer
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-20 14:19 UTC by Steven Mertens
Modified: 2006-03-24 13:46 UTC (History)
0 users

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


Attachments
patch against GLIUtility.py.diff (GLIUtility.py.diff,2.06 KB, patch)
2005-06-20 14:19 UTC, Steven Mertens
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Mertens 2005-06-20 14:19:17 UTC
The tee construction in the spawn method (GLIUtility.py) will always return 0.

 <command> | tee <filename>

 => will always return 0 even if command fails, if the filename
    not exists it will return not 0

    but

  <command> | tee <filename> | tee /dev/tty8

  => will also always return 0 even if the filename not exists,
     will ofcourse return not 0 if tty is not writeable ...


I noticed this when a mount of a partition failed (still have to
trace that down).

The attached patch solves this problem and has the identical behaviour
as the current implementation. Although it will be a bit slower.
I tested this several times against installer-20050620 snapshot.

Feel free to do with it what you want. :)

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Steven Mertens 2005-06-20 14:19:48 UTC
Created attachment 61595 [details, diff]
patch against GLIUtility.py.diff

patch against GLIUtility.py.diff
Comment 2 Andrew Gaffney (RETIRED) gentoo-dev 2005-06-20 19:31:07 UTC
That is definitely a valid bug, but there's a much simpler solution:

cmd += "; exit $PIPESTATUS[0]"

before cmd is executed. That *should* return the exit code of the first process
in a series of pipes, and it's always for the last command run.
Comment 3 Andrew Gaffney (RETIRED) gentoo-dev 2005-06-20 20:01:14 UTC
After some discussion, it was decided your patch would work under more
circumstances. A modifed version (dropped the bit shifting stuff...that's what
exitsuccess() is for, commented out flush() calls for speed) has been applied.
Comment 4 Andrew Gaffney (RETIRED) gentoo-dev 2005-06-21 09:25:50 UTC
New code appears to be working...closing
Comment 5 Jeffrey Forman (RETIRED) gentoo-dev 2006-03-24 13:46:30 UTC
Moving to Release Media/Installer.