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

[python-wrapper] Re-populate REPLIT_LD_LIBRARY_PATH #410

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

blast-hardcheese
Copy link
Contributor

@blast-hardcheese blast-hardcheese commented Oct 21, 2024

Why

During the last refactor we lost the default fallback Python runtime, removing critical C++ libraries from the path. This was because the testing environment provided a default value, which did not adequately exercise the default case.

What changed

Mirror the setup between legacy and modern environment builders for clarity.

Test plan

This time, I tested by unsetting the value first...

$ unset REPLIT_LD_LIBRARY_PATH; python main.py

then running the following (main.py):

import os

[var] = [x for x in open('/proc/self/environ').read().split('\0') if x.startswith('REPLIT_LD_LIBRARY_PATH=')]

for dir in var.split("=", 1)[1].split(':'):
    fpath = os.path.join(dir, 'libstdc++.so.6')
    if os.path.exists(fpath):
        break

print(f"Found {fpath}")
print(os.stat(fpath))

This replicates the lookup logic in ld-audit and verifies that we can find the library we need.

Rollout

Describe any procedures or requirements needed to roll this out safely (or check the box below)

  • This is fully backward and forward compatible

@blast-hardcheese blast-hardcheese requested a review from a team as a code owner October 21, 2024 20:48
@blast-hardcheese blast-hardcheese requested review from airportyh and removed request for a team October 21, 2024 20:48
@blast-hardcheese blast-hardcheese force-pushed the dstewart/bug/python-wrapper-regression branch from 50c1279 to d093f30 Compare October 21, 2024 22:32
@blast-hardcheese blast-hardcheese merged commit ca8c23b into main Oct 21, 2024
1 check passed
@blast-hardcheese blast-hardcheese deleted the dstewart/bug/python-wrapper-regression branch October 21, 2024 22:39
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