Bug 860129 - strace always returns 0 even though traced command exit with non-zero value.
Summary: strace always returns 0 even though traced command exit with non-zero value.
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: strace
Version: 5.9
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Jeff Law
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-25 04:01 UTC by masanari iida
Modified: 2012-09-25 18:24 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-09-25 18:24:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description masanari iida 2012-09-25 04:01:45 UTC
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 18:24:38 UTC
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.