zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] posix_builtins: allow exporting a reaonly
@ 2018-04-18 19:58 Martijn Dekker
  2018-04-18 20:07 ` Bart Schaefer
  2019-06-20 18:47 ` [PATCH] posix_builtins: allow exporting a readonly Martijn Dekker
  0 siblings, 2 replies; 6+ messages in thread
From: Martijn Dekker @ 2018-04-18 19:58 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

POSIX_BUILTINS incorrectly prohibits exporting a readonly variable. All 
other POSIX shells allow this and there is nothing in the POSIX text[*] 
that says it's not allowed. The attached patch fixes this.

Thanks,

- M.

[*] 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_22

[-- Attachment #2: export-readonly.patch --]
[-- Type: text/plain, Size: 456 bytes --]

diff --git a/Src/builtin.c b/Src/builtin.c
index 73cfe7a..a75c4b2 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2169,7 +2169,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 	    !ASG_VALUEP(asg))
 	    on |= PM_UNSET;
 	else if (usepm && (pm->node.flags & PM_READONLY) &&
-		 !(on & PM_READONLY)) {
+		 !(on & PM_READONLY) && !(on & PM_EXPORTED)) {
 	    zerr("read-only variable: %s", pm->node.nam);
 	    return NULL;
 	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-06-22 11:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 19:58 [PATCH] posix_builtins: allow exporting a reaonly Martijn Dekker
2018-04-18 20:07 ` Bart Schaefer
2018-04-21 12:57   ` Martijn Dekker
2019-06-20 18:47 ` [PATCH] posix_builtins: allow exporting a readonly Martijn Dekker
2019-06-21  8:59   ` Peter Stephenson
2019-06-22 11:54     ` Martijn Dekker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).