From: Bart Schaefer <schaefer@brasslantern.com>
To: dana <dana@dana.is>
Cc: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: [BUG] Tied parameters not restored correctly after pre-command re-assignment
Date: Fri, 8 Dec 2017 16:23:12 -0800 [thread overview]
Message-ID: <CAH+w=7a+b8uTROVFOM10pxDCUP0=znT28tkcjqyiaLwzCrRDRw@mail.gmail.com> (raw)
In-Reply-To: <92FCFBAE-158C-4339-B374-275FD6ACDBE6@dana.is>
On Fri, Dec 8, 2017 at 2:51 PM, dana <dana@dana.is> wrote:
>
> I found that, in 5.4.1 and 5.4.2-dev, tied parameters are not restored correctly
> to their previous values if re-assigned in this way after calling a shell
> function or built-in
Several things: One, there's no implication that assigning to the
array part of a tied variable will have any effect on the environment
value of the scalar part unless you've explicitly exported the scalar.
Two, exporting arrays is unsupported / undefined behavior, so using
an array assignment as a command prefix is only sensible in contexts
where all the execution takes place within the current shell (except
see also item one). Three, if POSIX_BUILTINS is set there are
different rules for how prefix assignments are handled for certain
builtins vs. other cases, so you can't generalize from any particular
experiment.
% which printenv
/usr/bin/printenv
% typeset -xT ABC abc
% abc=(a b c) printenv ABC
a:b:c
% typeset -p ABC
export ABC=''
% typeset -T CBA cba
% cba=(c b a) printenv CBA
%
> % arr=( b c ) typeset -p SCA
> typeset SCA=b:c
> % typeset -p SCA
> typeset: no such variable: SCA
This works correctly if POSIX_BUILTINS is set, so I would guess it has
some relation to the thread on zsh-workers about "local -r path".
next prev parent reply other threads:[~2017-12-09 0:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 22:51 dana
2017-12-09 0:23 ` Bart Schaefer [this message]
2017-12-09 0:47 ` dana
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='CAH+w=7a+b8uTROVFOM10pxDCUP0=znT28tkcjqyiaLwzCrRDRw@mail.gmail.com' \
--to=schaefer@brasslantern.com \
--cc=dana@dana.is \
--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).