-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: isolate PyInstaller library paths for subprocess calls #8628
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
base: develop
Are you sure you want to change the base?
Conversation
When SAM CLI runs from the native installer (PyInstaller-based), it sets LD_LIBRARY_PATH/DYLD_LIBRARY_PATH to include bundled libraries. This causes conflicts when spawning external processes like npm, node, or pip that need system libraries (e.g., OpenSSL version mismatch on Fedora 43). This change: - Detects PyInstaller bundle via sys._MEIPASS - Filters bundled library paths from environment variables early in CLI init - Ensures external processes use system libraries instead of bundled ones Fixes aws#8542
bnusunny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this nice PR @dcabib! Just a minor issue to check.
samcli/lib/utils/subprocess_utils.py
Outdated
|
|
||
| # Filter out paths that are inside the PyInstaller bundle | ||
| filtered_paths = [ | ||
| p for p in paths if not p.startswith(meipass) and "_internal" not in p and "dist/_internal" not in p |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current filtering logic might be slightly too broad. The "_internal" not in p check could theoretically filter legitimate system paths containing "_internal". Consider making it more specific:
filtered_paths = [
p for p in paths
if not (p.startswith(meipass) or
p.endswith("/_internal") or
"dist/_internal" in p)
]
…ystem paths Addressed review feedback from @bnusunny: - Changed from '_internal not in p' to 'p.endswith(/_internal)' - This prevents accidentally filtering legitimate system paths that contain _internal in the middle - Added test to verify paths like /usr/lib/some_internal_lib are preserved
|
@bnusunny Done... hope its ok after this change. |
Description
When SAM CLI runs from the native installer (PyInstaller-based), it sets LD_LIBRARY_PATH/DYLD_LIBRARY_PATH to include bundled libraries. This causes conflicts when spawning external processes like npm, node, or pip that need system libraries (e.g., OpenSSL version mismatch on Fedora 43).
Changes
Testing
Fixes #8542
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.