Bug 187847 - Strace -c -o -ff creates empty output files
Strace -c -o -ff creates empty output files
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: strace (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Stepan Kasal
Brian Brock
Depends On:
Blocks: 176344
  Show dependency treegraph
Reported: 2006-04-03 17:10 EDT by Larry Lile
Modified: 2007-11-30 17:07 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-06-16 10:46:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch for -o -ff -c bug (542 bytes, patch)
2006-04-03 17:10 EDT, Larry Lile
no flags Details | Diff

  None (edit)
Description Larry Lile 2006-04-03 17:10:21 EDT
Description of problem:

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

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

How reproducible:

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:
Comment 1 Larry Lile 2006-04-03 17:10:21 EDT
Created attachment 127260 [details]
Patch for -o -ff -c bug
Comment 2 Gavin Romig-Koch 2006-04-05 08:33:57 EDT
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 18:10:28 EDT
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

      -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 19:15:37 EDT
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 19:32:21 EDT
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

Comment 9 Roland McGrath 2006-04-25 03:40:46 EDT
I've changed strace upstream to refuse -c and -ff together.
Comment 10 Larry Lile 2006-04-25 16:45:38 EDT
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 Product and Program Management 2006-06-16 10:46:14 EDT
Development Management has reviewed and declined this request.  You may appeal this decision by reopening this request.

Note You need to log in before you can comment on or make changes to this bug.