Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Strange regression in zsh-git with redirecting output of 'readonly'
- X-seq: zsh-workers 35640
- From: Martijn Dekker <martijn@xxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Strange regression in zsh-git with redirecting output of 'readonly'
- Date: Sun, 28 Jun 2015 00:19:19 +0200
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
There's a regression in current zsh git version: attempting to
redirecting the output of a "readonly" with assignment argument (i.e. a
potential error message) causes at least three kinds of different and
unpredictable strange behaviour. But in all three cases, the command
fails to work. In zsh 5.0.8 and earlier, all this works fine.
First manifestation:
On my Mac, when standard output is redirected, the command does
absolutely nothing. The variable is not assigned or even set.
% readonly var=testvalue >/dev/null
% echo ${var+set}
%
Second manifestation:
When redirecting standard error instead, something very strange happens.
But the variable is still not assigned or set.
% readonly var=testvalue 2>/dev/null
'!'=0
'#'=0
'$'=66831
'*'=()
-=bims
'?'=0
@=()
ARGC=0
HISTCMD=6
LINENO=6
PPID=81942
TTYIDLE=0
ZSH_EVAL_CONTEXT=toplevel
ZSH_SUBSHELL=0
status=0
zsh_eval_context=(toplevel)
% echo ${var+set}
%
Third manifestation:
In the initialization routine of the cross-platform shell library I'm
developing, I redirect standard error of 'readonly' to suppress an error
message and then check the result to see if the current shell supports
assignment with the 'readonly' command (one of a number of POSIX
compliance checks). The library is loaded as a dot script. The readonly
command in that context gives different behaviour still:
% . modernish
/Users/martijn/bin/modernish:76: no such file or directory:
%
The shell exits immediately after producing this error. The 'readonly'
command is on line 76 (which references no file or directory at all), so
that's a third manifestation of strange behaviour. The relevant snippet
from my library, starting at line 76, is:
readonly MSH_VERSION=0.01dev 2>| /dev/null
test "${MSH_VERSION:-}" = 0.01dev || {
echo "[BUG000] 'readonly' command doesn't support assignment." 1>&2
_Msh_defect=y
}
Nevertheless, when I issue that same 'readonly' command in interactive
mode, that shell variable dump happens again:
% readonly MSH_VERSION=0.01dev 2>| /dev/null
'!'=0
'#'=0
'$'=66839
'*'=()
-=bims
'?'=0
@=()
ARGC=0
HISTCMD=1
LINENO=1
PPID=81942
TTYIDLE=0
ZSH_EVAL_CONTEXT=toplevel
ZSH_SUBSHELL=0
status=0
zsh_eval_context=(toplevel)
%
I hope this has been sufficient information to figure out what's going on.
Thanks,
- Martijn
Messages sorted by:
Reverse Date,
Date,
Thread,
Author