diff --git a/src/cmd/INIT/include/link_ar.mam b/src/cmd/INIT/include/link_ar.mam index f87b24ee17a1..bec1cc25ac14 100644 --- a/src/cmd/INIT/include/link_ar.mam +++ b/src/cmd/INIT/include/link_ar.mam @@ -16,19 +16,21 @@ exec - fi || exit note * Sometimes, obsolete object files can interfere due to intercepts, so note * delete any old object files that we no longer build from the archive +exec - set +x # avoid noisy log exec - to_delete= exec - for o in $(ar -t %{@}) exec - do case $o in exec - *.o) case ' %{^} ' in exec - *" $o "*) exec - ;; -exec - *) to_delete="${to_delete-} $o" +exec - *) to_delete="$to_delete $o" exec - ;; exec - esac exec - ;; exec - esac exec - done exec - case ${to_delete:+y} in -exec - y) ar -d %{@} $to_delete +exec - y) set -x +exec - ar -d %{@} $to_delete exec - ;; exec - esac diff --git a/src/cmd/INIT/mkdeps.sh b/src/cmd/INIT/mkdeps.sh index 3c6a27888305..44c87748d23f 100755 --- a/src/cmd/INIT/mkdeps.sh +++ b/src/cmd/INIT/mkdeps.sh @@ -46,7 +46,7 @@ note() printf "$0: %s\\n" "$@" >&2 } -err_out() +error_out() { note "$@" exit 3 diff --git a/src/cmd/ksh93/sh/array.c b/src/cmd/ksh93/sh/array.c index cf1927589fd6..db20e8730e96 100644 --- a/src/cmd/ksh93/sh/array.c +++ b/src/cmd/ksh93/sh/array.c @@ -1222,8 +1222,6 @@ Namval_t *nv_putsub(Namval_t *np,char *sp,long mode) ap->header.nelem++; } } - if(n=ap->maxi-ap->maxi) - memset(&ap->val[size], 0, n * sizeof(void*)); } else if(!(sp = ap->val[size]) || sp==Empty) { diff --git a/src/cmd/ksh93/tests/arith.sh b/src/cmd/ksh93/tests/arith.sh index dd42b419eeff..008a5c86a7cc 100755 --- a/src/cmd/ksh93/tests/arith.sh +++ b/src/cmd/ksh93/tests/arith.sh @@ -982,14 +982,14 @@ float x # Test for a bug with short integers that causes core dumps # (backported from ksh93v- 2013-08-07). "$SHELL" <<- \EOF || err_exit 'detected short integer bug that causes core dumps' - typeset -s -i -a t - typeset -s -i p - (( p=2**17 )) # tape start position - (( t[p]+=13)) - while (( t[p] != 0 )) - do ((t[p]-=1 , p+=1)) - done - exit 0 + typeset -s -i -a t + typeset -s -i p + (( p=2**17 )) # tape start position + (( t[p]+=13)) + while (( t[p] != 0 )) + do ((t[p]-=1 , p+=1)) + done + exit 0 EOF # ====== diff --git a/src/cmd/ksh93/tests/comvario.sh b/src/cmd/ksh93/tests/comvario.sh index 11523f96ba01..83b5c2fd5bda 100755 --- a/src/cmd/ksh93/tests/comvario.sh +++ b/src/cmd/ksh93/tests/comvario.sh @@ -41,7 +41,7 @@ function count_brackets (( bracketstat.bopen=0 , bracketstat.bclose=0 )) for (( i=0 ; i < ${#x} ; i++ )) ; do - c="${x:i:1}" + c="${x:i:1}" [[ "$c" == '(' ]] && (( bracketstat.bopen++ )) [[ "$c" == ')' ]] && (( bracketstat.bclose++ )) done @@ -132,7 +132,7 @@ s=${ float my_nan=-nan ) [a_hexfloat]=( - typeset -X my_hexfloat=1.1 + typeset -X my_hexfloat=1.1 ) ) ) @@ -197,7 +197,7 @@ s=${ float my_nan=-nan ) [a_hexfloat]=( - typeset -X my_hexfloat=1.1 + typeset -X my_hexfloat=1.1 ) ) ) @@ -274,7 +274,7 @@ compound x=( float my_nan=-nan ) [a_hexfloat]=( - typeset -X my_hexfloat=1.1 + typeset -X my_hexfloat=1.1 ) ) ) @@ -389,7 +389,7 @@ function test6 nameref test=tests[testid] typeset testname="test2/${testid}" - out.stderr="${ { out.stdout="${ ${SHELL} -c "${test.cmd}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" + out.stderr="${ { out.stdout="${ ${SHELL} -c "${test.cmd}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" (( out.res == 0 )) || err_exit "${testname}: Test shell returned with exit code ${out.res}" [[ "${out.stdout}" == ${test.stdoutpattern} ]] || err_exit "${testname}: Expected match for ${test.stdoutpattern}, got $(printf "%q\n" "${out.stdout}")" @@ -421,7 +421,7 @@ function test_3D_array_read_C for (( i=0 ; i < ${#tests[@]} ; i++ )) ; do out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -c "${tests[i]}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" - [[ "${out.stdout}" == '' ]] || err_exit "$0/${i}: Expected empty stdout, got $(printf '%q\n' "${out.stdout}")" + [[ "${out.stdout}" == '' ]] || err_exit "$0/${i}: Expected empty stdout, got $(printf '%q\n' "${out.stdout}")" [[ "${out.stderr}" == '' ]] || err_exit "$0/${i}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" done @@ -441,7 +441,7 @@ function test_access_2Darray_in_type_in_compound for (( i=0 ; i < ${#tests[@]} ; i++ )) ; do out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -c "${tests[i]}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" - [[ "${out.stdout}" == '' ]] || err_exit "$0/${i}: Expected empty stdout, got $(printf '%q\n' "${out.stdout}")" + [[ "${out.stdout}" == '' ]] || err_exit "$0/${i}: Expected empty stdout, got $(printf '%q\n' "${out.stdout}")" [[ "${out.stderr}" == '' ]] || err_exit "$0/${i}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" done @@ -498,7 +498,7 @@ print -v c2 out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -c "${test}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" [[ "${out.stdout}" != '' ]] || err_exit "$0: Expected nonempty stdout." - [[ "${out.stderr}" == '' ]] || err_exit "$0: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" + [[ "${out.stderr}" == '' ]] || err_exit "$0: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" return 0 } diff --git a/src/cmd/ksh93/tests/math.sh b/src/cmd/ksh93/tests/math.sh index edb46318e587..a277e83df2ef 100755 --- a/src/cmd/ksh93/tests/math.sh +++ b/src/cmd/ksh93/tests/math.sh @@ -142,8 +142,8 @@ function test_arithmetic_expression_access_array_element_through_nameref out.stderr="${ { out.stdout="${ ${SHELL} -o nounset -o errexit -c "${cmd}" ; (( out.res=$? )) ; }" ; } 2>&1 ; }" ((xtrace)) && set -x - [[ "${out.stdout}" == ${tst.stdoutpattern} ]] || err_exit "${testname}: Expected stdout to match $(printf '%q\n' "${tst.stdoutpattern}"), got $(printf '%q\n' "${out.stdout}")" - [[ "${out.stderr}" == '' ]] || err_exit "${testname}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" + [[ "${out.stdout}" == ${tst.stdoutpattern} ]] || err_exit "${testname}: Expected stdout to match $(printf '%q\n' "${tst.stdoutpattern}"), got $(printf '%q\n' "${out.stdout}")" + [[ "${out.stderr}" == '' ]] || err_exit "${testname}: Expected empty stderr, got $(printf '%q\n' "${out.stderr}")" (( out.res == 0 )) || err_exit "${testname}: Unexpected exit code ${out.res}" done done diff --git a/src/cmd/ksh93/tests/subshell.sh b/src/cmd/ksh93/tests/subshell.sh index bc6399c9688a..7132949ae850 100755 --- a/src/cmd/ksh93/tests/subshell.sh +++ b/src/cmd/ksh93/tests/subshell.sh @@ -1121,7 +1121,7 @@ e2=$( (ulimit -t unlimited 2>/dev/null; f() { return 267; }; f); echo $? ) # effects of .sh.value on shared-state command substitutions. function foo { - .sh.value=bam + .sh.value=bam } got=${ foo; } [[ $got ]] && err_exit "setting .sh.value in a function affects shared-state command substitution output when it shouldn't print anything" \