diff options
-rw-r--r-- | bin/sh/arith_yacc.c | 2 | ||||
-rw-r--r-- | tools/regression/bin/sh/expansion/set-u3.0 | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/bin/sh/arith_yacc.c b/bin/sh/arith_yacc.c index edb321f..63f236c 100644 --- a/bin/sh/arith_yacc.c +++ b/bin/sh/arith_yacc.c @@ -97,6 +97,8 @@ static arith_t arith_lookupvarint(char *varname) arith_t result; str = lookupvar(varname); + if (uflag && str == NULL) + yyerror("variable not set"); if (str == NULL || *str == '\0') str = "0"; errno = 0; diff --git a/tools/regression/bin/sh/expansion/set-u3.0 b/tools/regression/bin/sh/expansion/set-u3.0 new file mode 100644 index 0000000..7f199b4 --- /dev/null +++ b/tools/regression/bin/sh/expansion/set-u3.0 @@ -0,0 +1,6 @@ +# $FreeBSD$ + +set -u +unset x +v=$( (eval ': $((x))') 2>&1 >/dev/null) +[ $? -ne 0 ] && [ -n "$v" ] |