[PATCH V2 14/26] tools/perf/trace: Fix shellcheck issue for arch_errno_names.sh script
Athira Rajeev
atrajeev at linux.vnet.ibm.com
Mon Jul 10 04:27:48 AEST 2023
From: Kajol Jain <kjain at linux.ibm.com>
Running shellcheck on arch_errno_names.sh generates below warning:
In arch_errno_names.sh line 20:
local arch="$1"
^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
......
In arch_errno_names.sh line 61:
local arch
^--------^ SC3043 (warning): In POSIX sh, 'local' is undefined.
In arch_errno_names.sh line 67:
printf '\t\treturn errno_to_name__%s(err);\n' $(arch_string "$arch")
^--------------------^ SC2046 (warning): Quote this to prevent word splitting.
In arch_errno_names.sh line 69:
printf '\treturn errno_to_name__%s(err);\n' $(arch_string "$default")
^-----------------------^ SC2046 (warning): Quote this to prevent word splitting.
Fixed the warnings by:
- Fixing shellcheck warnings for local usage, by removing
local from the variable names
- Adding quotes to avoid word splitting
Signed-off-by: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
Signed-off-by: Kajol Jain <kjain at linux.ibm.com>
---
tools/perf/trace/beauty/arch_errno_names.sh | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/tools/perf/trace/beauty/arch_errno_names.sh b/tools/perf/trace/beauty/arch_errno_names.sh
index 37c53bac5f56..cc09dcaa891e 100755
--- a/tools/perf/trace/beauty/arch_errno_names.sh
+++ b/tools/perf/trace/beauty/arch_errno_names.sh
@@ -17,8 +17,7 @@ arch_string()
asm_errno_file()
{
- local arch="$1"
- local header
+ arch="$1"
header="$toolsdir/arch/$arch/include/uapi/asm/errno.h"
if test -r "$header"; then
@@ -30,8 +29,7 @@ asm_errno_file()
create_errno_lookup_func()
{
- local arch=$(arch_string "$1")
- local nr name
+ arch=$(arch_string "$1")
printf "static const char *errno_to_name__%s(int err)\n{\n\tswitch (err) {\n" $arch
@@ -44,8 +42,8 @@ create_errno_lookup_func()
process_arch()
{
- local arch="$1"
- local asm_errno=$(asm_errno_file "$arch")
+ arch="$1"
+ asm_errno=$(asm_errno_file "$arch")
$gcc $CFLAGS $include_path -E -dM -x c $asm_errno \
|grep -hE '^#define[[:blank:]]+(E[^[:blank:]]+)[[:blank:]]+([[:digit:]]+).*' \
@@ -56,9 +54,8 @@ process_arch()
create_arch_errno_table_func()
{
- local archlist="$1"
- local default="$2"
- local arch
+ archlist="$1"
+ default="$2"
printf 'const char *arch_syscalls__strerrno(const char *arch, int err)\n'
printf '{\n'
--
2.39.1
More information about the Linuxppc-dev
mailing list