From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18606 invoked by alias); 27 Jun 2015 22:24:45 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35640 Received: (qmail 23840 invoked from network); 27 Jun 2015 22:24:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.0 Message-ID: <558F2167.5080902@inlv.org> Date: Sun, 28 Jun 2015 00:19:19 +0200 From: Martijn Dekker User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: zsh-workers@zsh.org Subject: Strange regression in zsh-git with redirecting output of 'readonly' Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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