report's _command_output function doesn't always return the error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Apport |
Fix Released
|
Medium
|
Martin Pitt | ||
apport (Ubuntu) |
Fix Released
|
Low
|
Unassigned |
Bug Description
Apparently, the following gdb command fails but the error output is not in subprocess's err output but in stdout.
> /srv/daisy.
-> if sp.returncode == 0:
(Pdb) l
99 '''
100 sp = subprocess.
101
102 (out, err) = sp.communicate(
103 import pdb; pdb.set_trace()
104 -> if sp.returncode == 0:
105 return out
106 else:
107 if err:
108 err = err.decode('UTF-8', errors='replace')
109 else:
(Pdb) command
['/tmp/
(Pdb) out
b'/tmp/
Because stdout is not included in the raised error message it ended up being hard to find out what the error really was.
111 raise OSError('Error: command %s failed with exit code %i: %s' % (
112 str(command), sp.returncode, err))
This is because _command_output() defaults to stderr= subprocess. STDOUT, so we'll never see the error on stderr indeed.