Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shebang in netbox/manage.py #17838

Closed
xee8ai opened this issue Oct 23, 2024 · 2 comments · Fixed by #17840
Closed

Fix shebang in netbox/manage.py #17838

xee8ai opened this issue Oct 23, 2024 · 2 comments · Fixed by #17840
Assignees
Labels
netbox severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@xee8ai
Copy link
Contributor

xee8ai commented Oct 23, 2024

Deployment Type

Self-hosted

Triage priority

I volunteer to perform this work (if approved)

NetBox Version

v.4.1.4

Python Version

3.12

Steps to Reproduce

The shebang on netbox/manage.py is ambiguous.

Not really a bug but e.g. causing rpmbuild to stop with an error.

Expected Behavior

File netbox/manage.py starts with

#!/usr/bin/env python3

Observed Behavior

File netbox/manage.py starts with

#!/usr/bin/env python

@xee8ai xee8ai added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Oct 23, 2024
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: low Does not significantly disrupt application functionality, or a workaround is available and removed status: needs triage This issue is awaiting triage by a maintainer labels Oct 23, 2024
@jeremystretch
Copy link
Member

Thanks @xee8ai, I've assigned this to you.

@candlerb
Copy link
Contributor

File netbox/manage.py starts with

#!/usr/bin/env python

If the virtualenv is active, that will work just fine (python and python3 both exist in the venv).

If the virtualenv is inactive, then #!/usr/bin/env python3 will run the global python interpreter with the wrong libraries, and Bad Things™ will happen.

Personally, I'd suggest removing the shebang entirely, and well as the eXecute bit. Users can run it with:

/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py ...

and not worry about activating the virtualenv manually, or what directory they are in.

Alternatively, the shebang could be changed to #!/opt/netbox/venv/bin/python[3]

@jeremystretch jeremystretch added the netbox label Nov 1, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
netbox severity: low Does not significantly disrupt application functionality, or a workaround is available status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants