Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 95786 - emerge fails silently no errors due to bash and ebuild.sh not sourcing correctly
Summary: emerge fails silently no errors due to bash and ebuild.sh not sourcing correctly
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-11 08:54 UTC by Jim Brown
Modified: 2005-06-17 10:28 UTC (History)
0 users

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


Attachments
emerge info (portage.info,1.75 KB, text/plain)
2005-06-11 08:55 UTC, Jim Brown
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Brown 2005-06-11 08:54:10 UTC
I installed portage onto a non-gentoo linux system. However, emerge will silently fail when attempting to install any package. All other functions of emerge (including emerge sync) worked fine. After much debugging, I was able to determine that the problem was due to ebuild.sh, and it was two-fold. First, I was using bash-2.04 (the one that came in a Redhat RPM), but this version of bash would attempt to execute EXPORT_FUNCTIONS() when ebuild.sh sourced in /var/tmp/portage/<package>/temp/environment - which caused EXPORT_FUNCTIONS() to immediately exit the shell (and thus end the ebuild) because ECLASS was unset. The reason why all ebuilds failed silently was because line 16 of ebuild.sh would send all output of the source to /dev/null, giving no chance for errors to be seen (I assume, to prevent showing errors about read-only variables). I fixed this by removing the '&> /dev/null' from line 16, 'source "${T}/environment" &> /dev/null' and then on line 1863, 'set | egrep -v "^SANDBOX_" > "${T}/environment" 2> /dev/null', I modified to a) grep out the read-only variables BASH_VERSIONINFO, EUID, PPID, EUID, and SHELLOPTS, and b) remove all shell function definitions (such as EXPORT_FUNCTIONS). The real fix was to emerge bash - for some reason gentoo's bash is not affected by this. However, portage and emerge should work even on non-gentoo linux distros, so this is clearly a portage bug. I was unable to find this bug elsewhere, despite extensive searching.

Reproducible: Always
Steps to Reproduce:
1. Install a bash shell from a Redhat 7.1 system.
2. Run 'emerge patch' or emerge some other package.
3.

Actual Results:  
Emerge would check the mdsums and unpack the package but it would finish there. It did not compile, install, or merge.

Expected Results:  
It should have continued to steps compiling, installing, and merging.

'emerge info' I think is not relevant here. However, it is included as an attachment.
(This affected portage 2.0.51.19 as well as 2.0.51.22)
Comment 1 Jim Brown 2005-06-11 08:55:22 UTC
Created attachment 61058 [details]
emerge info
Comment 2 Jakub Moc (RETIRED) gentoo-dev 2005-06-11 09:04:01 UTC
(In reply to comment #0)
> Steps to Reproduce:
> 1. Install a bash shell from a Redhat 7.1 system.

Huh??? Sorry, only Gentoo bugs go here, ask Red Hat why their bash from an
ancient and for ages unsupported distribution does not work with Gentoo portage.

> The real fix was to emerge bash - for some reason gentoo's bash is not
affected by this.

What a surprise... :)
Comment 3 Jim Brown 2005-06-11 13:40:57 UTC
It is a Portage bug. Portage should be able to work with different bash versions
and warn if the version of bash is too old. (As a side note, same version of
bash (2.04) but from a gentoo ebuild doesn't have this problem, so bash 2.04 is 
clearly not too "ancient".) Unless of course Portage requires gentoo bash
for gentoo-specific patches, but as far as I know this is not the case.

(Sorry for pointing out the obvious, but 'emerge bash' won't do the trick on
such a system either - that would silently fail before bash could be installed.)

This is easy enough to work around - as I explained, one merely needs to edit
ebuild.sh to strip the shell functions and read-only variables from the
temp environment file. (The code I used didn't work correctly, it sometimes
mangled other environment variables. That's the only reason I emerged gentoo's
bash.)
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2005-06-11 14:12:23 UTC
Portage explicitly depends on >=bash-2.05a and is not designed to run on RH 7.1.
That
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2005-06-11 14:12:23 UTC
Portage explicitly depends on >=bash-2.05a and is not designed to run on RH 7.1.
That´s about it. 
Comment 6 Jason Stubbs (RETIRED) gentoo-dev 2005-06-17 10:28:22 UTC
You're using an unsupported configuration so you're really on your own, but 
try to have all the dependencies that portage requires (such as >=bash-2.05a) 
before reopening and/or opening any other bug reports.