You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Stefan Miklosovic (Jira)" <ji...@apache.org> on 2022/11/15 18:58:00 UTC

[jira] [Comment Edited] (CASSANDRA-17832) Change bin/cqlsh.py shebang to use PATH with env prefix

    [ https://issues.apache.org/jira/browse/CASSANDRA-17832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17634485#comment-17634485 ] 

Stefan Miklosovic edited comment on CASSANDRA-17832 at 11/15/22 6:57 PM:
-------------------------------------------------------------------------

This is interesting

[https://ci-cassandra.apache.org/job/Cassandra-devbranch-artifacts/2024/jdk=jdk_1.8_latest,label=cassandra/console]



{code}
17:45:18 + PYTHON3=/usr/libexec/platform-python
17:45:18 + /usr/lib/rpm/redhat/brp-mangle-shebangs
17:45:18 *** ERROR: ambiguous python shebang in /usr/bin/cqlsh.py: #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
17:45:18 *** WARNING: ./usr/bin/stop-server is executable but has no shebang, removing executable bit
17:45:18 error: Bad exit status from /var/tmp/rpm-tmp.BcmUFB (%install)
17:45:18     Bad exit status from /var/tmp/rpm-tmp.BcmUFB (%install)
{code}


was (Author: smiklosovic):
This is interesting

https://ci-cassandra.apache.org/job/Cassandra-devbranch-artifacts/2024/jdk=jdk_1.8_latest,label=cassandra/console
*17:45:18* *** ERROR: ambiguous python shebang in /usr/bin/cqlsh.py: #!/usr/bin/env python. Change it to python3 (or python2) explicitly.*17:45:18* *** WARNING: ./usr/bin/stop-server is executable but has no shebang, removing executable bit*17:45:18* error: Bad exit status from /var/tmp/rpm-tmp.BcmUFB (%install)*17:45:18*     Bad exit status from /var/tmp/rpm-tmp.BcmUFB (%install)

> Change bin/cqlsh.py shebang to use PATH with env prefix
> -------------------------------------------------------
>
>                 Key: CASSANDRA-17832
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17832
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter
>            Reporter: Brad Schoening
>            Assignee: Brad Schoening
>            Priority: Low
>             Fix For: 4.x
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> For cqlsh.py this:
> #!/usr/bin/env python
> is preferable to the current hard coded /usr/bin/python3 which doesn't take into account the python interpreter preferences in the users PATH.  '{{{}env{}}}' is a system binary in {{/usr/bin}} that searches {{$PATH}} for strings containing the provided argument and returns the first instance it finds. In the above syntax, {{env}} will search for the first instance of {{python}} in {{$PATH}} and return it.
> This is aligned with the recommendations in [https://peps.python.org/pep-0394/]
> For example, on a MacOS:
>  
> {code:java}
> % /usr/bin/python3 --version
> Python 3.8.9.   (xcode python version)
> % /usr/bin/env python --version
> Python 3.10.6.  (brew python version)
> % python --version
> Python 3.10.6.   (default)
> {code}
> Thus, /usr/bin/python3 doesn't run the expected default python version
> Even the official Python tutorial uses the /usr/bin/env form of shebang: [https://docs.python.org/3/tutorial/interpreter.html]
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org