Replace grep -P with grep -E for compatibility on vCenter#10
Open
shrapnel55 wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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 will solve issue #9
This PR replaces all occurrences of grep -P with grep -E in find_brickstorm.sh. The reason for this change is that grep -P (Perl-compatible regex) is not supported on vCenter/Photon builds, as grep is compiled with --disable-perl-regexp. This causes the script to fail with errors like:
grep: support for the -P option is not compiled into this --disable-perl-regexp binaryVerified that grep -P is unavailable:
Confirmed that the pattern (..){0,5} works with Extended Regular Expressions (ERE):
printf 'aabbcc' | grep -Eq '(..){0,5}' && echo "ERE ok"After replacing -P with -E, the script executed successfully without errors.
Why -E?
The script comment mentions grep -Pq for Perl-compatible regex to support (..){0,5}, but this is also supported by ERE. Unless the script intends to use PCRE-only features (lookarounds, \K, etc.), -E is a portable alternative.
Request for Feedback
If there is a specific reason why -P is required, please let me know. Otherwise, this change improves compatibility across environments where PCRE is disabled.