From: Patrick Monnerat Date: Sun, 14 Apr 2024 23:10:10 +0000 (+0200) Subject: OS400: post-shellcheck changes adjustments X-Git-Tag: curl-8_8_0~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e46c2909fa90709c0f89138de86f8a4b2b6c8a4;p=thirdparty%2Fcurl.git OS400: post-shellcheck changes adjustments Build scripts must be executed by the os/400 shell (sh), not bash which is a PASE program. Shell function get_make_vars() escaping reworked to match $() subcommand construct. Follow-up to 8a622baf9e9233241bbe93d6599c99cb46478614 Closes #13366 --- diff --git a/packages/OS400/config400.default b/packages/OS400/config400.default index 41d6265311..91a82771fb 100644 --- a/packages/OS400/config400.default +++ b/packages/OS400/config400.default @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/packages/OS400/initscript.sh b/packages/OS400/initscript.sh index e42980bf1a..cdb8fab3ce 100755 --- a/packages/OS400/initscript.sh +++ b/packages/OS400/initscript.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -120,6 +120,7 @@ action_needed() { [ ! -e "${1}" ] && return 0 [ -n "${2}" ] || return 1 + # shellcheck disable=SC3013 [ "${1}" -ot "${2}" ] && return 0 return 1 } @@ -276,15 +277,16 @@ get_make_vars() { eval "$(sed -e ': begin' \ - -e '/\\\\$/{' \ + -e '/\\$/{' \ -e 'N' \ - -e 's/\\\\\\n/ /' \ + -e 's/\\\n/ /' \ -e 'b begin' \ -e '}' \ - -e '/^[A-Za-z_][A-Za-z0-9_]*[[:space:]]*=/!d' \ - -e 's/@\\([A-Za-z0-9_]*\\)@/${\\1}/g' \ - -e 's/[[:space:]]*=[[:space:]]*/=/' \ - -e 's/=\\(.*[^[:space:]]\\)[[:space:]]*$/=\\"\\1\\"/' \ - -e 's/\\\$(\\([^)]*\\))/\${\\1}/g' \ - < \""${1}"\")" + -e 's/[[:space:]][[:space:]]*/ /g' \ + -e '/^[A-Za-z_][A-Za-z0-9_]* *=/!d' \ + -e 's/@\([A-Za-z0-9_]*\)@/${\1}/g' \ + -e 's/ *= */=/' \ + -e 's/=\(.*[^ ]\) *$/="\1"/' \ + -e 's/\$(\([^)]*\))/${\1}/g' \ + < "${1}")" } diff --git a/packages/OS400/make-include.sh b/packages/OS400/make-include.sh index 6f092c4845..e30e950539 100755 --- a/packages/OS400/make-include.sh +++ b/packages/OS400/make-include.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/packages/OS400/make-lib.sh b/packages/OS400/make-lib.sh index d2f467feaa..e7b5b519e7 100755 --- a/packages/OS400/make-lib.sh +++ b/packages/OS400/make-lib.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/packages/OS400/make-src.sh b/packages/OS400/make-src.sh index c58b1c1864..6775f98bd3 100755 --- a/packages/OS400/make-src.sh +++ b/packages/OS400/make-src.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | diff --git a/packages/OS400/make-tests.sh b/packages/OS400/make-tests.sh index c76a8f60e7..8ff64d2fb8 100755 --- a/packages/OS400/make-tests.sh +++ b/packages/OS400/make-tests.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| | @@ -104,10 +104,10 @@ build_all_programs() if [ -n "${LINK}" ] then PGMLDADD="$(eval echo "\${${PGM}_LDADD}")" - for ARG in ${PGMLDADD} - do case "${ARG}" in + for M in ${PGMLDADD} + do case "${M}" in -*) ;; # Ignore non-module. - *) MODULES="${MODULES} $(db2_name "${ARG}")" + *) MODULES="${MODULES} $(db2_name "${M}")" ;; esac done diff --git a/packages/OS400/makefile.sh b/packages/OS400/makefile.sh index 777cf026fb..e58b835e1f 100755 --- a/packages/OS400/makefile.sh +++ b/packages/OS400/makefile.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh #*************************************************************************** # _ _ ____ _ # Project ___| | | | _ \| |