[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ksh (pdksh) bug
On Fri, 2 Apr 2004, Arkadiusz Miskiewicz wrote:
> Hi
>
> It seems that current /bin/sh on openbsd (pdksh) has one bug in evaluation of
> expressions support. It doesn't support hexadecimal values.
>
> I'm not using OpenBSD but I asked one guy to do testing:
> $ /bin/sh
> $ echo $((0xff))
> /bin/sh: 0xff: bad number `0xff'
> $
> # uname -a
> OpenBSD testes.xx.xx 3.4 jpillati#0 i386
>
> SUSv3 says
> ,,Only the decimal-constant, octal-constant, and hexadecimal-constant
> constants specified in the ISO C standard, Section 6.4.4.1 are required to be
> recognized as constants.''
>
> http://www.opengroup.org/onlinepubs/007904975/utilities/xcu_chap02.html#tag_02_06_04
Yes, our sh seems to do this wrong. Will try to look into this.
>
> Also it seem to overflow:
> $ echo $((16#ffffffff))
> -1
Well, sh is supposed to do signed arithmetic following C rules, so
16#ffffffff == -1 is ok, i think.
-Otto