Skip to content

Conversation

@shi-vaniparmar
Copy link

@shi-vaniparmar shi-vaniparmar commented May 27, 2025

This PR updates Python shebangs from:

#!/usr/bin/python
to:
#!/usr/bin/env python
Reason for Change
On RHEL 8 and RHEL 9, it is not permitted (and not recommended) to modify or symlink the platform-provided /usr/bin/python. This path is managed by the system and reserved for platform tooling.

To ensure consistent and portable execution of Python scripts across environments — without interfering with system Python — we:

  • Use /usr/bin/env python as a more flexible and version-agnostic shebang.

  • Recommend setting up custom Python symlinks in:

    • /usr/local/bin

    • ~/bin

This allows each environment to control which Python interpreter is used when invoking python, without relying on or modifying the system Python binary.

Benefits

  • Cross-version compatibility (RHEL 8/9)

  • Cleaner separation from platform Python

  • Easier integration with virtual environments or user-installed interpreters

Signed-off-by: Shivani Parmar <[email protected]>
@Bischoff
Copy link
Contributor

Bischoff commented May 27, 2025

Thanks for the PR @shi-vaniparmar .

On Ubuntu, I see this as the shebang, in the installed files (like /usr/bin/zvmsdk-getpchid):

#!/usr/bin/python3

and not

#!/usr/bin/python

as I can see in the source code.

I think that the shebang line gets modified by the "debian helper":

%: 
       dh $@ --with python3 --buildsystem=pybuild

I am not sure how this helper will behave with your changed shebang. I think it will just not care, but to be on the safe side, in theory, we should try to repackage the Ubuntu version with your change...

@Bischoff
Copy link
Contributor

Bischoff commented May 27, 2025

Also:

scripts/zvmsdk-gentoken uses #!/bin/python as shebang.

Maybe it would need to be modified as well.

Copy link
Contributor

@Bischoff Bischoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my 2 suggestions:

  • check that ubuntu packaging still works after shebang change
  • modify one more file in this PR

@aazam-gh
Copy link
Contributor

@shi-vaniparmar can you test the ubuntu packaging for this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants