From nobody@FreeBSD.org  Fri Aug 11 00:20:31 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5281416A4DE
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Aug 2006 00:20:31 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1A5D643D49
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Aug 2006 00:20:31 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k7B0KUtg061315
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 11 Aug 2006 00:20:30 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k7B0KUPU061314;
	Fri, 11 Aug 2006 00:20:30 GMT
	(envelope-from nobody)
Message-Id: <200608110020.k7B0KUPU061314@www.freebsd.org>
Date: Fri, 11 Aug 2006 00:20:30 GMT
From: Clement Moulin <freebsd@simplerezo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: rc.subr : function _find_processes cannot find process with name in [ ]
X-Send-Pr-Version: www-2.3

>Number:         101791
>Category:       conf
>Synopsis:       rc.subr : function _find_processes cannot find process with name in [ ]
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 11 00:30:16 GMT 2006
>Closed-Date:    Fri Aug 11 14:42:15 GMT 2006
>Last-Modified:  Fri Aug 11 14:42:15 GMT 2006
>Originator:     Clement Moulin
>Release:        5.3-RELEASE
>Organization:
SimpleRezo
>Environment:
FreeBSD xxx.com 5.3-RELEASE-p9 FreeBSD 5.3-RELEASE-p9 #0: Wed Apr 27 16:05:49 CEST 2005     root@xxx.com:/usr/obj/usr/src/sys/KERNEL  i386

>Description:
The /etc/rc.subr script contains a function check_pidfile that calls _find_processes to check if a file containing a pid is referencing a running process matching a specific name.

It's due to /bin/sh 'case' struct.

Try:

#!/bin/sh
my="[tcp]"
case ${my} in
  ${my}) echo no;;
  "${my}") echo yes;;
esac


In /etc/rc.subr:
_fp_match='case "$_arg0" in
                    $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})")'

BTW, i don't understand why both $_procnamebn and ${_procnamebn} are there...
>How-To-Repeat:
Try to manage with an rcNG script a daemon who display in ps in "[]", ie tcpserver:

21478  p0  I      0:00,00 [tcpserver]


check_pidfile ${pidfile} '[tcpserver]'

This call doesn't returns any result.
>Fix:
In /etc/rc.subr:

-_fp_match='case "$_arg0" in
                    $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})")'
+_fp_match='case "$_arg0" in
                    $_procname|"$_procnamebn"|${_procnamebn}:|"(${_procnamebn})")'

Or maybe...

+_fp_match='case "$_arg0" in
                    "$_procname"|"$_procnamebn"|"${_procnamebn}:"|"(${_procnamebn})")'

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: brooks 
State-Changed-When: Fri Aug 11 14:40:38 UTC 2006 
State-Changed-Why:  
Duplicate of conf/82430 whcih was fixed in current in October 2005 and 
in 5.x by November 2005.  Please upgrade to 5.5 or better yet 6.1. 

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