Subject: Re: misc/35366
To: None <misc-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Hubert Feyrer <hubert@feyrer.de>
List: netbsd-bugs
Date: 01/20/2007 01:40:03
The following reply was made to PR misc/35366; it has been noted by GNATS.
From: Hubert Feyrer <hubert@feyrer.de>
To: he@NetBSD.org
Cc: "Dominik Joe Pantu*c(ek" <joe@joe.cz>, gnats-bugs@NetBSD.org
Subject: Re: misc/35366
Date: Sat, 20 Jan 2007 02:35:51 +0100 (CET)
Havard,
can you please sanity-check the patch I mailed, before I commit it?
- Hubert
On Fri, 19 Jan 2007, Dominik Joe Pantu*c(ek wrote:
> Hello,
>
> it works and handles the actual amavisd case correctly. The only case
> it doesn't handle is the test case I showed you on irc. If the daemon
> forks itself without adding ':' between interpreter and script. I don't
> know of any real program that behaves this way, so it might not be
> neccessary. If this is true, then your patch would be sufficient.
>
> Joe
> Hubert Feyrer napsal(a):
>>
>> [CC:ing he@ for rev. 1.66 of rc.subr & PR 31932]
>>
>>
>> Hi,
>>
>> following up our chat on IRC tonight, I'm sending you this mail to
>> document the latest state of things, also in the PR (hopefully...).
>>
>> Citing you from IRC:
>>
>> <dzoe> But it is the same as the cas 1.66 addresses
>> <dzoe> But not for interpreter, but for the interpreted program itselft.
>> <dzoe> /path/to/interp /path/to/program
>> <dzoe> /path/to/interp program
>> <dzoe> interp /path/to/program
>> <dzoe> interp program
>> <dzoe> 1.66 handles first 3 cases
>> <dzoe> Why not the fourth, especially when the 4th is only a variation
>> on 3rd.
>> <dzoe> 1.66 catches the "perl: bla" case as long as bla=/path/to/program
>>
>> rev. 1.66 was in response to PR 31932, it documents postgrey running as
>>
>> 476 ? IWs 0:41.25 perl: /usr/pkg/sbin/postgrey -i 2525 -d
>> --pidfile=/var/run/postgrey.pid (perl)
>>
>> while for amavis this is something like:
>>
>> 16541 ? S<s 0:06.44 perl: amavisd (master)
>>
>> so the difference is to either match a full or short pathname in the
>> _proccheck variable, after the interpreter and the ": ". The patch
>> below is also available from
>> http://www.feyrer.de/Misc/pr-35366-patch4, please test and let me know
>> if it improves the situation for you.
>>
>>
>> - Hubert
>>
>>
>> --- /usr/cvs/src-current/etc/rc.subr 2007-01-18 22:24:25.000000000
>> +0100
>> +++ /etc/rc.subr 2007-01-19 01:07:44.000000000 +0100
>> @@ -179,6 +179,7 @@
>> _psargs=$3
>>
>> _pref=
>> + _procnamebn=${_procname##*/}
>> if [ $_interpreter != "." ]; then # an interpreted script
>> read _interp < ${_chroot:-}/$_procname # read interpreter
>> name
>> _interp=${_interp#\#!} # strip #!
>> @@ -190,9 +191,8 @@
>> _interpbn=${1##*/}
>> _fp_args='_argv'
>> _fp_match='case "$_argv" in
>> - ${_interp}|"${_interp} "*|"${_interpbn}: ${_procname}"*)'
>> + ${_interp}|"${_interp} "*|"${_interpbn}: "*${_procnamebn}*)'
>> else # a normal daemon
>> - _procnamebn=${_procname##*/}
>> _fp_args='_arg0 _argv'
>> _fp_match='case "$_arg0" in
>> $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})")'
>
>
>