diff --git a/frontend/option_def.py b/frontend/option_def.py index 8be76e022e..1e92ee0963 100644 --- a/frontend/option_def.py +++ b/frontend/option_def.py @@ -229,9 +229,9 @@ def _Init(opt_def): # shopt options that aren't in any groups. opt_def.Add('failglob') # not implemented. - # TODO: Rename eval_unsafe_arith opt_def.Add('eval_unsafe_arith') # recursive parsing and evaluation (ble.sh) - opt_def.Add('parse_dynamic_arith') # dyanmic LHS + opt_def.Add('parse_dynamic_arith') # dynamic LHS + opt_def.Add('compat_array') # ${array} is ${array[0]} # Two strict options that from bash's shopt for name in ['nullglob', 'inherit_errexit']: diff --git a/spec/introspect.test.sh b/spec/introspect.test.sh index 0b8a61b534..e4d12c2dba 100644 --- a/spec/introspect.test.sh +++ b/spec/introspect.test.sh @@ -139,14 +139,37 @@ ____ ['11'] ## END + #### ${FUNCNAME} with prefix/suffix operators (OSH regression) +shopt -s compat_array + +check() { + argv.py "${#FUNCNAME}" + argv.py "${FUNCNAME::1}" + argv.py "${FUNCNAME:1}" +} +check +## STDOUT: +['5'] +['c'] +['heck'] +## END + +#### operators on FUNCNAME not allowed by default check() { + argv.py "${FUNCNAME}" argv.py "${#FUNCNAME}" argv.py "${FUNCNAME::1}" argv.py "${FUNCNAME:1}" } check +## status: 1 ## STDOUT: +['check'] +## END +## OK bash status: 0 +## OK bash STDOUT: +['check'] ['5'] ['c'] ['heck'] diff --git a/test/spec.sh b/test/spec.sh index 8a753c029b..4f4fee4ce8 100755 --- a/test/spec.sh +++ b/test/spec.sh @@ -533,7 +533,7 @@ special-vars() { } introspect() { - sh-spec spec/introspect.test.sh --no-cd-tmp \ + sh-spec spec/introspect.test.sh --no-cd-tmp --osh-failures-allowed 1 \ $BASH $OSH_LIST "$@" }