snare / voltron

A hacky debugger UI for hackers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove `sys.executable` from install.sh

nateozem opened this issue · comments

Using sys.executable is a problem because it's not reliable. From lldb of v360.99.0, it had changed how the property is being used by not returning the path to the "Python interpreter", but the path to the lldb executable itself.
Evidence from my system, below shows lldbs returns the path to python interpreter:

$ /Library/Developer/CommandLineTools/usr/bin/lldb -Qxb -o 'script import sys; print(sys.executable)'
(lldb) script import sys; print(sys.executable)
/usr/local/opt/python/bin/python2.7
$ /Applications/Xcode.app/Contents/Developer/usr/bin/lldb -Qxb -o 'script import sys; print(sys.executable)'
(lldb) script import sys; print(sys.executable)
/usr/local/opt/python/bin/python2.7
$ /usr/bin/lldb -Qxb -o 'script import sys; print(sys.executable)'
(lldb) script import sys; print(sys.executable)
/usr/local/opt/python/bin/python2.7
$ /usr/bin/lldb -Qxb -o 'script import sys; print(sys.executable)'
(lldb) script import sys; print(sys.executable)
/usr/local/opt/python/bin/python2.7

$ /usr/local/opt/python/bin/python2.7 --version
Python 2.7.13

But then this lldb does not:

$ /usr/local/opt/llvm/bin/lldb -Qxb -o 'script import sys; print(sys.executable)'
(lldb) script import sys; print(sys.executable)
/usr/local/opt/llvm/bin/lldb

To solidate the reason for doing this, here is a thread that mention the property of being uncertain of what value it should carried: https://mail.python.org/pipermail/python-dev/2006-March/062453.html.
It's hard to believe.

The only way I can think of is rerouting the logic for getting python executable by using sys.prefix or sys.exec_prefix. Any other suggestions or ideas are appreciated.