Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 49773 - Function return values larger than 256 are not returned correctly.
Function return values larger than 256 are not returned correctly.
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
Depends On:
  Show dependency treegraph
Reported: 2001-07-23 15:46 EDT by Need Real Name
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-07-23 16:49:19 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Need Real Name 2001-07-23 15:46:42 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.73 [en] (X11; U; Linux 2.0.34 i686)

Description of problem:
A function in a shell script returns a value larger than 256.  After
returning, $? is 1 instead of 256.  When returning a value less than
or equal to 256, $? is the correct value.

How reproducible:

Steps to Reproduce:
1. Run the following shell script.


foo() {
    return $i

echo "foo returned $?"

Actual Results:  The script outputs: foo returned 1

Expected Results:  The script should output: foo returned 257

Additional info:
Comment 1 Bernhard Rosenkraenzer 2001-07-24 10:43:44 EDT
This is normal behavior. Since the return value of an application is a byte 
(unsigned char), 256 = 0, 257 = 1, ...

Note You need to log in before you can comment on or make changes to this bug.