Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] Tied parameters not restored correctly after pre-command re-assignment
- X-seq: zsh-workers 42098
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: dana <dana@xxxxxxx>
- Subject: Re: [BUG] Tied parameters not restored correctly after pre-command re-assignment
- Date: Fri, 8 Dec 2017 16:23:12 -0800
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2Wavx5XUqSheZBW52608pPxs0wtTgFkd6KBJSzodPvw=; b=EiBTt3lZCTb3shGgQi6DPgrOfLO5z9TIEqVnldm+uNUTcC74MPxEkKqTXU992x6dEB oQGFmlmjcO/44WFScvZ6tbLqWYNnGXnpfVlE0RgnSfjkja3SyA3JFV598FxBL6roGsRZ LscZprVi/4tfZd0arWn5kPsSx8/GTb32dTMeUSm6Fkjz92ihduTRJ1WglUFqpNKDHU2E B/k8OYpWX+c1l5gtfwzwiL3RZO2L43tjLx15R+NYZyVvutSa/LwGCHphtfMiYeBTf2J9 DxLvl68QXu6tgorvi2Z3JE39aZZIwHBpsnVH0K6aaiTO8kqh0NKMRM8Xu+3wZl84LVzw njiw==
- In-reply-to: <92FCFBAE-158C-4339-B374-275FD6ACDBE6@dana.is>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <92FCFBAE-158C-4339-B374-275FD6ACDBE6@dana.is>
On Fri, Dec 8, 2017 at 2:51 PM, dana <dana@xxxxxxx> 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".
Messages sorted by:
Reverse Date,
Date,
Thread,
Author