From: dana <dana@dana.is>
To: zsh-workers@zsh.org
Subject: [BUG] Tied parameters not restored correctly after pre-command re-assignment
Date: Fri, 8 Dec 2017 16:51:26 -0600 [thread overview]
Message-ID: <92FCFBAE-158C-4339-B374-275FD6ACDBE6@dana.is> (raw)
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
next reply other threads:[~2017-12-08 22:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-08 22:51 dana [this message]
2017-12-09 0:23 ` Bart Schaefer
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=92FCFBAE-158C-4339-B374-275FD6ACDBE6@dana.is \
--to=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).