24x-fi / pytox

Automatically exported from code.google.com/p/pytox
Other
1 stars 0 forks source link

jython executable path truncated when the absolute path is long #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

These shell commands will reproduce it on an Ubuntu x86/64 Linux machine.  
Making a long directory path like this triggers the behavior:

mkdir -p /tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py25/label
cd /tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py25/label
hg clone http://bitbucket.org/jpellerin/nose nose-unstable
cd nose-unstable/
tox -e jython_nodeps

What is the expected output? What do you see instead?

The installation step fails with this message in the log (notice how the jython 
executable path has been truncated) :

$ less 
/tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py25/label/nose-unst
able/.tox/jython_nodeps/log/1.log
/tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py25/label/nose-unst
able/.tox/jython_nodeps/log$ ../bin/pip install ../../dist/nose-0.11.2.dev.zip 
--download-cache=/tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py2
5/label/nose-unstable/.tox/_download >1.log
/usr/bin/env: 
/tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py25/label/nose-unst
able/.tox/jython_nodeps/bin/jyth: No such file or directory

What version of the product are you using? On what operating system?

$ tox --version
0.8 imported from /usr/local/lib/python2.6/dist-packages/tox/__init__.pyc

At first I used Jython 2.5.2 beta then downgraded to 2.5.1.  It made no 
difference.

Here are details about the machine I tested it on:

$ uname -a     
Linux ... 2.6.32-22-server #36-Ubuntu SMP Thu Jun 3 20:38:33 UTC 2010 x86_64 
GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.04.1 LTS
Release:        10.04
Codename:       lucid 

Please provide any additional information below.

I was able to confirm that it *does not* happen on Mac OS X.  Also, the path 
for Python binaries seems to work just fine at similar path lengths.

Strange bug!

Original issue reported on code.google.com by kumar.mcmillan on 19 Sep 2010 at 8:57

GoogleCodeExporter commented 8 years ago
I have a suspicion: The characters 

{{{
#!/usr/bin/env #!/usr/bin/env 
/tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py25/label/nose-unst
able/.tox/jython_nodeps/bin/jyth
}}}

are of length 128.  Seems like we are hitting a linux limitation: search for 
"127" in http://homepages.cwi.nl/~aeb/std/shebang/

Hudson tends to produce very long file system paths especially with 
multi-config projects.  This has hit me before (on windows i think). We could 
think about setting TOXDIR (the base dir in which all the envs/logs etc. are 
created) to somewhere more directly in the global tempdir.  We then might get a 
dangling garbage problem (killing the hudson workspace will not remove the 
global tmpfiles - and killing them always would remove the caching effect and 
makes debugging a failing job harder).

Or we could make tox issue a warning (on linux) if the path to a venv-bin dir 
is >=120 or so.

is there any (simple) solution you can think of? 

Original comment by holger.k...@gmail.com on 20 Sep 2010 at 8:14

GoogleCodeExporter commented 8 years ago
Ah, I see.  What if tox simply managed the $PATH variable then set the shebang 
to the executable?

i.e.
PATH=/tmp/fake-home-ci/jobs/workspace/nose-unstable-multi/TOXENV/py25/label/nose
-unstable/.tox/jython_nodeps/bin:${PATH}

#!/usr/bin/env jython

Otherwise, yeah, I think issuing a warning will at least help people to shorten 
names of directories and environment names.  That would be an easy fix.

Original comment by kumar.mcmillan on 20 Sep 2010 at 8:30

GoogleCodeExporter commented 8 years ago
managing PATH might work - it's not tox though that creates the shebang. It's 
setuptools, distribute or distutils (or all of them - don't ask me atm :).

This solution means tox would need to be careful when it calls (directly or 
indirectly) scripts because the she-bang paths to the interpreter would now 
depend on the current value of the PATH env variable.  Somehow linux accepting 
1024 bytes in shebangs sounds a lot more reasonable :)

The solution might work well enough though (and if in doubt we might make it 
configurable through a tox.ini option).

Original comment by holger.k...@gmail.com on 20 Sep 2010 at 8:42

GoogleCodeExporter commented 8 years ago
oh, rats, I see.  In that case it might best to issue a warning until one of us 
thinks of something better.

Original comment by kumar.mcmillan on 20 Sep 2010 at 8:45