Bug 559044

Summary: RFE: strace qualifier: output only on error return from syscall
Product: [Fedora] Fedora Reporter: John Reiser <jreiser>
Component: straceAssignee: Jeff Law <law>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: dvlasenk, mnewsome, roland
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-25 03:38:11 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 2010-01-27 00:33:25 UTC
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):
strace-4.5.19-1.fc12.x86_64


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Roland McGrath 2010-01-27 01:40:17 UTC
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 (strace-devel.net), or at least raise it there to see if you find someone who feels like implementing it for you.

Comment 3 Jeff Law 2012-05-25 03:38:11 UTC
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.