Sun Jan 18 22:35:35 2009 UTC ()
On some operating systems (Linux, FreeBSD -- see their problem report
82430) ps might list process names in square brackets.  Fix regex in
_find_processes() accordingly.

OK by wiz@.


(shattered)
diff -r1.18 -r1.19 pkgsrc/pkgtools/rc.subr/Makefile
diff -r1.9 -r1.10 pkgsrc/pkgtools/rc.subr/files/rc.subr

cvs diff -r1.18 -r1.19 pkgsrc/pkgtools/rc.subr/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/rc.subr/Makefile 2008/12/21 00:03:32 1.18
+++ pkgsrc/pkgtools/rc.subr/Makefile 2009/01/18 22:35:35 1.19
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.18 2008/12/21 00:03:32 adrianp Exp $ 1# $NetBSD: Makefile,v 1.19 2009/01/18 22:35:35 shattered Exp $
2# 2#
3 3
4DISTNAME= rc.subr-20081208 4DISTNAME= rc.subr-20090118
5CATEGORIES= pkgtools 5CATEGORIES= pkgtools
6MASTER_SITES= # empty 6MASTER_SITES= # empty
7DISTFILES= # empty 7DISTFILES= # empty
8 8
9MAINTAINER= grant@NetBSD.org 9MAINTAINER= grant@NetBSD.org
10HOMEPAGE= http://www.NetBSD.org/ 10HOMEPAGE= http://www.NetBSD.org/
11COMMENT= Portable NetBSD rc.subr implementation for pkgsrc 11COMMENT= Portable NetBSD rc.subr implementation for pkgsrc
12 12
13ONLY_FOR_PLATFORM= Darwin-*-* FreeBSD-[0-4].*-* Interix-*-* 13ONLY_FOR_PLATFORM= Darwin-*-* FreeBSD-[0-4].*-* Interix-*-*
14ONLY_FOR_PLATFORM+= Linux-*-* SunOS-*-* 14ONLY_FOR_PLATFORM+= Linux-*-* SunOS-*-*
15ONLY_FOR_PLATFORM+= QNX-*-* 15ONLY_FOR_PLATFORM+= QNX-*-*
16 16
17NO_BUILD= yes 17NO_BUILD= yes

cvs diff -r1.9 -r1.10 pkgsrc/pkgtools/rc.subr/files/rc.subr (expand / switch to unified diff)

--- pkgsrc/pkgtools/rc.subr/files/rc.subr 2008/12/21 00:03:32 1.9
+++ pkgsrc/pkgtools/rc.subr/files/rc.subr 2009/01/18 22:35:35 1.10
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: rc.subr,v 1.9 2008/12/21 00:03:32 adrianp Exp $ 1# $NetBSD: rc.subr,v 1.10 2009/01/18 22:35:35 shattered Exp $
2# 2#
3# Copyright (c) 1997-2002 The NetBSD Foundation, Inc. 3# Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# This code is derived from software contributed to The NetBSD Foundation 6# This code is derived from software contributed to The NetBSD Foundation
7# by Luke Mewburn. 7# by Luke Mewburn.
8# 8#
9# Redistribution and use in source and binary forms, with or without 9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions 10# modification, are permitted provided that the following conditions
11# are met: 11# are met:
12# 1. Redistributions of source code must retain the above copyright 12# 1. Redistributions of source code must retain the above copyright
13# notice, this list of conditions and the following disclaimer. 13# notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright 14# 2. Redistributions in binary form must reproduce the above copyright
@@ -266,27 +266,27 @@ _find_processes() @@ -266,27 +266,27 @@ _find_processes()
266 _interp=${_interp#\#!} # strip #! 266 _interp=${_interp#\#!} # strip #!
267 set -- $_interp 267 set -- $_interp
268 if [ $_interpreter != $1 ]; then 268 if [ $_interpreter != $1 ]; then
269 warn "\$command_interpreter $_interpreter != $1" 269 warn "\$command_interpreter $_interpreter != $1"
270 fi 270 fi
271 _interp="$* $_procname" # cleanup spaces, add _procname 271 _interp="$* $_procname" # cleanup spaces, add _procname
272 _fp_args='_argv' 272 _fp_args='_argv'
273 _fp_match='case "$_argv" in 273 _fp_match='case "$_argv" in
274 ${_interp}|"${_interp} "*)' 274 ${_interp}|"${_interp} "*)'
275 else # a normal daemon 275 else # a normal daemon
276 _procnamebn=${_procname##*/} 276 _procnamebn=${_procname##*/}
277 _fp_args='_arg0 _argv' 277 _fp_args='_arg0 _argv'
278 _fp_match='case "$_arg0" in 278 _fp_match='case "$_arg0" in
279 $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})")' 279 $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")'
280 fi 280 fi
281 281
282 _proccheck=' 282 _proccheck='
283 ${_RCCMD_ps} ${_RCARG_psformat} '"$_psargs"' | 283 ${_RCCMD_ps} ${_RCARG_psformat} '"$_psargs"' |
284 while read _npid '"$_fp_args"'; do 284 while read _npid '"$_fp_args"'; do
285 case "$_npid" in 285 case "$_npid" in
286 PID) 286 PID)
287 continue ;; 287 continue ;;
288 esac ; '"$_fp_match"' 288 esac ; '"$_fp_match"'
289 ${_RCCMD_echo} -n "$_pref$_npid" ; 289 ${_RCCMD_echo} -n "$_pref$_npid" ;
290 _pref=" " 290 _pref=" "
291 ;; 291 ;;
292 esac 292 esac