Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 253467 - sys-apps/portage-2.2_rc17: emerge should sanitize environment before starting
Summary: sys-apps/portage-2.2_rc17: emerge should sanitize environment before starting
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
: 275494 (view as bug list)
Depends on:
Blocks: 210077
  Show dependency tree
 
Reported: 2009-01-02 20:57 UTC by DEMAINE Benoît-Pierre, aka DoubleHP
Modified: 2010-07-04 15:56 UTC (History)
1 user (show)

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


Attachments
fix $A leakage (env_blacklist.patch,1.22 KB, patch)
2009-01-04 02:56 UTC, Zac Medico
Details | Diff
/tmp/emerge--info (emerge--info,12.04 KB, text/plain)
2009-06-28 16:11 UTC, DEMAINE Benoît-Pierre, aka DoubleHP
Details
fix regression in blacklist handling (env_blacklist.patch,436 bytes, patch)
2009-06-28 21:02 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description DEMAINE Benoît-Pierre, aka DoubleHP 2009-01-02 20:57:35 UTC
I did

********************************************************************

moon-gen-3 ~ # emerge app-portage/eix

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] app-portage/eix-0.15.2  USE="doc -sqlite" 268 kB

Total: 1 package (1 new), Size of downloads: 268 kB
[...]
 * checking miscfile checksums ;-) ...                                                                                     [ ok ]
>>> Unpacking source...
>>> Unpacking /media/arch_longtime/arch_2009_01_01_part_only_moon-gen-3_and_home_and_hosts to /var/tmp/portage/app-portage/eix-0.15.2/work
 *
 * ERROR: app-portage/eix-0.15.2 failed.
 * Call stack:
 *               ebuild.sh, line   49:  Called src_unpack
 *             environment, line  757:  Called _eapi0_src_unpack
 *               ebuild.sh, line  588:  Called unpack '/media/arch_longtime/arch_2009_01_01_part_only_moon-gen-3_and_home_and_hosts'
 *               ebuild.sh, line  349:  Called die
 * The specific snippet of code:
 *                      die "Arguments to unpack() cannot be absolute"
 *  The die message:
 *   Arguments to unpack() cannot be absolute
 *
 * If you need support, post the topmost build error, and the call stack if relevant.
 * A complete build log is located at '/var/log/portage/app-portage:eix-0.15.2:20090102-203751.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-portage/eix-0.15.2/temp/environment'.
 *

>>> Failed to emerge app-portage/eix-0.15.2, Log file:

>>>  '/var/log/portage/app-portage:eix-0.15.2:20090102-203751.log'
moon-gen-3 ~ # ls /media/
DHP_TEL_2G  arch_longtime
moon-gen-3 ~ # ls /media/arch_longtime/
moon-gen-3 ~ # echo $S
/media/arch_longtime
moon-gen-3 ~ # echo $A
/media/arch_longtime/arch_2009_01_01_part_only_moon-gen-3_and_home_and_hosts
moon-gen-3 ~ #

***********************************************************

Took me a few seconds to understand what was going on.

/media/arch... is my backup drive, and, the location of the backup directory is stored in an exported variable.

In short, I previously ran by backup script that exported
A=/media/arch_longtime/arch_2009_01_01_part_only_moon-gen-3_and_home_and_hosts
in my console and now this is causing side effect on emerge.

=> whatever the environment is, emerge should satanise this kind of variables before doing his stuff.

This bug may be a dup of an other one i saw long time ago about satanisation. I just don't find it again.

Of course, the WA is trivial: export -n A

But, it would be nicer, and even "more secure" if emerge had satanise all variables he needs before starting up. Error was obvious, because I used A to store a path; it would have been way less obvious if I used it to store ebuild names ...
Comment 1 DEMAINE Benoît-Pierre, aka DoubleHP 2009-01-03 01:28:33 UTC
Sorry for misspell :'( I knew something was wrong :/
Comment 2 Zac Medico gentoo-dev 2009-01-04 02:56:10 UTC
Created attachment 177303 [details, diff]
fix $A leakage

