Bug 860129 - strace always returns 0 even though traced command exit with non-zero value.
strace always returns 0 even though traced command exit with non-zero value.
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: strace (Show other bugs)
5.9
All Linux
unspecified Severity medium
: rc
: ---
Assigned To: Jeff Law
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-25 00:01 EDT by masanari iida
Modified: 2012-09-25 14:24 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-09-25 14:24:38 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description masanari iida 2012-09-25 00:01:45 EDT
Description of problem:
On RHEL5, strace always returns 0 even though traced command exit with non-zero value.
On RHEL6, strace returnes same value as traced command's exit code.


Version-Release number of selected component (if applicable):
strace-4.5.18-18.el5 from RHEL5.9 beta.

How reproducible:
Always

Steps to Reproduce:
1.  strace ls alsdkjasldkja
2.  echo $?
  
Actual results:

echo $?
0

Expected results:
echo $?
2

Additional info:
This symptom was reported on Fedora (BZ#105371) and fixed on F10 era.
And the fix is in RHEL6 since RHEL6 is based on Fedora 14.

On RHEL6 example.

# strace ls adalskdjalsdkj

close(1)                                = 0
close(2)                                = 0
exit_group(2)                           = ?
# echo $?
2         <==


But the fix was not backported to RHEL5, so it still have the problem.

On man page of strace, it is documented.
> When  command exits, strace exits with the same exit status. 

But currently, strace on RHEL5 doesn't work as it is documented.
Comment 1 Jeff Law 2012-09-25 14:24:38 EDT
RHEL 5 strace is based on strace-4.5.18 which does not propagate exit status from the traced process to strace itself.  Furthermore, strace-4.5.18 does not document a exit code from strace itself.

Changing strace's behaviour to propagate the exit status from the traced process to strace itself would be a change we do not want to make at this stage in the RHEL 5 product lifetime.

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