Skip to content

Fix for cross-platform installation issues (macOS/Linux)#28

Open
0x3xplt1 wants to merge 1 commit intotarunkant:masterfrom
0x3xplt1:fix-cross-platform-python2-path
Open

Fix for cross-platform installation issues (macOS/Linux)#28
0x3xplt1 wants to merge 1 commit intotarunkant:masterfrom
0x3xplt1:fix-cross-platform-python2-path

Conversation

@0x3xplt1
Copy link

@0x3xplt1 0x3xplt1 commented Mar 2, 2026

On some systems (like macOS and certain Linux distributions), python2 is not located at the hardcoded path, which causes the tool to fail.

This pull request updates install.sh to dynamically locate the user's python2 environment and update the shebang in gopherus.py during installation. This makes the setup process completely cross-platform without needing to change the core Python code in the repository.

Copilot AI review requested due to automatic review settings March 2, 2026 17:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make installation work across macOS/Linux by avoiding a hardcoded Python 2 path, updating install.sh to rewrite gopherus.py’s shebang based on the user’s environment.

Changes:

  • Dynamically rewrites the first line (shebang) of gopherus.py during installation to point at the resolved python2 executable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,4 +1,5 @@
#!/bin/bash
sed "1s|.*|#!$(which python2)|" gopherus.py > tmp && mv tmp gopherus.py
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

This shebang rewrite can silently produce an invalid #! line when python2 is not on PATH (common on macOS where it may be python2.7 or not installed). It also relies on which (not POSIX) and uses a fixed temporary filename (tmp) that can collide with an existing file or be clobbered on reruns. Consider: (1) resolve the interpreter with command -v and fail fast with a clear error if not found (before modifying gopherus.py), optionally trying common fallbacks like python2.7; (2) use mktemp (and a trap/cleanup) for the temporary file; and (3) quote paths/variables to handle spaces safely.

Copilot uses AI. Check for mistakes.
Comment on lines 3 to 4
python2 -m pip install argparse
python2 -m pip install requests
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The python2 -m pip install argparse and python2 -m pip install requests commands fetch and execute third-party packages from PyPI without pinning versions or verifying integrity, which creates a supply-chain risk: if those packages (or the index) are compromised, arbitrary code can run during installation with the install user's privileges. To mitigate this, pin dependencies to specific versions (e.g., via a requirements.txt) and, where possible, enable hash-based verification so the installer only accepts known-good artifacts.

Copilot uses AI. Check for mistakes.
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.

2 participants