Issue2707

classification
Title: jython.py shebang line invalid on Linux
Type: crash Severity: normal
Components: Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: eaaltonen, jeff.allen
Priority: normal Keywords: test failure causes

Created on 2018-09-25.07:22:07 by jeff.allen, last changed 2018-11-04.16:05:34 by jeff.allen.

Files
File name Uploaded Description Edit Remove
python_noenv.sh eaaltonen, 2018-10-01.11:21:35
Messages
msg12121 (view) Author: Jeff Allen (jeff.allen) Date: 2018-09-25.07:22:06
jython.py appears broken on Linux by the shebang line:

#!/usr/bin/env python2.7 -E

This doesn't work because a shebang is not processed like a shell command (see https://unix.stackexchange.com/questions/63979/shebang-line-with-usr-bin-env-command-argument-fails-on-linux). env receives everything after the space as one argument and you get the message that it cannot find the file "python2.7 -E".

An option -S (--split-string) is documented that addresses the problem, but it doesn't work on my Linux system. I could maybe install a later env, but then it will fail for anyone who hasn't done that with "invalid option -- 'S'".

This mostly does not show in a development environment because dist/bin/jython means the shell script version, but it fails in tests that explicitly ask for jython.py (test_jython_launcher).
msg12123 (view) Author: Jeff Allen (jeff.allen) Date: 2018-09-27.07:25:18
Assuming env is there for a good reason, and it has to work across Unix-like OSes, I don't see any better course of action than to remove the -E.
https://hg.python.org/jython/rev/38824a8816a8

Insulation from the environment is desirable(why not -S or -s too?) but until there's a "system python" we can't get it like this.

We don't see this failure on the CI because the test_jython_launcher does not run. (Not sure why.)
msg12130 (view) Author: (eaaltonen) Date: 2018-10-01.11:21:35
You can get the "-E" option if you don't mind calling an intermediate script to do so. The attached python_noenv.sh should do the job (more or less).
msg12137 (view) Author: Jeff Allen (jeff.allen) Date: 2018-10-13.17:10:18
It crossed my mind to add further layer of wrapping, but I thought I'd wait to see if there was an actual problem.
History
Date User Action Args
2018-11-04 16:05:34jeff.allensetstatus: pending -> closed
2018-10-13 17:10:18jeff.allensetmessages: + msg12137
2018-10-01 11:21:36eaaltonensetfiles: + python_noenv.sh
nosy: + eaaltonen
messages: + msg12130
2018-09-27 07:25:19jeff.allensetstatus: open -> pending
assignee: jeff.allen
resolution: fixed
messages: + msg12123
2018-09-25 07:22:07jeff.allencreate