Bug 10700 - log() doesn't output newline anymore
Summary: log() doesn't output newline anymore
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: runtime (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-28 12:27 UTC by Mark Wielaard
Modified: 2009-09-28 14:00 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2009-09-28 12:27:13 UTC
It used to be that a log(string) statement would add a newline (version 1.0/0.142):
$ stap -e 'probe begin { log("begin"); log("done"); exit(); }'
begin
done

But with recent git (version 1.0/0.142 commit release-1.0-17-g9e75660) it gives:
$ /usr/local/install/systemtap/bin/stap -e 'probe begin { log("begin");
log("done"); exit(); }'
begindone

This causes some make installcheck failures, like cxxclass.exp.
Comment 1 Mark Wielaard 2009-09-28 12:35:08 UTC
This was introduced by:

commit 450718c9c424bce67e8580183788380431f90434
Author: Frank Ch. Eigler <fche@elastic.org>
Date:   Wed Sep 23 07:41:47 2009 -0400

    PR10390: ftrace() tapset function
    
    * tapset/logging.stp (ftrace): New function.
      (*): Add kerneldoc to other functions.
    * doc/SystemTap_Tapset_Reference/tapsets.tmpl: Process logging.stp.
    * stapfuncs.3stap.in: Remove "LOGGING" section, now redundant.
    * runtime/autoconf-trace-printk.c: New autoconf test.
    * buildrun.cxx (compile_pass): Build it.
    * NEWS: Mention it.
    * testsuite/buildok/logging.stp: Test it.
Comment 2 Mark Wielaard 2009-09-28 12:40:02 UTC
In particular, reverting this hunk against tapset/logging.stp fixes it:

 function log (msg:string) %{ /* unprivileged */
-       _stp_printf ("%s\n", THIS->msg);
+       _stp_print (THIS->msg);
 %}
Comment 3 Mark Wielaard 2009-09-28 13:42:39 UTC
Committed the reversal of the code in comment #2, since it seems to solve the
testsuite failures, as:

commit d498530cec1fcf4b71b1b27a068206fda18f3188
Author: Mark Wielaard <mjw@redhat.com>
Date:   Mon Sep 28 15:34:56 2009 +0200

    PR10700 Add newline after log() message.
    
    * tapset/logging.stp (log): Use _stp_printf "%s\n".

Please revert if this breaks some of the newer ftrace logging.
Comment 4 Mark Wielaard 2009-09-28 14:00:58 UTC
It doesn't seem needed and the change would be a regression anyway.