Package: bash
Version: 3.2-4
Severity: normal

Negative return values from functions/programs are badly handled.
I dunno if SH shells should accept negative return values, but BaSH 
fails on handeling it.

E.g. if a function returns -1, the $? shell variable is set to 255. It 
looks like a unsigned variable overflow.
A simple way to see it:
First define a function for esayly make tests:
$ AA() { return $1; }
Then try with negative values:
$ AA -1; echo $?
255
$ AA -25; echo $?
231
$ AA -255; echo $?
1


I've tryed out with DaSH and it gave me an error message and resets the 
value to an internal error code, that seems better to me:
With DaSH:
$ AA() { return $1; }
$ AA -1; echo $?
return: 5: Illegal number: -1
$ echo $?
2
$ AA -255; echo $?
return: 7: Illegal number: -255
$ echo $?
2


Cheers,
Colomban W.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.25-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages bash depends on:
ii  base-files                4.0.4          Debian base system miscellaneous f
ii  debianutils               2.30           Miscellaneous utilities specific t
ii  libc6                     2.7-10         GNU C Library: Shared libraries
ii  libncurses5               5.6+20080713-1 shared libraries for terminal hand

Versions of packages bash recommends:
ii  bash-completion               20080705   programmable completion for the ba

Versions of packages bash suggests:
pn  bash-doc                      <none>     (no description available)

-- no debconf information



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to