RFR: JDK-8024200 : (xxs) hgforest.sh fails to detect Python correctly if space after shebang

Dmitry Samersoff dmitry.samersoff at oracle.com
Wed Sep 4 21:44:53 UTC 2013


Mike,

This script probably will not work if first line of hg is

/usr/bin/env python

I would suggest just to ask python to print path to it self.

hpython=`sed -n -e '1 s,^[^/]*/,/,p' ${whichhg}`
python=`$hpython -c "import sys; print(sys.executable)"`

or at least check for env:

epython=
"`sed -n -e '1 s,^[^/]*/\(\([^/]\+/\)\+[^ \t]\+\).*$,/\1,p' ${whichhg}`"

bpython="`basename "$epython"`"

if [ "${bpython}" = "env" ]
then
 ...
fi

-Dmitry




On 2013-09-03 23:43, Mike Duigou wrote:
> Hello all;
> 
> This is a very small change to trim optional whitespace off of the interpreter directive which may appear in the hg wrapper script. The whitespace is legal per https://en.wikipedia.org/wiki/Shebang_%28Unix%29 and is now included in some distributions of mercurial (Ubuntu 13.04).
> 
> http://cr.openjdk.java.net/~mduigou/JDK-8024200/0/webrev/
> 
> Mike
> 
> 


-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.



More information about the build-dev mailing list