[LTP] [COMMITTED][PATCH 1/1] generate_syscalls.sh: Make help visible
Petr Vorel
pvorel@suse.cz
Tue Sep 29 16:37:48 CEST 2026
Shell opt "nounset" (set -u parameter, passed via shebang) prints error
instead of printing help:
include/lapi/syscalls/generate_syscalls.sh: line 7: $1: unbound variable
Check number of input arguments correctly.
Fixes: cbd535838a ("Refactor regen.sh script to generate syscalls")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Simple fix which I dared to merge before the release.
IMHO the standard way is to check $# than use ${1:-} when we deal with
input arguments.
include/lapi/syscalls/generate_syscalls.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/lapi/syscalls/generate_syscalls.sh b/include/lapi/syscalls/generate_syscalls.sh
index 19f280dfb8..1601696326 100755
--- a/include/lapi/syscalls/generate_syscalls.sh
+++ b/include/lapi/syscalls/generate_syscalls.sh
@@ -4,9 +4,7 @@
# Generate the syscalls.h file, merging all architectures syscalls input file
# which are in the current folder and defined inside supported-arch.txt file.
-SYSCALLS_FILE="$1"
-
-if [ -z "${SYSCALLS_FILE}" ]; then
+if [ $# -eq 0 ]; then
echo "Please provide the syscalls.h directory:"
echo ""
echo "$0 path/of/syscalls.h"
@@ -14,6 +12,7 @@ if [ -z "${SYSCALLS_FILE}" ]; then
exit 1
fi
+SYSCALLS_FILE="$1"
SCRIPT_DIR="$(realpath $(dirname "$0"))"
SUPPORTED_ARCH="${SCRIPT_DIR}/supported-arch.txt"
--
2.55.0
More information about the ltp
mailing list