NetBSD Problem Report #45689

From www@NetBSD.org  Mon Dec  5 20:40:30 2011
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 1B5FD63D9B7
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  5 Dec 2011 20:40:30 +0000 (UTC)
Message-Id: <20111205204028.80CA763D820@www.NetBSD.org>
Date: Mon,  5 Dec 2011 20:40:28 +0000 (UTC)
From: matthias.rampke@googlemail.com
Reply-To: matthias.rampke@googlemail.com
To: gnats-bugs@NetBSD.org
Subject: www/spawn-fcgi: add '_interpreter' variable to rc script
X-Send-Pr-Version: www-1.0

>Number:         45689
>Category:       pkg
>Synopsis:       www/spawn-fcgi: add '_interpreter' variable to rc script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    joerg
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 05 20:45:00 +0000 2011
>Last-Modified:  Tue Dec 06 06:10:10 +0000 2011
>Originator:     Matthias Rampke
>Release:        DragonFlyBSD HEAD
>Organization:
>Environment:
DragonFly grade.so 2.13-DEVELOPMENT DragonFly v2.13.0.451.g34910-DEVELOPMENT #1: Sat Dec  3 22:32:37 CET 2011     matthias@grade.so:/usr/obj/usr/src/sys/X86_64_GENERIC  x86_64
>Description:
The rc script for spawn-fcgi does not pass an interpreter to rc.subr's check_pid, causing the PID check (and thus e.g. stopping the corresponding spawnfcgi job) to fail if it is a #! script (e.g. #!/usr/pkg/bin/python2.7, in my case).

The patch below simply adds a spawnfcgi_${job}_interpreter variable that is passed to check_pid on a per-job-basis. For non-script jobs it need not be specified, thus current behaviour will remain unchanged unless this variable is set.
>How-To-Repeat:
in rc.conf:
spawnfcgi_enable="YES"
spawnfcgi_jobs="foo"
spawnfcgi_foo_command="/path/to/some/python/fastcgi/script"
spawnfcgi_fcgiwrap_socket="/tmp/foo.sock"


where "/path/to/some/python/fastcgi/script" is executable with a

#!/usr/pkg/bin/python2.7

header, then

/etc/rc.d/spawnfcgi start
/etc/rc.d/spawnfcgi stop

>Fix:
diff --git a/www/spawn-fcgi/files/spawnfcgi.sh b/www/spawn-fcgi/files/spawnfcgi.sh
index ba391ac..4e73973 100644
--- a/www/spawn-fcgi/files/spawnfcgi.sh
+++ b/www/spawn-fcgi/files/spawnfcgi.sh
@@ -19,7 +19,8 @@ spawnfcgi_pid()
 {
        pidfile=${pidfile_base}$1
        job_command=$(eval echo \$${name}_${job}_command)
-       rc_pid=`check_pidfile "$pidfile" $job_command`
+        job_interpreter=$(eval echo \$${name}_${job}_interpreter)
+       rc_pid=`check_pidfile "$pidfile" $job_command $job_interpreter`
 }

 spawnfcgi_start()

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->joerg
Responsible-Changed-By: gls@NetBSD.org
Responsible-Changed-When: Tue, 06 Dec 2011 06:10:10 +0000
Responsible-Changed-Why:
Over to maintainer.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.