From nobody@FreeBSD.org  Sat Jun 23 15:21:13 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 00E111065679
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Jun 2012 15:21:13 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id E04768FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Jun 2012 15:21:12 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q5NFLCxc051990
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Jun 2012 15:21:12 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q5NFLCJx051989;
	Sat, 23 Jun 2012 15:21:12 GMT
	(envelope-from nobody)
Message-Id: <201206231521.q5NFLCJx051989@red.freebsd.org>
Date: Sat, 23 Jun 2012 15:21:12 GMT
From: "W.L. Tai" <t10661789@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Extraneous output when tracing writes with output redirect to a file
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         169350
>Category:       kern
>Synopsis:       [dtrace] Extraneous output when tracing writes with output redirect to a file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    markj
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jun 23 15:30:10 UTC 2012
>Closed-Date:    
>Last-Modified:  Mon Apr 21 17:15:07 UTC 2014
>Originator:     W.L. Tai
>Release:        9.0 stable
>Organization:
>Environment:
FreeBSD aaa.local 9.0-STABLE FreeBSD 9.0-STABLE #0: Fri Jun 22 20:51:15 HKT 2012     root@aaa.local:/usr/obj/usr/src/sys/TAI  amd64
>Description:
Extraneous output when tracing writes from entry to return with output redirection to a file.
>How-To-Repeat:
Consider the following script: test-bug.d

#!/usr/sbin/dtrace -s
#pragma D option quiet

vfs::vop_read:entry, vfs::vop_write:entry
/execname != "dtrace"/
{
        self->flag = 1;
}

vfs::vop_read:return, vfs::vop_write:return
/self->flag/
{
        this->flag = 1;
        self->flag = 0;
}

vfs::vop_read:return, vfs::vop_write:return
/this->flag/
{
        printf("%s\n", execname);
}

After running

dtrace -s test-bug.d -n 'tick-5s { exit(0); }' > /tmp/test

the file /tmp/test would contains lines with dtrace, which should not be there. Somehow dtrace has inherit the value of this->flag.
>Fix:
Work around:

Either continue to use self->flag or use the predicate

/this->flag && execname != "dtrace"/

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->gnn 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Jun 23 20:20:33 UTC 2012 
Responsible-Changed-Why:  
gnn has requested the dtrace PRs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=169350 
Responsible-Changed-From-To: gnn->markj 
Responsible-Changed-By: gnn 
Responsible-Changed-When: Mon Apr 21 17:14:59 UTC 2014 
Responsible-Changed-Why:  
Hand over to the person doing most of the DTrace work. 



http://www.freebsd.org/cgi/query-pr.cgi?pr=169350 
>Unformatted:
