fix else case for rootless storage path and path match#542
Merged
Conversation
vrothberg
reviewed
Mar 2, 2020
| if storageOpts.RootlessStoragePath != "" { | ||
| splitPaths := strings.SplitAfter(storageOpts.RootlessStoragePath, "$") | ||
| validEnv := regexp.MustCompile(`^(HOME|USER|UID)[^a-zA-Z]`).MatchString | ||
| validEnv := regexp.MustCompile(`^(HOME|USER|UID)([^a-zA-Z]|$)`).MatchString |
Member
There was a problem hiding this comment.
Why do we need to change the regex?
@QiWang19, could you break the code in this if branch into a dedicated function and add unit tests? We have a long tradition in regressing with parsing code.
move the assignment of rootless_storage_path out of `else` block to make the config work even the graphroot is empty. fix the path match error Signed-off-by: Qi Wang <qiwan@redhat.com>
68a40d3 to
3b4c1af
Compare
rhatdan
approved these changes
Mar 2, 2020
rhatdan
reviewed
Mar 2, 2020
| "/test/$HOME/path", | ||
| "/test/$HOME/$USER/$UID", | ||
| "/test/$HOME/$USER/$UID/path", | ||
| "$HOME/$USER/$UID/path", |
Member
There was a problem hiding this comment.
What about these valid paths?
/tmp/$HOME$USER$UID
/tmp/$HOME-$USER-$UID
vrothberg
reviewed
Mar 2, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
move the assignment of rootless_storage_path out of
elseblock to make the config work even the graphroot is empty.fix the path match error
Signed-off-by: Qi Wang qiwan@redhat.com