| Summary: | dev-lang/python-2.6.5-r1 causes application failures due to GENTOO_PYTHON_WRAPPER_SCRIPT_PATH | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Fabian Groffen <grobian> |
| Component: | Current packages | Assignee: | Python Gentoo Team <python> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | normal | CC: | grobian |
| Priority: | High | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
(In reply to comment #0) > env GENTOO_PYTHON_WRAPPER_SCRIPT_PATH=/usr/bin/twistd ant It's not valid usage of this variable. Only wrapper scripts generated by python_generate_wrapper_scripts() are allowed to set this variable. This variable sets sys.argv[0] in target scripts and isn't inherited by child processes or by executables run by e.g. os.exec{l,v}*. Could you explain what you are trying to achieve? Example:
$ cat test1
#!/usr/bin/python
import os
import subprocess
import sys
print("test1: '%s'" % sys.argv)
test2 = subprocess.Popen(["./test2"] + sys.argv[1:], stdout=subprocess.PIPE)
sys.stdout.write(test2.stdout.read())
os.execv("./test3", sys.argv)
$ cat test2
#!/usr/bin/python
import sys
print("test2: '%s'" % sys.argv)
$ cat test3
#!/usr/bin/python
import sys
print("test3: '%s'" % sys.argv)
$ ./test1 arg1 arg2
test1: '['./test1', 'arg1', 'arg2']'
test2: '['./test2', 'arg1', 'arg2']'
test3: '['./test3', 'arg1', 'arg2']'
$ GENTOO_PYTHON_WRAPPER_SCRIPT_PATH=changed_arg0 ./test1 arg1 arg2
test1: '['changed_arg0', 'arg1', 'arg2']'
test2: '['./test2', 'arg1', 'arg2']'
test3: '['./test3', 'arg1', 'arg2']'
$
(In reply to comment #1) > (In reply to comment #0) > > env GENTOO_PYTHON_WRAPPER_SCRIPT_PATH=/usr/bin/twistd ant > > It's not valid usage of this variable. Only wrapper scripts generated by > python_generate_wrapper_scripts() are allowed to set this variable. This > variable sets sys.argv[0] in target scripts and isn't inherited by child > processes or by executables run by e.g. os.exec{l,v}*. > Could you explain what you are trying to achieve? I'm simply showing you how to reproduce the bug. In the environment of the buildbot slave GENTOO_PYTHON_WRAPPER_SCRIPT_PATH is set, and not because I set it myself. It simply broke my slaves, so they are still offline at the moment. I'm not sure how you prevent the var not to be inherited, as normal process forking copies the entire environment. (In reply to comment #3) > I'm simply showing you how to reproduce the bug. Could you show a valid command (with its output), which fails? (In case of /etc/init.d/buildslave, first remove --quiet option.) > I'm not sure how you prevent the var not to be inherited, as normal process > forking copies the entire environment. Py_Main() calls PySys_SetArgv() (before running Python code), which calls makeargvobject(), which unsets this variable. (pegathree:~) # qlist -Iv dev-lang/python buildbot
dev-lang/python-2.5.4-r2
dev-lang/python-2.6.5-r1
dev-lang/python-3.1.2-r1
dev-util/buildbot-0.7.12
(pegathree:~) # /etc/init.d/buildslave start
* Caching service dependencies ... [ ok ]
* Starting buildslave in /home/monet/buildbot/slave ... [ ok ]
(pegathree:monet/buildbot/slave) # tail twistd.log
2010-04-15 19:07:58+0200 [-] SlaveBuilder.commandComplete <buildbot.slave.commands.SlaveShellCommand instance at 0x22386c8>
2010-04-15 19:07:58+0200 [Broker,client] startCommand:shell [id 26106]
2010-04-15 19:07:58+0200 [Broker,client] ShellCommand._startCommand
2010-04-15 19:07:58+0200 [Broker,client] ./scripts/repoupdate Feb2010
2010-04-15 19:07:58+0200 [Broker,client] in dir /home/monet/buildbot/slave/x86_64-gentoolinux_Feb2010/build (timeout 1200 secs)
2010-04-15 19:07:58+0200 [Broker,client] watching logfiles {}
2010-04-15 19:07:58+0200 [Broker,client] argv: ['./scripts/repoupdate', 'Feb2010']
2010-04-15 19:07:58+0200 [Broker,client] environment: {'RC_SERVICE': '/etc/init.d/buildslave', 'LESSOPEN': '|lesspipe.sh %s', 'CVS_RSH': 'ssh', 'USER': 'monet', 'HOME': '/home/monet/buildbot/slave', 'EINFO_LASTCMD': 'eend', 'INFOPATH': '/usr/share/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.20.1/info:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/info', 'TERM': 'xterm-color', 'SHELL': '/bin/tcsh', 'SHLVL': '1', 'SVCNAME': 'buildslave', 'CONFIG_PROTECT_MASK': '/etc/gentoo-release /etc/sandbox.d /etc/env.d/java/ /etc/php/cli-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/terminfo /etc/ca-certificates.conf', 'GENTOO_PYTHON_WRAPPER_SCRIPT_PATH': '/usr/bin/twistd', 'MANPATH': '/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.20.1/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.3/man:/etc/java-config/system-vm/man/:/usr/lib64/php5/man/', 'CVSROOT': ':ext:c_o_monet@monetdb.cvs.sourceforge.net:/cvsroot/monetdb', 'ROOTPATH': '/opt/bin:/usr/x86_64-pc-linux-gnu/arm-gumstix-linux-uclibc/gcc-bin/4.4.0:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.3', 'PATH': '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/usr/x86_64-pc-linux-gnu/arm-gumstix-linux-uclibc/gcc-bin/4.4.0:/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.3', 'RC_SVCNAME': 'buildslave', 'RUBYOPT': '-rauto_gem', '_': '/sbin/start-stop-daemon', 'ANT_HOME': '/usr/share/ant', 'PWD': '/home/monet/buildbot/slave/x86_64-gentoolinux_Feb2010/build', 'EINFO_LOG': '/etc/init.d/buildslave', 'JAVACC_HOME': '/usr/share/javacc/'}
2010-04-15 19:07:58+0200 [Broker,client] closing stdin
2010-04-15 19:07:58+0200 [Broker,client] using PTY: False
As you can see, the buildbot gives the spawned process an environment including GENTOO_PYTHON_WRAPPER_SCRIPT_PATH. Is this valid enough for you?
Does example from comment #2 produce the same results for you? {pegathree:/var/tmp} fabian% chmod 744 test{1,2,3}
{pegathree:/var/tmp} fabian% ./test1 arg1 arg2
test1: '['./test1', 'arg1', 'arg2']'
test2: '['./test2', 'arg1', 'arg2']'
test3: '['./test3', 'arg1', 'arg2']'
{pegathree:/var/tmp} fabian% env GENTOO_PYTHON_WRAPPER_SCRIPT_PATH=changed_arg0 ./test1 arg1 arg2
test1: '['changed_arg0', 'arg1', 'arg2']'
test2: '['./test2', 'arg1', 'arg2']'
test3: '['./test3', 'arg1', 'arg2']'
{pegathree:/var/tmp} fabian%
however, /usr/bin/twistd seems to be a wrapper script
Arfrever: do you agree that bug #315919 is the same as this bug? *** This bug has been marked as a duplicate of bug 315919 *** |
Calling ant in a buildbot environment fails because GENTOO_PYTHON_WRAPPER_SCRIPT_PATH environment variable is not removed. The result is demonstrated below: {pegathree:~} fabian% qlist -Iv dev-lang/python dev-lang/python-2.5.4-r2 dev-lang/python-2.6.5-r1 dev-lang/python-3.1.2-r1 {pegathree:~} fabian% qlist -Iv eselect-python app-admin/eselect-python-20100321 {pegathree:~} fabian% ant Buildfile: build.xml does not exist! Build failed {pegathree:~} fabian% env GENTOO_PYTHON_WRAPPER_SCRIPT_PATH=/usr/bin/twistd ant Traceback (most recent call last): File "/usr/bin/twistd-2.6", line 19, in <module> run() File "/usr/lib64/python2.6/site-packages/twisted/scripts/twistd.py", line 27, in run app.run(runApp, ServerOptions) File "/usr/lib64/python2.6/site-packages/twisted/application/app.py", line 688, in run config.parseOptions() File "/usr/lib64/python2.6/site-packages/twisted/application/app.py", line 668, in parseOptions usage.Options.parseOptions(self, options) File "/usr/lib64/python2.6/site-packages/twisted/python/usage.py", line 217, in parseOptions self._dispatch[optMangled].dispatch(optMangled, arg) File "/usr/lib64/python2.6/site-packages/twisted/python/usage.py", line 54, in dispatch value = self.coerce(value) File "/usr/lib64/python2.6/site-packages/twisted/python/util.py", line 915, in gidFromString return grp.getgrnam(gidString)[2] KeyError: 'getgrnam(): name not found: JAVA_HOME' Error: No JDK found! Try using java-config script to set your JDK Remember that you need a JDK not a JRE {pegathree:~} fabian%