Bug 187847

Summary: Strace -c -o -ff creates empty output files
Product: Red Hat Enterprise Linux 4 Reporter: Larry Lile <lile>
Component: straceAssignee: Stepan Kasal <kasal>
Status: CLOSED WONTFIX QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0CC: lans, ldv, skottie
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: 2006-06-16 14:46:13 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:
Bug Depends On:    
Bug Blocks: 176344    
Attachments:
Description Flags
Patch for -o -ff -c bug none

Description Larry Lile 2006-04-03 21:10:21 UTC
Description of problem:

Strace produces empty files when -c -ff and -o are invoked
simultaenously.

Version-Release number of selected component (if applicable):
strace-4.5.13-0.EL4.1

How reproducible:
Always.


Steps to Reproduce:
1. strace -o foo -ff -c some-process-with-children
  
Actual results:
You will receive an empty summary file for each process

Expected results:
One summary file for the parent and it's children

Additional info:
strace -ff -c some-process-with-children
produces the expected output, but the -o doesn't properly
redirect to file.

Reported to strace developers, with patch:
http://sourceforge.net/tracker/index.php?func=detail&aid=1462497&group_id=2861&atid=302861

Comment 1 Larry Lile 2006-04-03 21:10:21 UTC
Created attachment 127260 [details]
Patch for -o -ff -c bug

Comment 2 Gavin Romig-Koch 2006-04-05 12:33:57 UTC
This is not intended to be an argument against the patch, but the strace man
page pretty clearly indicates that -c and -o are not intended to be used
together.  If we go forward with this patch, we should also fix the man page.

Comment 6 Larry Lile 2006-04-21 22:10:28 UTC
I didn't read the man page in that way, it seemed somewhat undefined.  The only
link between the 3 options is the appending of pid, as I read it.  Maybe my
copy of the man page is outdated?

       -c          Count  time,  calls, and errors for each system call
                   and report a summary on  program  exit.   On  Linux,
                   this  attempts  to  show system time (CPU time spent
                   running in the kernel)  independent  of  wall  clock
                   time.

      -ff         If  the  -o  filename option is in effect, each pro-
                   cesses trace is written to filename.pid where pid is
                   the numeric process id of each process.

       -o filename Write  the  trace output to the file filename rather
                   than to stderr.  Use filename.pid if  -ff  is  used.
                   If the argument begins with `|' or with `!' then the
                   rest of the argument is treated as a command and all
                   output  is piped to it.  This is convenient for pip-
                   ing  the  debugging  output  to  a  program  without
                   affecting the redirections of executed programs.

Either way, I haven't heard from the strace maintainers as yet.


Comment 7 Dmitry V. Levin 2006-04-21 23:15:37 UTC
Strictly speaking, I'm neither RH nor upstream strace maintainer.
However, Roland's opinion is not available yet.

I suppose that, as described in strace(1) synopsis, -c is not compatible with
-a, -i, -r, -s, -t, and -x options.
However, I think that -c is compatible with -d, -e, -f, -o, -p, -q, -u, -E and
-F despite of current wording in synopsis.

Regarding to -c -ff -o: unless -c is extended to handle each pid separately,
this combination is not compatible, one should use smth like -c -f -o instead.

That is, both manpage and source code should be corrected: code should reject
incompatible options, and synopsis should be updated.


Comment 8 Larry Lile 2006-04-21 23:32:21 UTC
Ah, I didn't check the summary and you are correct.

I don't think there is a good answer to the -c -ff -o combination, with
-c -ff, it summarizes parent and children so I simply made the action of
-o consistent.  It was also easier to code and happened to be the result
set I needed at the time.

-c -f -o and -c -f are consistent and produce a summary of the parent only.

I'm not married to any solution on this, full summary, summary per pid,
declaring the combination invalid or just waiting for the Strace maintainers
to pass judgement.

If I do hear from the Strace maintainers I will update the case with their
response.



Comment 9 Roland McGrath 2006-04-25 07:40:46 UTC
I've changed strace upstream to refuse -c and -ff together.

Comment 10 Larry Lile 2006-04-25 20:45:38 UTC
Oh well. :-)  Maybe one of these days I'll have the free time to revisit this
and provide a better patch that could support -c -ff/-o in a suitable and 
useful manner.  It would probably require supporting -c in some other way
depending on whether the user wanted a single summary of parent and children
or parent and each child separately.

Anyway, thanks for taking the time to consider the issue.  Now it won't take
anyone by surprise.

Comment 12 RHEL Program Management 2006-06-16 14:46:14 UTC
Development Management has reviewed and declined this request.  You may appeal this decision by reopening this request.