If this patch is saved as /tmp/env_blacklist.patch, then it can be applied as follows:

  patch /usr/lib/portage/pym/portage/__init__.py /tmp/env_blacklist.patch
Comment 3 DEMAINE Benoît-Pierre, aka DoubleHP 2009-01-04 03:07:45 UTC
is $A the only leaking one ? I did not test the other ones, but from memory, portage internally uses at least 8 variables ... i don't find the list, but from memory: $S $T $D ... may also be affected the same way IMHO.

Zac, do you want me to test the patch ?
Comment 4 Zac Medico gentoo-dev 2009-01-04 03:30:44 UTC
I already tested the patch, so you don't have to. Because of various quirks in the portage code most other variables aren't affected the same way that $A was. Anyway, I'll go ahead and add the rest to the blacklist for conistency's sake.
Comment 5 DEMAINE Benoît-Pierre, aka DoubleHP 2009-01-04 03:33:54 UTC
I fell on that one with badluck. Reading various ebuild, I also find, possibly $P $PV $T ... I don't have enough experience to give you a nice list. I just say that if I could trigger $A, other ones *could* be.

Good luck.
Comment 6 Zac Medico gentoo-dev 2009-01-12 20:14:39 UTC
This is fixed in 2.1.6.5 and 2.2_rc21.
Comment 7 DEMAINE Benoît-Pierre, aka DoubleHP 2009-02-08 19:55:55 UTC
Fixed, verified, closing.
Comment 8 Zac Medico gentoo-dev 2009-06-28 07:45:18 UTC
*** Bug 275494 has been marked as a duplicate of this bug. ***
Comment 9 Kobboi 2009-06-28 16:04:58 UTC
Still encountering this with fo example: export A=3; emerge -1 nano (see bug 275494).

Portage 2.1.6.13 (default/linux/x86/2008.0/desktop, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.30 i686)
=================================================================
System uname: Linux-2.6.30-i686-Intel-R-_Core-TM-2_Duo_CPU_T7100_@_1.80GHz-with-glibc2.0
Timestamp of tree: Sun, 28 Jun 2009 11:30:16 +0000
distcc 3.1 i686-pc-linux-gnu [disabled]
ccache version 2.4 [disabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 2.1.7
dev-lang/python:     2.5.4-r2
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.6.4
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r5
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.4
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=prescott -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=prescott -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="C"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/gnome /usr/local/portage/layman/x11 /usr/local/portage/layman/sunrise /usr/local/portage/layman/sabayon /home/christophe/Thomson/automation/automation/AutoDistro/Overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl acpi alsa berkdb bluetooth branding bzip2 cairo cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode esd evo fam fortran gdbm gif gnome gpm gstreamer gtk hal iconv ipv6 isdnlog jpeg kde ldap libnotify mad midi mikmod mmx mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl png ppds pppd pulseaudio python qt3 qt3support qt4 quicktime readline reflection samba sdl session spell spl sse sse2 ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vorbis x86 xcb xml xorg xulrunner xv zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="intel"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 10 DEMAINE Benoît-Pierre, aka DoubleHP 2009-06-28 16:10:40 UTC
Also reproductible again for 2.2_rc33 .
Comment 11 DEMAINE Benoît-Pierre, aka DoubleHP 2009-06-28 16:11:20 UTC
Created attachment 195953 [details]
/tmp/emerge--info
Comment 12 Zac Medico gentoo-dev 2009-06-28 21:02:37 UTC
Created attachment 195997 [details, diff]
fix regression in blacklist handling

This is fixed in svn r13730.
Comment 13 Zac Medico gentoo-dev 2009-08-03 23:00:44 UTC
This is fixed in 2.2_rc34.
Comment 14 DEMAINE Benoît-Pierre, aka DoubleHP 2009-09-22 09:04:55 UTC
I don't know about 2.1 branch, but 2.2 is now OK for me. Jumped from 2.2_rc33 to 2.2_rc41 and it's working fine. At least for variable $A :) 
Comment 15 DEMAINE Benoît-Pierre, aka DoubleHP 2010-07-04 15:56:29 UTC
see bug 326887