Fix for RedHat 8 (env vars that are functions) #26
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.
Description
This is a fix for #25. In the end it is easy.
The source of the problem is that there are multi-line environmental variables (functions, actually), and the "parsing" of the environment wrongly matches lines within these multi-line variables as if they were variable definitions.
printenv
indents the contents of these functions (the inner-scope lines start with a space). A normal variable definition does not start with space. Therefore, the solution is to ignore lines starting with space.That is: replace
re.search(..., s.strip())
byre.match(..., s.rstrip())
Fixes #25
Interface impacts
None
Testing
When doing tests, verified that tests pass in this PR and fail in master.
Unit tests
Independent check of unit tests by @taldcroft
Functional tests
tried the specific test in #25:
@taldcroft also confirmed this functional test on han8-v (RH8) and kady (CentOS-7)