Thread (33 messages) 33 messages, 4 authors, 2023-07-28
STALE1034d LANDED
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH V2 15/26] tools/perf: Fix shellcheck issue for check-headers.sh script

From: Athira Rajeev <hidden>
Date: 2023-07-09 18:42:19
Also in: linux-perf-users
Subsystem: performance events subsystem, the rest · Maintainers: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds

From: Kajol Jain <redacted>

Running shellcheck on check-headers.sh generates below warning:

In check-headers.sh line 126:
  check_2 "tools/$file" "$file" $*
                                ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.

In check-headers.sh line 134:
  check_2 "tools/perf/trace/beauty/$file" "$file" $*
                                                  ^-- SC2048 (warning): Use "$@" (with quotes) to prevent whitespace problems.

In check-headers.sh line 186:
cd tools/perf
^-----------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

Fixed the warnings by:
- Using "$@" instead of $*
- Adding exit condition with cd command

Signed-off-by: Athira Rajeev <redacted>
Signed-off-by: Kajol Jain <redacted>
---
 tools/perf/check-headers.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index a0f1d8adce60..4314c9197850 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -123,7 +123,7 @@ check () {
 
   shift
 
-  check_2 "tools/$file" "$file" $*
+  check_2 "tools/$file" "$file" "$@"
 }
 
 beauty_check () {
@@ -131,7 +131,7 @@ beauty_check () {
 
   shift
 
-  check_2 "tools/perf/trace/beauty/$file" "$file" $*
+  check_2 "tools/perf/trace/beauty/$file" "$file" "$@"
 }
 
 # Check if we have the kernel headers (tools/perf/../../include), else
@@ -183,7 +183,7 @@ done
 check_2 tools/perf/util/hashmap.h tools/lib/bpf/hashmap.h
 check_2 tools/perf/util/hashmap.c tools/lib/bpf/hashmap.c
 
-cd tools/perf
+cd tools/perf || exit
 
 if [ ${#FAILURES[@]} -gt 0 ]
 then
-- 
2.39.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help