pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/51152: pkg_alternatives shebang to shebang interpreters failure



>Number:         51152
>Category:       pkg
>Synopsis:       pkg_alternatives via shebang won't continue and will use previous shell
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 18 19:55:00 +0000 2016
>Originator:     reed%reedmedia.net@localhost
>Release:        NetBSD 6.0_STABLE
>Organization:

>Environment:
Architecture: x86_64
Machine: amd64
>Description:
First saw this on a Darwin Kernel Version 15.0.0 system. OS X something.

I used the packages from Joyent. It includes pkg_alternatives.

I saw that running a script that has #!/opt/pkg/bin/python2 in the top
line resulted in bash errors like:
import: not found

I was able to reproduce with NetBSD and OS X with some simple scripts.
A #! interpreter cannot be another #! interpreter. It will just use
the same old shell and the second #! won't be used.

execve(2) manual on my old NetBSD says: "The interpreter named by
interpreter must not itself be an interpreter file."

And same thing in script(7) manual.

Note it says execution will fail. But it doesn't fail on NetBSD
nor OS X. It just uses the original interpreter.

This was discussed with jperkin on #pkgsrc IRC. Thanks!

My workaround will be to use specific python path and not the 
path to the pkg_alternatives wrapper.
>How-To-Repeat:
Use pkg_alternatives with a python2 (not python2.7 specific).
>Fix:
Rewrite pkg_alternatives to be a compiled binary instead
of using a sh interpreter.




Home | Main Index | Thread Index | Old Index