From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15926 invoked by alias); 1 Jan 2016 20:03:42 -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: 37472 Received: (qmail 2970 invoked from network); 1 Jan 2016 20:03:38 -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 autolearn=ham autolearn_force=no version=3.4.0 Message-ID: <5686DB95.2090602@inlv.org> Date: Fri, 01 Jan 2016 21:03:33 +0100 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: [BUG] emulate sh: arith assignment assigns variable type Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit When an assignment is done to an unset variable using an arithmetic expression, zsh assigns a numerical or arithmetic type to that variable, causing subsequent normal shell assignments to be interpreted as arithmetic expressions. This causes an incompatibility with other shells under 'emulate sh', because the POSIX shell is supposed to be a typeless language. In sh emulation mode, arithmetic assignment should not assign a variable type. Steps to reproduce: $ emulate sh $ X=a:b:c $ : $((X=1)) # no type assignment as variable was already et $ X=a:b:c $ unset X $ : $((X=1)) # variable now restricted to arith expressions $ X=a:b:c zsh: bad math expression: ':' without '?' Expected behaviour: the last assignment should succeed in sh emulation mode (and does on all other shells). Confirmed in zsh 4.1.1 through current. Thanks, and happy new year. - Martijn