NetBSD Problem Report #42642
From www@NetBSD.org Tue Jan 19 20:49:41 2010
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by www.NetBSD.org (Postfix) with ESMTP id 44B5B63C2BA
for <gnats-bugs@gnats.NetBSD.org>; Tue, 19 Jan 2010 20:49:41 +0000 (UTC)
Message-Id: <20100119204941.10DE963C2A9@www.NetBSD.org>
Date: Tue, 19 Jan 2010 20:49:41 +0000 (UTC)
From: eravin@panix.com
Reply-To: eravin@panix.com
To: gnats-bugs@NetBSD.org
Subject: /etc/rc.subr fails to recognize daemons started with #!/usr/bin/env
X-Send-Pr-Version: www-1.0
>Number: 42642
>Category: bin
>Synopsis: /etc/rc.subr fails to recognize daemons started with #!/usr/bin/env
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 19 20:50:00 +0000 2010
>Closed-Date: Tue Sep 08 04:34:13 +0000 2015
>Last-Modified: Tue Sep 08 04:34:13 +0000 2015
>Originator: Ed Ravin
>Release: 5.0.1
>Organization:
Public Access Networks Corp
>Environment:
NetBSD panix5.panix.com 5.0.1 NetBSD 5.0.1 (PANIX-XEN3U-USER) #0: Thu Nov 5 07:26:24 EST 2009 root@juggler.panix.com:/devel/netbsd/5.0.1/src/sys/arch/i386/compile/PANIX-XEN3U-USER i386
>Description:
If I build an rc.d script for an interpreted daemon, and the first line of the daemon is:
#!/usr/bin/env ruby
Then rc.subr will fail with this error:
WARNING: $command_interpreter /usr/local/bin/ruby != /usr/bin/env
The problem is that rc.subr runs "ps -o pid,command". Here's
the sample output - pid 1325 is "/usr/local/bin/ruby" and pid
4396 is "/usr/local/bin/env ruby"
1325 /usr/local/bin/ruby (ruby-1.8.6-p287)
4396 ruby (ruby-1.8.6-p287)
>How-To-Repeat:
>Fix:
perhaps rc.subr should match the filename in between the parentheses in the "ps -o pid,command" output if the first try at matching fails?
>Release-Note:
>Audit-Trail:
From: Alan Barrett <apb@cequrux.com>
To: netbsd-bugs@NetBSD.org
Cc: gnats-bugs@NetBSD.org
Subject: Re: bin/42642: /etc/rc.subr fails to recognize daemons started
with #!/usr/bin/env
Date: Thu, 28 Jan 2010 19:53:39 +0200
On Tue, 19 Jan 2010, eravin@panix.com wrote:
> If I build an rc.d script for an interpreted daemon, and the first
> line of the daemon is:
>
> #!/usr/bin/env ruby
>
> Then rc.subr will fail with this error:
>
> WARNING: $command_interpreter /usr/local/bin/ruby != /usr/bin/env
Does your rc.d script do any of the following, and if so, please give
details:
* set the command_interpreter variable;
* set any of the procname, pidfile, or command variables;
* invoke the check_process or check_pidfile functions;
--apb (Alan Barrett)
From: Ed Ravin <eravin@panix.com>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, eravin@panix.com
Subject: Re: bin/42642: /etc/rc.subr fails to recognize daemons started
with #!/usr/bin/env
Date: Thu, 28 Jan 2010 14:21:26 -0500
On Thu, Jan 28, 2010 at 05:55:02PM +0000, Alan Barrett wrote:
> The following reply was made to PR bin/42642; it has been noted by GNATS.
>
> From: Alan Barrett <apb@cequrux.com>
> To: netbsd-bugs@NetBSD.org
> Cc: gnats-bugs@NetBSD.org
> Subject: Re: bin/42642: /etc/rc.subr fails to recognize daemons started
> with #!/usr/bin/env
> Date: Thu, 28 Jan 2010 19:53:39 +0200
>
> On Tue, 19 Jan 2010, eravin@panix.com wrote:
> > If I build an rc.d script for an interpreted daemon, and the first
> > line of the daemon is:
> >
> > #!/usr/bin/env ruby
> >
> > Then rc.subr will fail with this error:
> >
> > WARNING: $command_interpreter /usr/local/bin/ruby != /usr/bin/env
>
> Does your rc.d script do any of the following, and if so, please give
> details:
>
> * set the command_interpreter variable;
Yes, we set $command_interpreter to "/usr/local/bin/ruby".
> * set any of the procname, pidfile, or command variables;
> * invoke the check_process or check_pidfile functions;
None of those.
Here's a simple way to reproduce the problem:
------------------------ cut here -------------------- "frog.rc"
#!/bin/sh
#
# PROVIDE: frog
# REQUIRE: LOGIN
. /etc/rc.subr
# description: frog daemon
#
name="frog"
rcvar=$name
command=/home/frog/frog
command_interpreter=/usr/local/bin/perl-5.6.1
load_rc_config $name
run_rc_command "$1"
------------------------ cut here -------------------- "frog"
#!/usr/bin/env perl-5.6.1
print "Hello world!\n";
sleep(1000);
------------------------ cut here --------------------
No need to start the "frog" daemon, just run the RC script:
$ ./frog.rc forcestatus
./frog.rc: WARNING: $command_interpreter /usr/local/bin/perl-5.6.1 != /usr/bin/env
frog is not running.
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/42642 CVS commit: src/etc
Date: Thu, 9 Jun 2011 10:52:01 -0400
Module Name: src
Committed By: christos
Date: Thu Jun 9 14:52:01 UTC 2011
Modified Files:
src/etc: rc.subr
Log Message:
PR/42642: Ed Ravin: Handle daemons that start with #!/usr/bin/env interp
To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/etc/rc.subr
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 08 Sep 2015 04:34:13 +0000
State-Changed-Why:
Christos committed a fix back in 2011; I assume it worked or we would have
heard to the contrary by now :-)
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.