From turutani@scphys.kyoto-u.ac.jp  Mon Apr  9 08:22:23 2012
Return-Path: <turutani@scphys.kyoto-u.ac.jp>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 46A47106566B
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 Apr 2012 08:22:23 +0000 (UTC)
	(envelope-from turutani@scphys.kyoto-u.ac.jp)
Received: from smtp-auth.kuins.kyoto-u.ac.jp (smtp-auth.kuins.kyoto-u.ac.jp [133.3.248.237])
	by mx1.freebsd.org (Postfix) with ESMTP id D5BB38FC0A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 Apr 2012 08:22:22 +0000 (UTC)
Received: from smtp-auth.kuins.kyoto-u.ac.jp (smtp-auth.kuins.kyoto-u.ac.jp [127.0.0.1])
	by postfix.imss70 (Postfix) with ESMTP id 79A4E2EC003;
	Mon,  9 Apr 2012 17:22:21 +0900 (JST)
Received: from h120.65.226.10.32118.vlan.kuins.net (wd232.BFL23.vectant.ne.jp [210.131.195.232])
	by smtp-auth.kuins.kyoto-u.ac.jp (Postfix) with ESMTP id 56F772EC001;
	Mon,  9 Apr 2012 17:22:21 +0900 (JST)
Received: from h120.65.226.10.32118.vlan.kuins.net (localhost [127.0.0.1])
	by h120.65.226.10.32118.vlan.kuins.net (8.14.4/8.14.4/20071004-1) with ESMTP id q398MGxx004024;
	Mon, 9 Apr 2012 17:22:16 +0900 (JST)
	(envelope-from turutani@h120.65.226.10.32118.vlan.kuins.net)
Received: (from turutani@localhost)
	by h120.65.226.10.32118.vlan.kuins.net (8.14.4/8.14.4/Submit) id q398ME53004023;
	Mon, 9 Apr 2012 17:22:14 +0900 (JST)
	(envelope-from turutani)
Message-Id: <201204090822.q398ME53004023@h120.65.226.10.32118.vlan.kuins.net>
Date: Mon, 9 Apr 2012 17:22:14 +0900 (JST)
From: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
Reply-To: Tsurutani Naoki <turutani@scphys.kyoto-u.ac.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc: turutani@scphys.kyoto-u.ac.jp
Subject: unexped startup of the daemon
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         166783
>Category:       conf
>Synopsis:       [rc] unexpected startup of daemons
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Apr 09 08:30:11 UTC 2012
>Closed-Date:    Mon Apr 09 22:37:24 UTC 2012
>Last-Modified:  Mon Apr 09 22:37:24 UTC 2012
>Originator:     Tsurutani Naoki
>Release:        FreeBSD 8.2-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD h120.65.226.10.32118.vlan.kuins.net 8.2-PRERELEASE FreeBSD 8.2-PRERELEASE #25: Mon Jan 24 10:37:18 JST 2011 turutani@h120.65.226.10.32118.vlan.kuins.net:/usr/local/work/usr/obj/usr/src/sys/POLYMER i386


	
>Description:
	some rc scripts are run unexpectedly.
	"XXX_enable" variable controls whether the program pointed in the script
	should be run or not, however, disabled script can be run
	with normal "start" option.
	when I execute a script, first, the PID file is checked even if the script
	is not enabled by rc.conf.  If the PID file exists and the process
	shown in PID file also exists, scripts returns message like
	"the process still exists".  however, if it is executed with "faststart"
	argument, PID file is removed and the program is executed.
	in both case, scripts that are not enabled by rc.conf are executed,
	and the variables except "XXX_enable" type are used unexpectedly.
	if two scripts use the same PID file and the only one of the scripts is
	enabled by rc.conf, and when they have same "program" like some interpreter
	language especially, unexpected programs can be run. 
	
>How-To-Repeat:
	I install ports/net-mgmt/mrtg and I use the startup script copied from
	the one installed by this port, in order to change the order to run.
	I named the script and variables with "my_" prefix and enable them;
	original script exists and disabled.
	I did not changed the PID filename; when booting the FreeBSD,
	"my_mrtg_daemon" scripts runs fine, and "mrtg_daemon" scripts is run
	unexpectedly and dies with "PID file is not written".  original pid file
	made by "my_mrtg_daemon" is removed at that time; for the user and group
	used to run the mrtg are changed only in my script.  if the user and group
	are changed to use the original ones, two mrtg daemons are run. 
	
>Fix:
	I have no idea.
	I think scripts without "XXX_enable=YES" should not run, even the PID check;
	otherwise, we should take care the variables which are not enabled.
	In addition, some bugs that run the "start" routine of not enabled scripts.
	


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Apr 9 09:29:30 UTC 2012 
Responsible-Changed-Why:  
I'm going to take a guess here and assign this to freebsd-rc. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=166783 
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Mon Apr 9 22:34:13 UTC 2012 
State-Changed-Why:  

I think that rather than trying to diagnose your problem here, it would be 
easier to do so on freebsd-rc@FreeBSD.org. 

Please send a message to that list with your information that you presented 
here, and also please do the following: 

1. Send a diff of the original mrtg script and your my_ version. 
2. Enable the console.log in /etc/syslog.conf 
3. Add rc_debug=1 and rc_info=1 to /etc/rc.conf, and reboot. 
4. Make the console.log file available somewhere that we can review it 
(a web site, etc.). Please do not send the whole log in e-mail. 

Doug 


Responsible-Changed-From-To: freebsd-rc->dougb 
Responsible-Changed-By: dougb 
Responsible-Changed-When: Mon Apr 9 22:34:13 UTC 2012 
Responsible-Changed-Why:  

I am closing this one. 

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