[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: return value of expr



On Wed 24 Nov 1999, Nils Rennebarth wrote:

> expr states in its info page:
> 
>    Exit status:
> 
>      0 if the expression is neither null nor 0,
>      1 if the expression is null or 0,
>      2 for invalid expressions.
> 
> However shellutils 2.0-3 contains in the changelog
> 
> shellutils (2.0-3) unstable; urgency=low
> 
>   * New maintainer
>   * Fixed date-examples in infopages, Closes: Bug# 32130
>   * expr.c: don't return with an errorcode if the result is 0
>     Closes: Bug# 50697

That's what one gets for blindly fixing bugs without checking the
validity of the bug.

> A "lot" of shellscripts will break and *do* break. Most prominent example
> is MAKEFLOPPIES. Please resolve this issue and revert the change.

Also the device.xxx scripts in isdnutils.

> expr should probably return 0 if the result is zero only on arithmetical
> expressions. What do the standards say?

See http://www.opengroup.org/onlinepubs/7908799/xcu/expr.html
where the info page text is the same (i.e. 0 if the expression is
neither null nor 0, 1 if the expression is null or 0, etc.).
This is also the way it works on all other unixen.

Do not change the way expr works traditionally, even if thats seems
to be incorrect; you'll break many scripts in interesting ways.


Paul Slootman
-- 
home:       paul@wurtel.demon.nl http://www.wurtel.demon.nl/
work:       paul@murphy.nl       http://www.murphy.nl/
debian:     paul@debian.org      http://www.debian.org/
isdn4linux: paul@isdn4linux.de   http://www.isdn4linux.de/


Reply to: