zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [bug] shift: shell exits with status 0 on bad math expression
Date: Wed, 20 Jun 2018 09:45:36 +0100	[thread overview]
Message-ID: <eceefa15-738b-2800-9865-4b3af2b6fb80@inlv.org> (raw)

When an argument is given to 'shift' that constitutes a bad math 
expression, the (sub)shell prints an error and exits, but the exit 
status is zero (= success) under most conditions.

$ zsh -c 'shift @/@'; echo $?
zsh:1: bad math expression: illegal character: @
0
$ zsh -c 'builtin shift @/@'; echo $?
zsh:1: bad math expression: illegal character: @
0
$ zsh -c 'emulate sh; shift @/@'; echo $?
zsh:1: bad math expression: illegal character: @
1
$ zsh -c 'emulate sh; command shift @/@'; echo $?
zsh:1: bad math expression: illegal character: @
0

The exit status should be non-zero in all cases.

The behaviour is the same from current git down to zsh 5.0.7, the 
earliest version I tested.

- M.


             reply	other threads:[~2018-06-20  8:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180620090022epcas1p4700aca92f8b52c669c5ac10165a6ce80@epcas1p4.samsung.com>
2018-06-20  8:45 ` Martijn Dekker [this message]
2018-06-20  9:12   ` Peter Stephenson

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=eceefa15-738b-2800-9865-4b3af2b6fb80@inlv.org \
    --to=martijn@inlv.org \
    --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).