Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

omnibus/cli: only match override value against regex for strings #1160

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nilium
Copy link

@nilium nilium commented Sep 14, 2024

Description

As of Ruby 3.2, true =~ /regex/ raises an exception (a NoMethodError for =~) instead of returning nil (seen in 3.1 and earlier), so using --override key:true (and false / nil) fails with an error. Instead of always comparing value against a regular expression, only do it if the value didn't match a known true/false/nil value.

This appears to stem from https://bugs.ruby-lang.org/issues/15231.


Maintainers

Please ensure that you check for:

  • If this change impacts git cache validity, it bumps the git cache
    serial number
  • If this change impacts compatibility with omnibus-software, the
    corresponding change is reviewed and there is a release plan
  • If this change impacts compatibility with the omnibus cookbook, the
    corresponding change is reviewed and there is a release plan

As of Ruby 3.2, `true =~ /regex/` raises an exception (a NoMethodError
for `=~`) instead of returning `nil` (seen in 3.1 and earlier),
so using `--override key:true` (and false / nil) fails with an
error. Instead of always comparing value against a regular expression,
only do it if the value didn't match a known true/false/nil value.

This appears to stem from <https://bugs.ruby-lang.org/issues/15231>.

Signed-off-by: Noel Cower <[email protected]>
@nilium nilium requested review from a team as code owners September 14, 2024 06:23
Copy link

sonarcloud bot commented Sep 14, 2024

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