Re: bug in ksh?

2006-07-07 Thread Andrzej Krzysztofowicz
Jakub Bogusz wrote:
> On Fri, Jul 07, 2006 at 06:24:50PM +0200, Andrzej 'The Undefined' Dopierała 
> wrote:
> > On Fri, Jul 07, 2006 at 11:54:33AM +0100, wrobell wrote:
> > > > weirdy difference between sh from ksh and bash:
> > > > 
> > > > [EMAIL PROTECTED] ~]$ bash
> > > > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > > > works
> > > > [EMAIL PROTECTED] ~]$ sh
> > > > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > > > [EMAIL PROTECTED] ~]$ 
> > > > 
> > > > [EMAIL PROTECTED] ~]$ rpm -qf /bin/sh /bin/bash 
> > > > 
> > > > pdksh-5.2.14-43
> > > > bash-3.1.017-1
> > > 
> > > 32 bit unsigned int vs 32 bit signed int vs 64 bit long?
> > ano.
> > but - it works differrent on miscelious archs (on 64bits - works ok).
> > 
> > what is correct? bash or ksh behaviour?
> 
> I think bash is correct. But ksh may be correct too - see below.
> 
> > i think ksh behaviour is a bug...
> 
> Does POSIX/SUS specify what integer values should be supported?
> I can't find it now.
> 
> I assume that values larger than some value are allowed to give
> "undefined" results.

I think it is OK unless 64-bit arithmetic is explicitely required.
Older bash versions (see Ra) has the same behaviour AFAIR.

If a script needs 64-bit arithmetics, it should check whether it is
supported.

-- 
===
  Andrzej M. Krzysztofowicz  [EMAIL PROTECTED]
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Gdansk University of Technology
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: bug in ksh?

2006-07-07 Thread Jakub Bogusz
On Fri, Jul 07, 2006 at 07:53:41PM +0200, Andrzej 'The Undefined' Dopierała 
wrote:
> On Fri, Jul 07, 2006 at 06:40:47PM +0200, Jakub Bogusz wrote:
> > > i think ksh behaviour is a bug...
> > 
> > Does POSIX/SUS specify what integer values should be supported?
> > I can't find it now.
> > 
> > I assume that values larger than some value are allowed to give
> > "undefined" results.
> but it may confuse scripts who expect that it works "ok".  :/

How big numbers can scripts expect to work "ok"?

I found some rational (but unofficial) interpretation:

http://www.pasc.org/interps/unofficial/db/p1003.2/pasc-1003.2-208.html

 Add new paragraphs to rationale in the XRAT volume after P3523, L9347:
 Although the 1999 C Standard now requires support for long long
 and allows extended integer types with higher ranks, this
 standard only requires arithmetic expansions to support signed
 long integer arithmetic.  Implementations are encouraged to
 support signed integer values at least as large as the size of
 the largest file allowed on the implementation.

"signed long integer" is 32-bit on x86, 64-bit on x86_64.

We build pdksh _FILE_OFFSET_BITS=64, but "encouraged" is not "required".

> zsh, csh, tcsh works like bash.
> 
> so - fix it, or leave?

Feel encouraged to "fix" ;)


-- 
Jakub Boguszhttp://qboosh.cs.net.pl/
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: bug in ksh?

2006-07-07 Thread Andrzej 'The Undefined' Dopierała
On Fri, Jul 07, 2006 at 06:40:47PM +0200, Jakub Bogusz wrote:
> > i think ksh behaviour is a bug...
> 
> Does POSIX/SUS specify what integer values should be supported?
> I can't find it now.
> 
> I assume that values larger than some value are allowed to give
> "undefined" results.
but it may confuse scripts who expect that it works "ok".  :/

zsh, csh, tcsh works like bash.

so - fix it, or leave?

-- 
Andrzej 'The Undefined' Dopierała
UNIX && Linux administrator,  Adam Mickiewicz University WMiI
PLD Linux Developer  HomePage: http://andrzej.dopierala.name/
JID: [EMAIL PROTECTED] e-mail: [EMAIL PROTECTED]
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: bug in ksh?

2006-07-07 Thread Jakub Bogusz
On Fri, Jul 07, 2006 at 06:24:50PM +0200, Andrzej 'The Undefined' Dopierała 
wrote:
> On Fri, Jul 07, 2006 at 11:54:33AM +0100, wrobell wrote:
> > > weirdy difference between sh from ksh and bash:
> > > 
> > > [EMAIL PROTECTED] ~]$ bash
> > > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > > works
> > > [EMAIL PROTECTED] ~]$ sh
> > > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > > [EMAIL PROTECTED] ~]$ 
> > > 
> > > [EMAIL PROTECTED] ~]$ rpm -qf /bin/sh /bin/bash   
> > >   
> > > pdksh-5.2.14-43
> > > bash-3.1.017-1
> > 
> > 32 bit unsigned int vs 32 bit signed int vs 64 bit long?
> ano.
> but - it works differrent on miscelious archs (on 64bits - works ok).
> 
> what is correct? bash or ksh behaviour?

I think bash is correct. But ksh may be correct too - see below.

