From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] posix_builtins: allow exporting a readonly
Date: Sat, 22 Jun 2019 12:54:34 +0100 [thread overview]
Message-ID: <0fec611f-02b3-8047-3048-30059d7256d8@inlv.org> (raw)
In-Reply-To: <1561107544.12694.12.camel@samsung.com>
[-- Attachment #1: Type: text/plain, Size: 817 bytes --]
Op 21-06-19 om 09:59 schreef Peter Stephenson:
> On Thu, 2019-06-20 at 19:47 +0100, Martijn Dekker wrote:
>> Op 18-04-18 om 20:58 schreef Martijn Dekker:
>>>
>>> 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.
>> This seems to have been forgotten about, so I'm trying again.
>>
>> To recap:
>>
>> $ zsh -c 'readonly foo=123; export foo' # OK
>> $ zsh --emulate sh -c 'readonly foo=123; export foo' # BUG
>> zsh:1: read-only variable: foo
>>
>> I had another look at it and I think this patch (attached) should be
>> even more straightforward.
>
> This sounds fine but I don't think there is an attachment.
Woops. :-/
Here it is...
- M.
[-- Attachment #2: BUG_NOEXPRO.patch --]
[-- Type: text/plain, Size: 459 bytes --]
diff --git a/Src/builtin.c b/Src/builtin.c
index 2453f82c0..e863cc4bb 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2171,7 +2171,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) && func != BIN_EXPORT) {
zerr("read-only variable: %s", pm->node.nam);
return NULL;
}
prev parent reply other threads:[~2019-06-22 11:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=0fec611f-02b3-8047-3048-30059d7256d8@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).