Exclude LD_LIBRARY_PATH
and PYTHONHOME
when invoking subprocesses
#1565
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During the build, the buildpack makes the config vars set on the app available to certain subprocesses (such as Django collectstatic) via the
sub_env
utility function. This function filters out env vars that might cause the subprocess to fail.This change adds
LD_LIBRARY_PATH
andPYTHONHOME
to the list of env vars that are filtered out, to prevent errors when they are set to invalid values. (Note: This filtering only affects app config vars, and not the env vars provided by buildpacks that run prior to the Python buildpack.)In particular, very old versions of the buildpack used to set these env vars as actual app config vars (via the
bin/release
script), to values that no longer work:heroku-buildpack-python/bin/release
Lines 11 to 18 in 27abdfe
These broken app config vars have not typically caused problems since:
LD_LIBRARY_PATH
However, as of Python 3.10 we switched to building in shared mode (see #1320), and so apps with broken config vars will otherwise see errors like the following once they upgrade Python versions:
As seen in:
https://heroku.support/1309696
https://heroku.support/1365030
The
GIT_DIR
env var was removed from the filter list, since there is no need to filter it out, since it's no longer set by the build system, see #1120.(The CNB isn't affected by this issue, and already has a test to confirm that.)
GUS-W-15519103.