Skip to content

Module check mishandles bash operator precedence#7004

Merged
headius merged 1 commit intojruby:jruby-9.3from
headius:fix_modules_condition
Jan 17, 2022
Merged

Module check mishandles bash operator precedence#7004
headius merged 1 commit intojruby:jruby-9.3from
headius:fix_modules_condition

Conversation

@headius
Copy link
Member

@headius headius commented Jan 17, 2022

This fixes the issue described in #6789 where a nonexistent release file 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 the modules file exists, this leads to an error as the grep command tries to read the non-existent release file.

@headius
Copy link
Member Author

headius commented Jan 17, 2022

Calling @mrnoname1000 for a review...

@headius headius changed the base branch from master to jruby-9.3 January 17, 2022 18:59
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
@headius headius force-pushed the fix_modules_condition branch from d6404de to c025687 Compare January 17, 2022 19:09
@headius headius changed the title Module check handles bash operator precedence incorrectly Module check mishandles bash operator precedence Jan 17, 2022
@headius headius merged commit c816454 into jruby:jruby-9.3 Jan 17, 2022
@headius headius deleted the fix_modules_condition branch January 17, 2022 19:50
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.

1 participant