Module check mishandles bash operator precedence#7004
Merged
headius merged 1 commit intojruby:jruby-9.3from Jan 17, 2022
Merged
Module check mishandles bash operator precedence#7004headius merged 1 commit intojruby:jruby-9.3from
headius merged 1 commit intojruby:jruby-9.3from
Conversation
Member
Author
|
Calling @mrnoname1000 for a review... |
The operators here are executed from left to right, which means if either the modules file or the release file exist, the grep is executed. In the unusual environment described in jruby#6789, where only the modules file exists, this leads to an error when the nonexistent release file is grepped. https://unix.stackexchange.com/a/88851
d6404de to
c025687
Compare
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.
This fixes the issue described in #6789 where a nonexistent
releasefile gets grepped even though we do an existence check. The problem here is that in bash, unlike in C or Java, the||and&&operators have the same precedence, which means they will be evaluated from left to right. In the environment described by @lfiht in #6789, where only themodulesfile exists, this leads to an error as thegrepcommand tries to read the non-existentreleasefile.