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

Ensure scripts/lint.sh failure when used with incompatible grep #1711

Merged
merged 3 commits into from
Jul 11, 2023

Conversation

marun
Copy link
Contributor

@marun marun commented Jul 11, 2023

Why this should be merged

scripts/lint.sh requires the use of GNU grep due to dependency on the -P / --perl-regexp flag, and the default version installed on MacOS is not compatible. Previously this compatibility problem wasn't resulting in script failure due to how bash ignores set -o errexit when running commands in conditionals. Adding an explicit compatibility check ensures an obvious failure mode and path to resolution.

How this works

Running grep -P with a regex that is guaranteed to match will succeed for gnu grep and fail with an informative message with macos' default grep.

How this was tested

  • scripts/lint.sh was tested to succeed with gnu grep and fail with the expected output with macos' default grep

scripts/lint.sh requires the use of GNU grep due to dependency on the
`--perl-regexp` flag, and the default version installed on MacOS is
not compatible. Previously this compatibility problem wasn't resulting
in script failure due to how bash ignores `set -o errexit` when
running commands in conditionals. Adding an explicit compatibility
check ensures an obvious failure mode and path to resolution.
@StephenButtolph StephenButtolph changed the base branch from master to dev July 11, 2023 16:44
@StephenButtolph StephenButtolph added this to the v1.10.5 milestone Jul 11, 2023
@StephenButtolph StephenButtolph added the testing This primarily focuses on testing label Jul 11, 2023
@StephenButtolph StephenButtolph merged commit 2da0c25 into dev Jul 11, 2023
13 checks passed
@StephenButtolph StephenButtolph deleted the lint-fail-incompatible-grep branch July 11, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing This primarily focuses on testing
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants