diff options
author | jilles <jilles@FreeBSD.org> | 2014-02-27 16:54:43 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2014-02-27 16:54:43 +0000 |
commit | 6891107e84a00af969aa3f785a3ec4d8ba0bd96c (patch) | |
tree | f62b533b0847d74aafa265c7c1f443b4366f5e53 /bin/sh/tests/builtins | |
parent | 4b7832497af6863faa2c8175029568577873fff5 (diff) | |
download | FreeBSD-src-6891107e84a00af969aa3f785a3ec4d8ba0bd96c.zip FreeBSD-src-6891107e84a00af969aa3f785a3ec4d8ba0bd96c.tar.gz |
sh: Do not corrupt internal representation if LINENO inner expansion fails.
Example:
f() { : ${LINENO+$((1/0))}; }
and call this function twice.
Diffstat (limited to 'bin/sh/tests/builtins')
-rw-r--r-- | bin/sh/tests/builtins/Makefile | 1 | ||||
-rw-r--r-- | bin/sh/tests/builtins/lineno2.0 | 10 |
2 files changed, 11 insertions, 0 deletions
diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile index 3b1d24b..6f60f84 100644 --- a/bin/sh/tests/builtins/Makefile +++ b/bin/sh/tests/builtins/Makefile @@ -87,6 +87,7 @@ FILES+= hash4.0 FILES+= jobid1.0 FILES+= jobid2.0 FILES+= lineno.0 lineno.0.stdout +FILES+= lineno2.0 FILES+= local1.0 FILES+= local2.0 FILES+= local3.0 diff --git a/bin/sh/tests/builtins/lineno2.0 b/bin/sh/tests/builtins/lineno2.0 new file mode 100644 index 0000000..ddbd104 --- /dev/null +++ b/bin/sh/tests/builtins/lineno2.0 @@ -0,0 +1,10 @@ +# $FreeBSD$ + +f() { + : ${LINENO+${x?}} +} + +unset -v x +command eval f 2>/dev/null && exit 3 +x=1 +f |