> i think ksh behaviour is a bug...

Does POSIX/SUS specify what integer values should be supported?
I can't find it now.

I assume that values larger than some value are allowed to give
"undefined" results.


-- 
Jakub Boguszhttp://qboosh.cs.net.pl/
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: bug in ksh?

2006-07-07 Thread wrobell
On Fri, 2006-07-07 at 18:24 +0200, Andrzej 'The Undefined' Dopierała
wrote:
> On Fri, Jul 07, 2006 at 11:54:33AM +0100, wrobell wrote:
> > > weirdy difference between sh from ksh and bash:
> > > 
> > > [EMAIL PROTECTED] ~]$ bash
> > > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > > works
> > > [EMAIL PROTECTED] ~]$ sh
> > > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > > [EMAIL PROTECTED] ~]$ 
> > > 
> > > [EMAIL PROTECTED] ~]$ rpm -qf /bin/sh /bin/bash   
> > >   
> > > pdksh-5.2.14-43
> > > bash-3.1.017-1
> > 
> > 32 bit unsigned int vs 32 bit signed int vs 64 bit long?
> ano.
> but - it works differrent on miscelious archs (on 64bits - works ok).
> 
> what is correct? bash or ksh behaviour?
> 
> i think ksh behaviour is a bug...

what posix says?

   wrobell <[EMAIL PROTECTED]>

___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: bug in ksh?

2006-07-07 Thread Andrzej 'The Undefined' Dopierała
On Fri, Jul 07, 2006 at 11:54:33AM +0100, wrobell wrote:
> > weirdy difference between sh from ksh and bash:
> > 
> > [EMAIL PROTECTED] ~]$ bash
> > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > works
> > [EMAIL PROTECTED] ~]$ sh
> > [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> > [EMAIL PROTECTED] ~]$ 
> > 
> > [EMAIL PROTECTED] ~]$ rpm -qf /bin/sh /bin/bash 
> > 
> > pdksh-5.2.14-43
> > bash-3.1.017-1
> 
> 32 bit unsigned int vs 32 bit signed int vs 64 bit long?
ano.
but - it works differrent on miscelious archs (on 64bits - works ok).

what is correct? bash or ksh behaviour?

i think ksh behaviour is a bug...

-- 
Andrzej 'The Undefined' Dopierała
UNIX && Linux administrator,  Adam Mickiewicz University WMiI
PLD Linux Developer  HomePage: http://andrzej.dopierala.name/
JID: [EMAIL PROTECTED] e-mail: [EMAIL PROTECTED]
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: bug in ksh?

2006-07-07 Thread Paweł Sikora
Dnia piątek, 7 lipca 2006 12:48, Andrzej 'The Undefined' Dopierała napisał:
> weirdy difference between sh from ksh and bash:
>
> [EMAIL PROTECTED] ~]$ bash
> [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> works
> [EMAIL PROTECTED] ~]$ sh
> [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> [EMAIL PROTECTED] ~]$
>
> [EMAIL PROTECTED] ~]$ rpm -qf /bin/sh /bin/bash
> pdksh-5.2.14-43
> bash-3.1.017-1

[ ac-amd64 ]
$ sh -c '[ "30" -ge "20" ] && echo works'
works
$ rpm -q pdksh
pdksh-5.2.14-43

[ th-x86_64 ]
$ sh -c '[ "30" -ge "20" ] && echo works'
works
$ rpm -q pdksh
pdksh-5.2.14-43.x86_64
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


Re: bug in ksh?

2006-07-07 Thread wrobell
On Fri, 2006-07-07 at 12:48 +0200, Andrzej 'The Undefined' Dopierała
wrote:
> weirdy difference between sh from ksh and bash:
> 
> [EMAIL PROTECTED] ~]$ bash
> [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> works
> [EMAIL PROTECTED] ~]$ sh
> [EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
> [EMAIL PROTECTED] ~]$ 
> 
> [EMAIL PROTECTED] ~]$ rpm -qf /bin/sh /bin/bash   
>   
> pdksh-5.2.14-43
> bash-3.1.017-1

32 bit unsigned int vs 32 bit signed int vs 64 bit long?

  wrobell <[EMAIL PROTECTED]>


___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en


bug in ksh?

2006-07-07 Thread Andrzej 'The Undefined' Dopierała
weirdy difference between sh from ksh and bash:

[EMAIL PROTECTED] ~]$ bash
[EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
works
[EMAIL PROTECTED] ~]$ sh
[EMAIL PROTECTED] ~]$ [ "30" -ge "20" ] && echo works
[EMAIL PROTECTED] ~]$ 

[EMAIL PROTECTED] ~]$ rpm -qf /bin/sh /bin/bash 

pdksh-5.2.14-43
bash-3.1.017-1

-- 
Andrzej 'The Undefined' Dopierała
UNIX && Linux administrator,  Adam Mickiewicz University WMiI
PLD Linux Developer  HomePage: http://andrzej.dopierala.name/
JID: [EMAIL PROTECTED] e-mail: [EMAIL PROTECTED]
___
pld-devel-en mailing list
pld-devel-en@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-devel-en