* [PATCH next 1/1] perf beauty socket/prctl_option: Cope with extended regexp complaint by grep
@ 2023-10-31 15:29 Arnaldo Carvalho de Melo
2023-11-02 6:04 ` Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-10-31 15:29 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: Adrian Hunter, Ian Rogers, Jiri Olsa, Namhyung Kim
Noticed on fedora 38, the extended regexp that so far was ok for both
grep and sed now gets complaints by grep, that says '/' doesn't need to
be escaped with '\'.
So stop using '/' in sed, use '%' instead and remove the \ before / in
the common extended regexp.
Link: https://x.com/SMT_Solvers/status/1710380010098344192?s=20
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/trace/beauty/prctl_option.sh | 4 ++--
tools/perf/trace/beauty/socket.sh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/trace/beauty/prctl_option.sh b/tools/perf/trace/beauty/prctl_option.sh
index 8059342ca4126c38..9455d9672f140d13 100755
--- a/tools/perf/trace/beauty/prctl_option.sh
+++ b/tools/perf/trace/beauty/prctl_option.sh
@@ -4,9 +4,9 @@
[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
printf "static const char *prctl_options[] = {\n"
-regex='^#define[[:space:]]{1}PR_(\w+)[[:space:]]*([[:xdigit:]]+)([[:space:]]*\/.*)?$'
+regex='^#define[[:space:]]{1}PR_(\w+)[[:space:]]*([[:xdigit:]]+)([[:space:]]*/.*)?$'
grep -E $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \
- sed -r "s/$regex/\2 \1/g" | \
+ sed -E "s%$regex%\2 \1%g" | \
sort -n | xargs printf "\t[%s] = \"%s\",\n"
printf "};\n"
diff --git a/tools/perf/trace/beauty/socket.sh b/tools/perf/trace/beauty/socket.sh
index 8bc7ba62203e4a9d..670c6db298ae0298 100755
--- a/tools/perf/trace/beauty/socket.sh
+++ b/tools/perf/trace/beauty/socket.sh
@@ -18,10 +18,10 @@ grep -E $ipproto_regex ${uapi_header_dir}/in.h | \
printf "};\n\n"
printf "static const char *socket_level[] = {\n"
-socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+\/.*)?'
+socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+/.*)?'
grep -E $socket_level_regex ${beauty_header_dir}/socket.h | \
- sed -r "s/$socket_level_regex/\2 \1/g" | \
+ sed -E "s%$socket_level_regex%\2 \1%g" | \
sort -n | xargs printf "\t[%s] = \"%s\",\n"
printf "};\n\n"
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH next 1/1] perf beauty socket/prctl_option: Cope with extended regexp complaint by grep
2023-10-31 15:29 [PATCH next 1/1] perf beauty socket/prctl_option: Cope with extended regexp complaint by grep Arnaldo Carvalho de Melo
@ 2023-11-02 6:04 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2023-11-02 6:04 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Linux Kernel Mailing List, Adrian Hunter, Ian Rogers, Jiri Olsa
On Tue, Oct 31, 2023 at 8:30 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Noticed on fedora 38, the extended regexp that so far was ok for both
> grep and sed now gets complaints by grep, that says '/' doesn't need to
> be escaped with '\'.
>
> So stop using '/' in sed, use '%' instead and remove the \ before / in
> the common extended regexp.
>
> Link: https://x.com/SMT_Solvers/status/1710380010098344192?s=20
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
> ---
> tools/perf/trace/beauty/prctl_option.sh | 4 ++--
> tools/perf/trace/beauty/socket.sh | 4 ++--
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/perf/trace/beauty/prctl_option.sh b/tools/perf/trace/beauty/prctl_option.sh
> index 8059342ca4126c38..9455d9672f140d13 100755
> --- a/tools/perf/trace/beauty/prctl_option.sh
> +++ b/tools/perf/trace/beauty/prctl_option.sh
> @@ -4,9 +4,9 @@
> [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
>
> printf "static const char *prctl_options[] = {\n"
> -regex='^#define[[:space:]]{1}PR_(\w+)[[:space:]]*([[:xdigit:]]+)([[:space:]]*\/.*)?$'
> +regex='^#define[[:space:]]{1}PR_(\w+)[[:space:]]*([[:xdigit:]]+)([[:space:]]*/.*)?$'
> grep -E $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \
> - sed -r "s/$regex/\2 \1/g" | \
> + sed -E "s%$regex%\2 \1%g" | \
> sort -n | xargs printf "\t[%s] = \"%s\",\n"
> printf "};\n"
>
> diff --git a/tools/perf/trace/beauty/socket.sh b/tools/perf/trace/beauty/socket.sh
> index 8bc7ba62203e4a9d..670c6db298ae0298 100755
> --- a/tools/perf/trace/beauty/socket.sh
> +++ b/tools/perf/trace/beauty/socket.sh
> @@ -18,10 +18,10 @@ grep -E $ipproto_regex ${uapi_header_dir}/in.h | \
> printf "};\n\n"
>
> printf "static const char *socket_level[] = {\n"
> -socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+\/.*)?'
> +socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+/.*)?'
>
> grep -E $socket_level_regex ${beauty_header_dir}/socket.h | \
> - sed -r "s/$socket_level_regex/\2 \1/g" | \
> + sed -E "s%$socket_level_regex%\2 \1%g" | \
> sort -n | xargs printf "\t[%s] = \"%s\",\n"
> printf "};\n\n"
>
> --
> 2.41.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-02 6:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 15:29 [PATCH next 1/1] perf beauty socket/prctl_option: Cope with extended regexp complaint by grep Arnaldo Carvalho de Melo
2023-11-02 6:04 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox