I'm trying to execute python scripts automatically generated by zc.buildout so I don't have control over them. My problem is that the shebang line (#!) is too long for either bash (80 character limit) or direct execution (some Linux kernel constant I don't know).
This is an example script to help you reproduce my problem:
#!/././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././././bin/bash
echo Hola!
How can be bash or the kernel configured to allow for bigger shebang lines?
If you don't want to recompile your kernel to get longer shebang lines, you could write a wrapper:
and then run the script like:
wrapper.sh script.sh
Limited to 127 chars on 99.9% of systems due to kernel compile time buffer limit.
It's limited in the kernel by
BINPRM_BUF_SIZE
, set ininclude/linux/binfmts.h
.Updated @glenn jackman's script to support passing in command line arguments.
Incidentally, I ran into this problem when creating a python virtualenv inside of a very deep directory hierarchy.
In my case, this was a virtualenv created inside a Mesos framework dir.
The extra long shebang rendered calling
xxx/.../venv/bin/pip
useless.The wrapper script proved most useful.