summaryrefslogtreecommitdiffstats
path: root/bin/sh/tests
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2016-01-22 20:10:08 +0000
committerjilles <jilles@FreeBSD.org>2016-01-22 20:10:08 +0000
commite81a328bbdaf3074c8509065e2a0b0e8b8b6116f (patch)
tree43ee86b07eb10ad8ab7029e64ebf416c8fc9e6b9 /bin/sh/tests
parente270f2d00ed1836c651e7c382050e15d534383a1 (diff)
downloadFreeBSD-src-e81a328bbdaf3074c8509065e2a0b0e8b8b6116f.zip
FreeBSD-src-e81a328bbdaf3074c8509065e2a0b0e8b8b6116f.tar.gz
sh: Clean a readonly local, even if the variable does not exist outside.
If a local variable has been made read-only, this should not prevent its removal when the function returns.
Diffstat (limited to 'bin/sh/tests')
-rw-r--r--bin/sh/tests/builtins/Makefile1
-rw-r--r--bin/sh/tests/builtins/local7.010
2 files changed, 11 insertions, 0 deletions
diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile
index 4d94d94..4811bb3 100644
--- a/bin/sh/tests/builtins/Makefile
+++ b/bin/sh/tests/builtins/Makefile
@@ -113,6 +113,7 @@ FILES+= local3.0
FILES+= local4.0
FILES+= local5.0
FILES+= local6.0
+FILES+= local7.0
.if ${MK_NLS} != "no"
FILES+= locale1.0
.endif
diff --git a/bin/sh/tests/builtins/local7.0 b/bin/sh/tests/builtins/local7.0
new file mode 100644
index 0000000..f7e6fc0
--- /dev/null
+++ b/bin/sh/tests/builtins/local7.0
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+f() {
+ local x
+ readonly x=2
+}
+unset x
+f
+x=4
+[ "$x" = 4 ]
OpenPOWER on IntegriCloud