Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Aug 2006 00:20:30 GMT
From:      Clement Moulin <freebsd@simplerezo.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/101791: rc.subr : function _find_processes cannot find process with name in [ ]
Message-ID:  <200608110020.k7B0KUPU061314@www.freebsd.org>
Resent-Message-ID: <200608110030.k7B0UGbN009125@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Aug 11 00:30:16 GMT 2006
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608110020.k7B0KUPU061314>