[Distutils] easy_install adds bad interpreter shebang to installed scripts

Phillip J. Eby pje at telecommunity.com
Wed Dec 17 23:29:12 CET 2008


At 10:17 PM 12/17/2008 +0100, Felix Schwarz wrote:
>Ian Bicking schrieb:
>>Does this work?
>>#!/usr/bin/env "/path/to/weird path/python"
>
>No (at least not for me).

Did you actually try that, as opposed to the version you showed 
before?  There *is* a difference.


>As far as I understand this, no kind of quoting or escaping will 
>work on whole shebang line because the kernel just splits the string 
>and passes them as arguments to the application.

You understand incorrectly; shebang parsing is platform dependent.  See:

http://www.in-ulm.de/~mascheck/various/shebang/

In particular, I just tested Linux (CentOS 4.3, to be precise) and 
found that this works:

#!/bin/env /path/witha/s pace/init

However, if I understand correctly, this would not work correctly on 
certain *BSD-derived operating systems, which would pass 
"/path/witha/s" and "pace/init" to env as separate arguments, instead 
of a single combined argument, thereby keeping it from working.

It seems that OS X would be a good place to test also, especially 
since IIRC it is *BSD-derived.



More information about the Distutils-SIG mailing list