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: Generated shebang with path to python invalid if path contains spaces #2285

Merged
merged 2 commits into from
Oct 29, 2023
Merged

Conversation

ksshen0000
Copy link
Contributor

Pwntools Pull Request

Thanks for contributing to Pwntools! Take a moment to look at CONTRIBUTING.md to make sure you're familiar with Pwntools development.

Please provide a high-level explanation of what this pull request is for.

Testing

Pull Requests that introduce new code should try to add doctests for that code. See TESTING.md for more information.

Target Branch

Depending on what the PR is for, it needs to target a different branch.

You can always change the branch after you create the PR if it's against the wrong branch.

Branch Type of PR
dev New features, and enhancements
dev Documentation fixes and new tests
stable Bug fixes that affect the current stable branch
beta Bug fixes that affect the current beta branch, but not stable
dev Bug fixes for code that has never been released

Changelog

After creating your Pull Request, please add and push a commit that updates the changelog for the appropriate branch.
You can look at the existing changelog for examples of how to do this.

@peace-maker
Copy link
Member

This seems to assume Python 3 which might not be installed when using Python 2.

@ksshen0000
Copy link
Contributor Author

there is another option that is to create a softlink. But the website says python2 is deprecated

@peace-maker
Copy link
Member

We're still supporting python 2 installs right now though, so need to think of that.

Another way would be to ignore the shebang line and just add the sys.executable to the argv array directly.

Copy link
Member

@Arusekk Arusekk left a comment

Choose a reason for hiding this comment

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

Honestly I think it is okay to just always use python3; this is just a thin wrapper, so nothing bad should happen.

@peace-maker
Copy link
Member

I think your /usr/bin/env /path/with spaces/python suggestion is better, since it is fully backwards compatible. And I agree it should only be emitted if there are spaces in the sys.executable path.
#2271 (comment)

@Arusekk Arusekk changed the base branch from dev to stable October 29, 2023 14:13
@Arusekk Arusekk enabled auto-merge (squash) October 29, 2023 14:14
@Arusekk Arusekk merged commit 0c1121d into Gallopsled:stable Oct 29, 2023
15 of 21 checks passed
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.

Generated shebang with path to python invalid if path contains spaces
3 participants