Skip to content

common: support disabling python shebang rewriting#49886

Merged
classabbyamp merged 2 commits into
void-linux:masterfrom
classabbyamp:py-ver-ignore
Apr 24, 2024
Merged

common: support disabling python shebang rewriting#49886
classabbyamp merged 2 commits into
void-linux:masterfrom
classabbyamp:py-ver-ignore

Conversation

@classabbyamp

Copy link
Copy Markdown
Member

Ghidra's embedded jython contains scripts with shebangs like #!/usr/bin/env python. These seem to be designed to be run by jython, not the system python, and as such, they should not have their shebangs changed to #!/usr/bin/python2. This adds support for disabling that hook in cases like this.

Testing the changes

  • I tested the changes in this PR: YES

useful if there are special python-containing shebangs that should not
be rewritten, for example with Ghidra's embedded jython.

@ahesford ahesford left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like a good idea. We have several packages that ship example scripts that would probably be better left unmodified. During the next big Python bump, I'll try to remember to identify those and we can eliminate them from future update cycles.

@classabbyamp

classabbyamp commented Apr 18, 2024

Copy link
Copy Markdown
Member Author

example scripts that would probably be better left unmodified

maybe it would make sense to have this as a separate variable for patterns to ignore?

python_shebang_ignore="/usr/libexec/ghidra/Ghidra/Features/Python/data/jython-2.7.3/*"

for example

edit: with the current hook, I'm not sure I see a way to do this without massively increasing the time spent running the hook.

@fanyx

fanyx commented Apr 18, 2024

Copy link
Copy Markdown
Contributor

maybe it would make sense to have this as a separate variable for patterns to ignore?

python_shebang_ignore="/usr/libexec/ghidra/Ghidra/Features/Python/data/jython-2.7.3/*"

this solution feels very clean

@classabbyamp

Copy link
Copy Markdown
Member Author

maybe, but it would require checking every path against (multiple) globs, from what i can tell, which could be slow

@classabbyamp classabbyamp merged commit bf16ab2 into void-linux:master Apr 24, 2024
@classabbyamp classabbyamp deleted the py-ver-ignore branch April 24, 2024 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

xbps-src xbps-src related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants