Merge pull request #10805 from balintTobik/egrep_removal

egrep/fgrep removal
This commit is contained in:
Greg Kurz 2025-01-30 18:26:59 +01:00 committed by GitHub
commit 0215d958da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 127 additions and 127 deletions

View File

@ -79,8 +79,8 @@ list_issues_for_pr()
# "<git-commit> <git-commit-msg>" # "<git-commit> <git-commit-msg>"
# #
local issues=$(echo "$commits" |\ local issues=$(echo "$commits" |\
egrep -v "^( | )" |\ grep -v -E "^( | )" |\
egrep -i "fixes:* *(#*[0-9][0-9]*)" |\ grep -i -E "fixes:* *(#*[0-9][0-9]*)" |\
tr ' ' '\n' |\ tr ' ' '\n' |\
grep "[0-9][0-9]*" |\ grep "[0-9][0-9]*" |\
sed 's/[.,\#]//g' |\ sed 's/[.,\#]//g' |\

View File

@ -198,7 +198,7 @@ it stores. When messages are suppressed, it is noted in the logs. This can be ch
for by looking for those notifications, such as: for by looking for those notifications, such as:
```bash ```bash
$ sudo journalctl --since today | fgrep Suppressed $ sudo journalctl --since today | grep -F Suppressed
Jun 29 14:51:17 mymachine systemd-journald[346]: Suppressed 4150 messages from /system.slice/docker.service Jun 29 14:51:17 mymachine systemd-journald[346]: Suppressed 4150 messages from /system.slice/docker.service
``` ```

View File

@ -98,7 +98,7 @@ a number larger than `0` if you have either of the `vmx` or `svm` nested virtual
available: available:
```sh ```sh
$ minikube ssh "egrep -c 'vmx|svm' /proc/cpuinfo" $ minikube ssh "grep -c -E 'vmx|svm' /proc/cpuinfo"
``` ```
## Installing Kata Containers ## Installing Kata Containers
@ -122,8 +122,8 @@ and will be executing a `sleep infinity` once it has successfully completed its
You can accomplish this by running the following: You can accomplish this by running the following:
```sh ```sh
$ podname=$(kubectl -n kube-system get pods -o=name | fgrep kata-deploy | sed 's?pod/??') $ podname=$(kubectl -n kube-system get pods -o=name | grep -F kata-deploy | sed 's?pod/??')
$ kubectl -n kube-system exec ${podname} -- ps -ef | fgrep infinity $ kubectl -n kube-system exec ${podname} -- ps -ef | grep -F infinity
``` ```
> *NOTE:* This check only works for single node clusters, which is the default for Minikube. > *NOTE:* This check only works for single node clusters, which is the default for Minikube.
@ -197,7 +197,7 @@ $ minikube ssh -- uname -a
And then compare that against the kernel that is running inside the container: And then compare that against the kernel that is running inside the container:
```sh ```sh
$ podname=$(kubectl get pods -o=name | fgrep php-apache-kata-qemu | sed 's?pod/??') $ podname=$(kubectl get pods -o=name | grep -F php-apache-kata-qemu | sed 's?pod/??')
$ kubectl exec ${podname} -- uname -a $ kubectl exec ${podname} -- uname -a
``` ```

View File

@ -531,7 +531,7 @@ $ ls /dev/vfio
* Check that the modules load when inside the Kata Container. * Check that the modules load when inside the Kata Container.
```sh ```sh
bash-5.0# egrep "qat|usdm_drv" /proc/modules bash-5.0# grep -E "qat|usdm_drv" /proc/modules
qat_c62xvf 16384 - - Live 0x0000000000000000 (O) qat_c62xvf 16384 - - Live 0x0000000000000000 (O)
usdm_drv 86016 - - Live 0x0000000000000000 (O) usdm_drv 86016 - - Live 0x0000000000000000 (O)
intel_qat 184320 - - Live 0x0000000000000000 (O) intel_qat 184320 - - Live 0x0000000000000000 (O)

View File

@ -42,7 +42,7 @@ The following is an example of how to use `lspci` to check if your NIC supports
SR-IOV. SR-IOV.
``` ```
$ lspci | fgrep -i ethernet $ lspci | grep -i -F ethernet
01:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 03) 01:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 03)
... ...

View File

@ -24,7 +24,7 @@ _kata_get_subcmd_options()
local subcmd="$1" local subcmd="$1"
"$_kataruntime" "$subcmd" --help |\ "$_kataruntime" "$subcmd" --help |\
egrep -- "^ *--[^ ]*[ ][^ ]*" |\ grep -E -- "^ *--[^ ]*[ ][^ ]*" |\
awk '{print $1}' |\ awk '{print $1}' |\
tr -d \, |\ tr -d \, |\
sort sort

View File

@ -277,8 +277,8 @@ find_system_journal_problems()
local problems=$(journalctl -q -o cat -a "$selector" "$program" |\ local problems=$(journalctl -q -o cat -a "$selector" "$program" |\
grep "time=" |\ grep "time=" |\
egrep -i "$problem_pattern" |\ grep -i -E "$problem_pattern" |\
egrep -iv "$problem_exclude_pattern" |\ grep -iv -E "$problem_exclude_pattern" |\
tail -n ${PROBLEM_LIMIT}) tail -n ${PROBLEM_LIMIT})
if [ -n "$problems" ]; then if [ -n "$problems" ]; then
@ -370,11 +370,11 @@ show_package_versions()
pattern+=")" pattern+=")"
if have_cmd "dpkg"; then if have_cmd "dpkg"; then
run_cmd_and_show_quoted_output "" "dpkg -l|egrep \"$pattern\"" run_cmd_and_show_quoted_output "" "dpkg -l|grep -E \"$pattern\""
fi fi
if have_cmd "rpm"; then if have_cmd "rpm"; then
run_cmd_and_show_quoted_output "" "rpm -qa|egrep \"$pattern\"" run_cmd_and_show_quoted_output "" "rpm -qa|grep -E \"$pattern\""
fi fi
separator separator
@ -633,7 +633,7 @@ get_image_file()
local image=$(eval "$cmdline" 2>/dev/null |\ local image=$(eval "$cmdline" 2>/dev/null |\
grep -A 1 '^\[Image\]' |\ grep -A 1 '^\[Image\]' |\
egrep "\<Path\> =" |\ grep -E "\<Path\> =" |\
awk '{print $3}' |\ awk '{print $3}' |\
tr -d '"') tr -d '"')
@ -648,7 +648,7 @@ get_initrd_file()
local initrd=$(eval "$cmdline" 2>/dev/null |\ local initrd=$(eval "$cmdline" 2>/dev/null |\
grep -A 1 '^\[Initrd\]' |\ grep -A 1 '^\[Initrd\]' |\
egrep "\<Path\> =" |\ grep -E "\<Path\> =" |\
awk '{print $3}' |\ awk '{print $3}' |\
tr -d '"') tr -d '"')
@ -742,7 +742,7 @@ show_throttler_details()
throttlers=$(find /usr/libexec /usr/lib* -type f |\ throttlers=$(find /usr/libexec /usr/lib* -type f |\
grep -v trigger |\ grep -v trigger |\
egrep "(cc|kata)-ksm-throttler" |\ grep -E "(cc|kata)-ksm-throttler" |\
sort -u) sort -u)
echo "$throttlers" | while read throttler echo "$throttlers" | while read throttler

View File

@ -286,7 +286,7 @@ show_procs()
local regex local regex
regex="(${pattern_list})" regex="(${pattern_list})"
ps -efww | egrep -i "$regex" || true ps -efww | grep -i -E "$regex" || true
} }
kill_tmux_sessions() kill_tmux_sessions()
@ -961,7 +961,7 @@ get_addresses()
if [ $configured_hypervisor = "qemu" ]; then if [ $configured_hypervisor = "qemu" ]; then
addresses=$(ss -Hp --vsock |\ addresses=$(ss -Hp --vsock |\
egrep -v "\<socat\>" |\ grep -v -E "\<socat\>" |\
awk '$2 ~ /^ESTAB$/ {print $6}' |\ awk '$2 ~ /^ESTAB$/ {print $6}' |\
grep ":${EXPECTED_VSOCK_PORT}$") grep ":${EXPECTED_VSOCK_PORT}$")
elif [ $configured_hypervisor = "clh" ]; then elif [ $configured_hypervisor = "clh" ]; then
@ -1166,7 +1166,7 @@ validate_agent()
# Regular expression that describes possible agent failures # Regular expression that describes possible agent failures
local regex="(slog::Fuse|Drain|Custom|serialization error|thread.*panicked|stack backtrace:)" local regex="(slog::Fuse|Drain|Custom|serialization error|thread.*panicked|stack backtrace:)"
egrep -q "$regex" "$log_file" && cat $log_file && die "Found agent error in log file: '$log_file'" grep -q -E "$regex" "$log_file" && cat $log_file && die "Found agent error in log file: '$log_file'"
local entry local entry
entry=$(get_shutdown_test_type_entry "$shutdown_test_type" || true) entry=$(get_shutdown_test_type_entry "$shutdown_test_type" || true)
@ -1186,7 +1186,7 @@ validate_agent()
# The message the agent writes to stderr just before it exits. # The message the agent writes to stderr just before it exits.
local done_msg="\<shutdown complete\>" local done_msg="\<shutdown complete\>"
egrep -q "$done_msg" "$log_file" || (cat $log_file && die "missing agent shutdown message") grep -q -E "$done_msg" "$log_file" || (cat $log_file && die "missing agent shutdown message")
else else
# We can only check for the shutdown message if the agent debug # We can only check for the shutdown message if the agent debug
# logs are available. # logs are available.

View File

