From bf258a1c07a9cf1119f83d1d15310b02b94f4d67 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 29 Apr 2015 15:54:49 +0100 Subject: 34992: POSIX fix for readonly variables. With POSIXBUILTINS, variables can be marked readonly if unset. Also, variables can't have the readonly flag removed. --- Test/B02typeset.ztst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'Test') diff --git a/Test/B02typeset.ztst b/Test/B02typeset.ztst index 51ebc6535..f4fb8ecb9 100644 --- a/Test/B02typeset.ztst +++ b/Test/B02typeset.ztst @@ -468,3 +468,20 @@ 0:retying arrays to same array works >foo bar >goo car + + ( + setopt POSIXBUILTINS + readonly pbro + print ${+pbro} >&2 + (typeset pbro=3) + (pbro=4) + typeset -r pbro # idempotent (no error)... + print ${+pbro} >&2 # ...so still readonly... + typeset +r pbro # ...can't turn it off + ) +1:Readonly with POSIX_BUILTINS +?0 +?(eval):5: read-only variable: pbro +?(eval):6: read-only variable: pbro +?0 +?(eval):9: read-only variable: pbro -- cgit 1.4.1