Skip to content

Replace grep -P with grep -E for compatibility on vCenter#10

Open
shrapnel55 wants to merge 1 commit into
mandiant:mainfrom
shrapnel55:main
Open

Replace grep -P with grep -E for compatibility on vCenter#10
shrapnel55 wants to merge 1 commit into
mandiant:mainfrom
shrapnel55:main

Conversation

@shrapnel55

Copy link
Copy Markdown

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 binary

Verified that grep -P is unavailable:

grep -P . /dev/null; echo $?  # exit code 2
grep --help | grep -E -- '-P|Perl|PCRE' || echo "-P not in help"

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.

@google-cla

google-cla Bot commented Oct 31, 2025

Copy link
Copy Markdown

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.

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