Red Hat Bugzilla – Bug 559044
RFE: strace qualifier: output only on error return from syscall
Last modified: 2012-05-24 23:38:11 EDT
Description of problem: [Request For Enhancement] strace should provide a trace qualifier of 'error': print a syscall only if the result generates an error when performing one of the syscalls in 'set'. For example, to trace only when an error is generated by a 'write' or 'pwrite', then: "strace -e error=write,pwrite". The pre-syscall actions must be performed always, but the output line should be suppressed if the syscall succeeds.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
This would entail some change to the way strace works. That is, now it prints out the syscall name and arguments before the call is made, and then prints the results after the call returns. This means that it prints something before a call that blocks for a long time, rather than nothing. For the implementation, it also means that it doesn't actually keep track of what it would have printed in any data structures or anything, it just prints beforehand. So this feature could require some substantial reworking of how strace does things internally. Maybe we could do something clever with fmemopen or something to make it fairly painless. But I think this is the sort of feature you should expect to have to implement yourself upstream (firstname.lastname@example.org), or at least raise it there to see if you find someone who feels like implementing it for you.
Roland's comment c#1 is absolutely on target. This feature would need to be implemented upstream in the strace project. If/when that happens we would pull it into Fedora via the usual mechanisms.