@ -76,7 +76,7 @@ create_user_data() {
dnf_proxy="" dnf_proxy=""
service_proxy="" service_proxy=""
docker_user_proxy="{}" docker_user_proxy="{}"
environment=$(env | egrep "ghprb|WORKSPACE|KATA|GIT|JENKINS|_PROXY|_proxy" | \ environment=$(env | grep -E "ghprb|WORKSPACE|KATA|GIT|JENKINS|_PROXY|_proxy" | \
sed -e "s/'/'\"'\"'/g" \ sed -e "s/'/'\"'\"'/g" \
-e "s/\(^[[:alnum:]_]\+\)=/\1='/" \ -e "s/\(^[[:alnum:]_]\+\)=/\1='/" \
-e "s/$/'/" \ -e "s/$/'/" \

View File

@ -638,7 +638,7 @@ errors=$(
signals=$( signals=$(
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags | echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | grep -v -E '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
sort sort
) )
@ -648,7 +648,7 @@ echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
sort >_error.grep sort >_error.grep
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags | echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' | awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' | grep -v -E '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)' |
sort >_signal.grep sort >_signal.grep
echo '// mkerrors.sh' "$@" echo '// mkerrors.sh' "$@"

View File

@ -200,7 +200,7 @@ function grab_system() {
((anon*=1024)) ((anon*=1024))
# Mapped pages # Mapped pages
local mapped=$(egrep "^Mapped:" /proc/meminfo | awk '{print $2}') local mapped=$(grep -E "^Mapped:" /proc/meminfo | awk '{print $2}')
((mapped*=1024)) ((mapped*=1024))
# Cached # Cached

View File

@ -429,7 +429,7 @@ static_check_license_headers()
info "Checking $desc" info "Checking $desc"
local missing=$(egrep \ local missing=$(grep \
--exclude=".git/*" \ --exclude=".git/*" \
--exclude=".gitignore" \ --exclude=".gitignore" \
--exclude=".dockerignore" \ --exclude=".dockerignore" \
@ -475,7 +475,7 @@ static_check_license_headers()
--exclude="src/mem-agent/example/protocols/protos/google/protobuf/*.proto" \ --exclude="src/mem-agent/example/protocols/protos/google/protobuf/*.proto" \
--exclude="src/libs/*/test/texture/*" \ --exclude="src/libs/*/test/texture/*" \
--exclude="*.dic" \ --exclude="*.dic" \
-EL $extra_args "\<${pattern}\>" \ -EL $extra_args -E "\<${pattern}\>" \
$files || true) $files || true)
if [ -n "$missing" ]; then if [ -n "$missing" ]; then
@ -783,7 +783,7 @@ static_check_docs()
local exclude_pattern local exclude_pattern
# Convert the list of files into an egrep(1) alternation pattern. # Convert the list of files into an grep(1) alternation pattern.
exclude_pattern=$(echo "${exclude_doc_regexs[@]}"|sed 's, ,|,g') exclude_pattern=$(echo "${exclude_doc_regexs[@]}"|sed 's, ,|,g')
# Every document in the repo (except a small handful of exceptions) # Every document in the repo (except a small handful of exceptions)
@ -792,7 +792,7 @@ static_check_docs()
do do
# Check the ignore list for markdown files that do not need to # Check the ignore list for markdown files that do not need to
# be referenced by others. # be referenced by others.
echo "$doc"|egrep -q "(${exclude_pattern})" && continue echo "$doc"|grep -q -E "(${exclude_pattern})" && continue
grep -q "$doc" "$md_links" || die "Document $doc is not referenced" grep -q "$doc" "$md_links" || die "Document $doc is not referenced"
done done
@ -827,7 +827,7 @@ static_check_docs()
if [ "$specific_branch" != "true" ] if [ "$specific_branch" != "true" ]
then then
# If the URL is new on this PR, it cannot be checked. # If the URL is new on this PR, it cannot be checked.
echo "$new_urls" | egrep -q "\<${url}\>" && \ echo "$new_urls" | grep -q -E "\<${url}\>" && \
info "ignoring new (but correct) URL: $url" && continue info "ignoring new (but correct) URL: $url" && continue
fi fi
@ -925,12 +925,12 @@ static_check_eof()
[ "$file" == "Vagrantfile" ] && return [ "$file" == "Vagrantfile" ] && return
local invalid=$(cat "$file" |\ local invalid=$(cat "$file" |\
egrep -o '<<-* *\w*' |\ grep -o -E '<<-* *\w*' |\
sed -e 's/^<<-*//g' |\ sed -e 's/^<<-*//g' |\
tr -d ' ' |\ tr -d ' ' |\
sort -u |\ sort -u |\
egrep -v '^$' |\ grep -v -E '^$' |\
egrep -v "$anchor" || true) grep -v -E "$anchor" || true)
[ -z "$invalid" ] || die "Expected '$anchor' here anchor, in $file found: $invalid" [ -z "$invalid" ] || die "Expected '$anchor' here anchor, in $file found: $invalid"
} }
@ -957,7 +957,7 @@ static_check_files()
then then
info "Checking all files in $branch branch" info "Checking all files in $branch branch"
files=$(git ls-files | egrep -v "/(.git|vendor|grpc-rs|target)/" || true) files=$(git ls-files | grep -v -E "/(.git|vendor|grpc-rs|target)/" || true)
else else
info "Checking local branch for changed files only" info "Checking local branch for changed files only"
@ -979,7 +979,7 @@ static_check_files()
# Look for files containing the specified comment tags but # Look for files containing the specified comment tags but
# which do not include a github URL. # which do not include a github URL.
match=$(egrep -H "\<FIXME\>|\<TODO\>" "$file" |\ match=$(grep -H -E "\<FIXME\>|\<TODO\>" "$file" |\
grep -v "https://github.com/.*/issues/[0-9]" |\ grep -v "https://github.com/.*/issues/[0-9]" |\
cut -d: -f1 |\ cut -d: -f1 |\
sort -u || true) sort -u || true)