Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG] Tied parameters not restored correctly after pre-command re-assignment
- X-seq: zsh-workers 42097
- From: dana <dana@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [BUG] Tied parameters not restored correctly after pre-command re-assignment
- Date: Fri, 8 Dec 2017 16:51:26 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=yNAE469D/R+UsqTfJDiSNO85XE4DunILUZDuV4ap9a4=; b=gqkvwhyiCeEAbndxBhvTePOPQ1qOSRMfhDoU/E0HdEh1yjU8Kcw2LxnBcoXz7cgV1j a/9ffpNYsPmRNefRWELvOkyKqYwzLPbcGJhs4CvXfpDuW/8ts5hJu5MlqENiu6cLDfUb uXXWs4ygdFjrQGpc52FgYB73FqonxLRW0US/mrOjFQ2kIvDEst8ayyP3ilnx6J/fHO7V KlitATkZe8+4LdbyVtAe3CFoRelt6Pfurz2Ljjz/F2Jrd3qVbbAKb4dNm/CaZRcnUja9 FtIWModqyn2waqqwvcEE+Knncv3elruSbu5245chTrKNiRkSJRg8S7q242nIktrD0Q/S QWbg==
- 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
Daniel's recent message to zsh-users got me experimenting with the use of tied
parameters in 'pre-command' re-assignments (i.e., the `foo=bar baz` form of
command).
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:
% typeset -T SCA arr
% arr=( a b )
% arr=( b c ) typeset -p SCA
typeset SCA=b:c
% typeset -p SCA
typeset: no such variable: SCA
(It works the other way around too — with `SCA=b:c ...` it will unset arr.)
It seems that the restoration process simply doesn't concern itself with tied
parameters. It unsets the other parameter, but then there's nothing there to set
it back. I wasn't successful in trying to figure out exactly where it could be
fixed, but i see at least that the reason it unsets the other parameter is the
call to unsetparam_pm() in restore_params().
This doesn't happen when calling external commands, since the restoration isn't
relevant there. However, i also don't get the behaviour that i expect (which is
the scalar being passed down through the environment):
% typeset -T SCA arr
% arr=( a b )
% arr=( b c ) zsh -fc 'print -r -- ${SCA:--}'
-
% typeset -p SCA
typeset SCA=a:b
I guess that's probably a separate thing though.
Anyway, kind of esoteric, but idk, seems like misbehaviour.
dana
Messages sorted by:
Reverse Date,
Date,
Thread,
Author