Red Hat Bugzilla – Bug 860129
strace always returns 0 even though traced command exit with non-zero value.
Last modified: 2012-09-25 14:24:38 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.
Steps to Reproduce:
1. strace ls alsdkjasldkja
2. echo $?
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 $?
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.
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.