zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] posix_builtins: allow exporting a reaonly
Date: Wed, 18 Apr 2018 21:58:14 +0200	[thread overview]
Message-ID: <1c9aa8c0-c8ee-564f-d351-461d4183d533@inlv.org> (raw)

[-- 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;
 	}

             reply	other threads:[~2018-04-18 19:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-18 19:58 Martijn Dekker [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c9aa8c0-c8ee-564f-d351-461d4183d533@inlv.org \
    --to=martijn@inlv.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).