From 81341e1e8086488920f211fab32f1e6383a231bc Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 13 Apr 2024 20:05:43 +0000 Subject: [PATCH] os400: fix shellcheck warnings in scripts (fixups) - Build scripts must be executed by the os/400 shell (sh), not bash which is a PASE program: The `-ot` non-POSIX test extension works in os/400 as well. Ref: https://github.com/libssh2/libssh2/pull/1364#issue-2241646754 - Drop/fixup mods trying to make some syntax highlighters happier. Follow-up to c6625707b94d9093f38f1a0a4d89c11b64f12ba8 #1358 Assisted-by: Patrick Monnerat Closes #1364 Closes #1366 --- os400/config400.default | 2 +- os400/initscript.sh | 9 ++++----- os400/make-include.sh | 2 +- os400/make-rpg.sh | 2 +- os400/make-src.sh | 2 +- os400/make.sh | 2 +- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/os400/config400.default b/os400/config400.default index 35e3283e..5147cb20 100644 --- a/os400/config400.default +++ b/os400/config400.default @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Copyright (C) The libssh2 project and its contributors. # SPDX-License-Identifier: BSD-3-Clause diff --git a/os400/initscript.sh b/os400/initscript.sh index 78889aed..bbe78c07 100755 --- a/os400/initscript.sh +++ b/os400/initscript.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Copyright (C) The libssh2 project and its contributors. # SPDX-License-Identifier: BSD-3-Clause @@ -94,6 +94,7 @@ action_needed() { [ ! -e "${1}" ] && return 0 [ -n "${2}" ] || return 1 + # shellcheck disable=SC3013 [ "${1}" -ot "${2}" ] && return 0 return 1 } @@ -121,8 +122,7 @@ canonicalize_path() do IFS="${IFSSAVE}" case "${C}" in .) ;; - ..) R=$(expr \ - "${R}" : '^\(.*/\)..*') + ..) R="$(expr "${R}" : '^\(.*/\)..*')" ;; ?*) R="${R}${C}/" ;; @@ -147,8 +147,7 @@ make_module() MODULES="${MODULES} ${1}" MODIFSNAME="${LIBIFSNAME}/${1}.MODULE" action_needed "${MODIFSNAME}" "${2}" || return 0; - SRCDIR="$(dirname \ - "$(canonicalize_path "${2}")")" + SRCDIR="$(dirname "$(canonicalize_path "${2}")")" # #pragma convert has to be in the source file itself, i.e. # putting it in an include file makes it only active diff --git a/os400/make-include.sh b/os400/make-include.sh index 2de6d6d7..5fa911af 100755 --- a/os400/make-include.sh +++ b/os400/make-include.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Copyright (C) The libssh2 project and its contributors. # SPDX-License-Identifier: BSD-3-Clause # diff --git a/os400/make-rpg.sh b/os400/make-rpg.sh index 7a6f3cd1..68b50009 100755 --- a/os400/make-rpg.sh +++ b/os400/make-rpg.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Copyright (C) The libssh2 project and its contributors. # SPDX-License-Identifier: BSD-3-Clause # diff --git a/os400/make-src.sh b/os400/make-src.sh index 408d0122..4c399da8 100755 --- a/os400/make-src.sh +++ b/os400/make-src.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Copyright (C) The libssh2 project and its contributors. # SPDX-License-Identifier: BSD-3-Clause # diff --git a/os400/make.sh b/os400/make.sh index 2e40755e..84640db7 100755 --- a/os400/make.sh +++ b/os400/make.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # Copyright (C) The libssh2 project and its contributors. # SPDX-License-Identifier: BSD-3-Clause #