From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28953 invoked by alias); 9 Mar 2013 10:34:02 -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: 31129 Received: (qmail 11036 invoked from network); 9 Mar 2013 10:33:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.178 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=fiHTuQHzANr2Bh5+1mVB/RQkAEINkFTgIWwxwUXU9xU=; b=J6OJ6Pm/V9KV/VnbpZ58dc2F8uVgw72k0zHHhkQSpIrvdVhySqZJQyhZp4lrmt03F+ lgnL69UbGcpJPqkkHOAuHt98+DL759IWffO2VSEy/9vQBrEx0XGOZGSA+jOKGPWaSY+t 0C2u3vWw874ikOmZcsAP+YP8I4E54qQ0dzdqY8+kdjwgrcSZtyA8SBblZ4Yc2tIcSeXn ZrXXWRNtJCQwsUEymSVMVBbKQ3R3c6h8RY+eUL3febfSYZCfWw71VRRD+5lMZ2QQYCxZ cy8JrgW8d9PoUkriUgSIevnO7MERGv4sAqs6ehV6mPF6OBFR3AdvukJTmCXFDwK83Hu0 urtw== MIME-Version: 1.0 X-Received: by 10.52.24.114 with SMTP id t18mr1920029vdf.62.1362825219105; Sat, 09 Mar 2013 02:33:39 -0800 (PST) Date: Sat, 9 Mar 2013 11:33:38 +0100 Message-ID: Subject: Somewhat unexpected results of {myfd}>&1 when noclobber set From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 (You can skip this most of this part, just included some variations for fun) % setopt noclobber % : {foo}>&1 % echo $foo 15 % bar=7+8 % : {bar}>&1 zsh: can't clobber parameter bar containing file descriptor 15 % bar=foo % : {bar}>&1 zsh: can't clobber parameter bar containing file descriptor 15 % bar=( 14 15 ) % : {bar}>&1 zsh: bad math expression: operator expected at `15' % echo $bar 16 % bar=foo % : {bar}>&1 zsh: can't clobber parameter bar containing file descriptor 15 % foo= % : {bar}>&1 zsh: can't clobber parameter bar containing file descriptor 15 % echo $bar 15 (at this point bar somehow became of type "integer", i think after it was an array, so the earlier assignment bar=foo resolved foo to 15). Of course, all these are the result of the fact that when the clobbering is checked, the parameter name is passed to getintvalue() which does mathevali() on the contents (possibly after joining if it was an array). Should we perhaps instead explicitly check that the parameter is a) a scalar b) just do atoi() or whichever function is best for this, and compare directly? I think it's at least not expected that this parameter is only subject to math evaluation if the clobber option is unset. -- Mikael Magnusson