Bug 163613

Summary: exit, exit_group process status code not propagated
Product: [Fedora] Fedora Reporter: John Reiser <jreiser>
Component: straceAssignee: Roland McGrath <roland>
Status: CLOSED DUPLICATE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-07-19 21:12:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Reiser 2005-07-19 14:39:17 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4

Description of problem:
Strace always exits with process status code 0.  Instead, strace should propagate the exit or exit_group status code of the process being traced.  This would make strace more transparent because 'strace' could be inserted or removed without affecting a parent process which relies on the process status exit code.


Here are test cases:
-----exit42.S
#include <asm/unistd.h>

_start: .globl _start
        movl $42,%ebx
        movl $__NR_exit,%eax
        int $0x80
-----exit_group42.S
#include <asm/unistd.h>

_start: .globl _start
        movl $42,%ebx
        movl $__NR_exit_group,%eax
        int $0x80
-----
$ gcc -o exit42       -nostdlib -nostartfiles exit42.S
$ gcc -o exit_group42 -nostdlib -nostartfiles exit_group42.S


Version-Release number of selected component (if applicable):
strace-4.5.11-1

How reproducible:
Always

Steps to Reproduce:
1. Compile and run testcases from Description.
2.
3.
  

Actual Results:  $ ./exit42
$ echo $?   ## '$?' is bash syntax for exit status code of previous process
42
$ strace ./exit42
execve("./exit42", ["./exit42"], [/* 32 vars */]) = 0
_exit(42)                               = ?
$ echo $?
0   ## different from non-strace case
$ ./exit_group42
$ echo $?
42
$ strace ./exit_group42
execve("./exit_group42", ["./exit_group42"], [/* 32 vars */]) = 0
exit_group(42)                          = ?
$ echo $?
0   ## different from non-strace case
$ 


Expected Results:  The process exit status code under strace should be the same as without strace;  in these two cases: 42.

Additional info:

Comment 1 Roland McGrath 2005-07-19 21:12:00 UTC

*** This bug has been marked as a duplicate of 105371 ***