Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 43793 - some environment variables break gcc compile
Summary: some environment variables break gcc compile
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://gcc.gnu.org/bugzilla/show_bug....
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-05 04:46 UTC by Sascha Silbe
Modified: 2005-12-08 10:16 UTC (History)
0 users

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


Attachments
script of build attempt (update-gcc-3.3.2-r5.script,182.56 KB, text/plain)
2004-03-05 04:47 UTC, Sascha Silbe
Details
Build attempt of gcc-3.3.3-r6 on 2004-08-11 (bug43793-hardcopy-040811.bz2,15.73 KB, application/x-bzip)
2004-08-11 07:09 UTC, Sascha Silbe
Details
Output of "env" on the failing host (bug43793-env.txt,1.88 KB, text/plain)
2005-02-03 16:52 UTC, Sascha Silbe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Silbe 2004-03-05 04:46:13 UTC
When trying to update gcc from 3.2.3-r1 to 3.3.2-r5 on a simple rescue system, I get this error:

mkdir libgcc
if [ -f stmp-dirs ]; then true; else touch stmp-dirs; fi
./xgcc -B./ -B/usr/i586-pc-linux-gnu/bin/ -isystem /usr/i586-pc-linux-gnu/include -isystem /usr/i586-pc-linux-gnu/sys-include -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include  -fPIC -DHAVE_SYSLOG -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -D_LIBC_PROVIDES_SSP_ -I. -I. -I/var/tmp/portage/gcc-3.3.2-r5/work/gcc-3.3.2/gcc -I/var/tmp/portage/gcc-3.3.2-r5/work/gcc-3.3.2/gcc/. -I/var/tmp/portage/gcc-3.3.2-r5/work/gcc-3.3.2/gcc/config -I/var/tmp/portage/gcc-3.3.2-r5/work/gcc-3.3.2/gcc/../include  -DL_muldi3 -c /var/tmp/portage/gcc-3.3.2-r5/work/gcc-3.3.2/gcc/libgcc2.c -o libgcc/./_muldi3.o
/bin/sh: -c: line 1: syntax error near unexpected token `('
/bin/sh: -c: line 1: `( nm -pg libgcc/./_muldi3.o | gawk 'NF == 3 { print "\t.hidden", $3 }'; cat libgcc/() {  /bin/ls --color=auto --format=vertical "libgcc/./_muldi3.oS"'
make[3]: *** [libgcc/./_muldi3.oS] Error 2
make[3]: Leaving directory `/var/tmp/portage/gcc-3.3.2-r5/work/build/gcc'
make[2]: *** [libgcc.a] Error 2
make[2]: Leaving directory `/var/tmp/portage/gcc-3.3.2-r5/work/build/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/var/tmp/portage/gcc-3.3.2-r5/work/build/gcc'
make: *** [bootstrap-lean] Error 2

!!! ERROR: sys-devel/gcc-3.3.2-r5 failed.
!!! Function src_compile, Line 435, Exitcode 2
!!! (no error message)


The base system is fully up-to-date otherwise:

sphere / # emerge -Dpuv --nospinner system

These are the packages that I would merge, in order:

Calculating system dependencies  ...done!
[ebuild     U ] sys-devel/gcc-3.3.2-r5 [3.2.3-r1] -X -bootstrap -build -java -multilib +nls -nogcj -static  0 kB 

Total size of downloads: 0 kB




Reproducible: Always
Steps to Reproduce:
1. emerge -uv --nospinner gcc

Actual Results:  
See attached script for details.



Expected Results:  
Build gcc. :)



Portage 2.0.50-r1 (default-x86-1.4, gcc-3.2.3, glibc-2.3.2-r9, 2.4.24-sphere-2)
=================================================================
System uname: 2.4.24-sphere-2 i586 AMD-K6(tm) 3D processor
Gentoo Base System version 1.4.3.13
Autoconf: sys-devel/autoconf-2.58-r1
Automake: sys-devel/automake-1.7.7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -mcpu=k6 -funroll-loops -pipe"
CHOST="i586-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -mcpu=k6 -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://192.168.1.2/gentoo ftp://ftp.easynet.nl/mirror/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://192.168.1.1/gentoo-portage"
USE="acl apm berkdb crypt doc encode foomaticdb gdbm gif gtk gtk2 guile imap imlib ipv6 jpeg krb4 libg++ libwww mad maildir mbox mikmod mmx monitor mysql nas ncurses nls oggvorbis oss pam pdflib png postgres python readline samba skey spell ssl tetex tiff unicode x86 xml xml2 zlib"
Comment 1 Sascha Silbe 2004-03-05 04:47:05 UTC
Created attachment 26898 [details]
script of build attempt
Comment 2 Travis Tilley (RETIRED) gentoo-dev 2004-07-11 13:59:22 UTC
neither of those gcc versions are in portage anymore, please re-open this bug if the problem occurs with newer releases.
Comment 3 Sascha Silbe 2004-08-11 07:08:03 UTC
Still happens with gcc-3.3.3-r6.

Comment 4 Sascha Silbe 2004-08-11 07:09:19 UTC
Created attachment 37217 [details]
Build attempt of gcc-3.3.3-r6 on 2004-08-11
Comment 5 solar (RETIRED) gentoo-dev 2004-08-26 16:07:18 UTC
Please don't attach binary files. 
We ignore them.
Comment 6 Sascha Silbe 2004-08-28 07:01:03 UTC
It's just a bzip2-compressed text file. I don't want to waste bandwidth with files that have such a high redundancy (original: 186139 Bytes, bz2: 16105 Bytes => compress ratio 11:1).
If you really don't want to uncompress it yourself, tell me so and I'll attach it uncompressed.

Comment 7 Sascha Silbe 2004-09-13 10:06:10 UTC
I just was able to build gcc on that host.
After pruning the environment ("env - TERM=$TERM /bin/bash --login") it worked fine.
I'd suggest doing something similar within Portage, only exporting some known-"good" environment variables.

Comment 8 Jeremy Huddleston (RETIRED) gentoo-dev 2005-02-03 11:59:41 UTC
always attatch attatchments as text.  Uncompressing it wastes our time.

Pruning ${TERM} might be something for portage...
Comment 9 Sascha Silbe 2005-02-03 16:39:31 UTC
OK, I'll attach uncompressed text files in future. What's the maximum size deemed acceptable for attachments (I'll put bigger files on my homepage then)?
Comment 10 Sascha Silbe 2005-02-03 16:50:18 UTC
Portage should rather whitelist environment variables than blacklist them. Especially shell functions (e.g. "ls() { /bin/ls --color=auto "$@" ; }") might have unexpected and hard-to-debug effects.
The user can still set non-whitelisted env vars in /etc/portage/bashrc if (s)he really intends to do that (instead of having them set by accident).

It wasn't TERM that caused Portage to fail (as you can see above, I passed it through to Portage), but some other environment variable. I strongly suspect a shell function like the one given above, but didn't have time (it's a very slow host) to verify that.
Comment 11 Sascha Silbe 2005-02-03 16:52:57 UTC
Created attachment 50286 [details]
Output of "env" on the failing host

FWIW, these are the environment variables set in a root shell on that host.
Comment 12 Michael Haubenwallner (RETIRED) gentoo-dev 2005-06-28 02:15:58 UTC
The problem is the function 'dir()' - unset it, and it will work.
I've just filed a minor-bug with patch to gcc:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22213
Comment 13 SpanKY gentoo-dev 2005-12-02 16:40:02 UTC
do you use custom 'set' options to export functions to subshells ?
Comment 14 Sascha Silbe 2005-12-08 10:04:39 UTC
I just use export -f for those functions:

ls() { /bin/ls --color=auto "$@" ; }
ll() { /bin/ls -l "$@" ; }
dir() { /bin/ls --color=auto --format=vertical "$@" ; }
vdir() { /bin/ls --color=auto --format=long "$@" ; } 
ols() { /bin/ls "$@" ; }
export -f ls ll dir vdir ols

Comment 15 SpanKY gentoo-dev 2005-12-08 10:16:33 UTC
dont do that