From nobody@FreeBSD.org  Fri Jul 14 10:34:27 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3534F16A4DA
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 14 Jul 2006 10:34:27 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id F198D43D46
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 14 Jul 2006 10:34:26 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k6EAYQbY054820
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 14 Jul 2006 10:34:26 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k6EAYQE4054819;
	Fri, 14 Jul 2006 10:34:26 GMT
	(envelope-from nobody)
Message-Id: <200607141034.k6EAYQE4054819@www.freebsd.org>
Date: Fri, 14 Jul 2006 10:34:26 GMT
From: Rob Pitt <rob@oxdi.co.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: /etc/rc.subr cannot deal properly with interpreted daemons whos shebang uses /usr/bin/env
X-Send-Pr-Version: www-2.3

>Number:         100287
>Category:       bin
>Synopsis:       /etc/rc.subr cannot deal properly with interpreted daemons whos shebang uses /usr/bin/env
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 14 10:40:16 GMT 2006
>Closed-Date:    Sat Mar 10 13:56:17 GMT 2007
>Last-Modified:  Sat Mar 10 14:00:10 GMT 2007
>Originator:     Rob Pitt
>Release:        6.0
>Organization:
Oxygen Digital Industries Ltd
>Environment:
6.0 RELEASE
>Description:
When you create a script to manage starting and stopping a daemon written in an interpreted language then you supply command_interpreter to set the interpreter being used to execute the daemon (i.e. /usr/local/bin/python). If the interpreted daemon uses a shebang referencing /usr/bin/env to locate it's interpreter (a good practice for a multi-platform daemon), i.e.:

#!/usr/bin/env python

Then the rc.subr script gets confused because it thinks the interpreter is "/usr/bin/env " (including that last space).

You can work around this by changing the daemons shebang to point at the actual location of the interpreter, i.e.:

#!/usr/local/bin/python

However, while trivial this is far from ideal because it means additional, unnecessary patching and the rc.subr script could be made to handle this gracefully.
>How-To-Repeat:
1. See description
>Fix:
The rc.subr script could assume that "foobar" is the correct interpreter value when it sees "#!/usr/bin/env foobar"
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Fri Jul 14 13:59:48 UTC 2006 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100287 
State-Changed-From-To: open->patched 
State-Changed-By: yar 
State-Changed-When: Sun Dec 31 11:07:44 UTC 2006 
State-Changed-Why:  
Fixed in CURRENT; MFC is due in 1 week.  Thanks! 


Responsible-Changed-From-To: freebsd-rc->yar 
Responsible-Changed-By: yar 
Responsible-Changed-When: Sun Dec 31 11:07:44 UTC 2006 
Responsible-Changed-Why:  
Fixed in CURRENT; MFC is due in 1 week.  Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100287 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/100287: commit references a PR
Date: Sun, 31 Dec 2006 11:07:36 +0000 (UTC)

 yar         2006-12-31 11:07:29 UTC
 
   FreeBSD src repository
 
   Modified files:
     etc                  rc.subr 
   Log:
   Allow for /usr/bin/env when parsing the shebang line from an
   interpreted $command.  Some "portable" sofware packages use such a
   line to skip the task of figuring out the absolute pathname of the
   interpreter at install time, e.g.:
   
           #!/usr/bin/env python
   
   It is insecure, but a popular book on Python seems to have advised
   it to a wide audience.  Hence a number of such scripts in the ports,
   mostly written in Python.
   
   PR:             bin/100287
   MFC after:      1 week
   
   Revision  Changes    Path
   1.73      +5 -0      src/etc/rc.subr
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: yar 
State-Changed-When: Sat Mar 10 13:53:26 UTC 2007 
State-Changed-Why:  
Sorry, I delayed the MFC terribly. 
Now the bug is fixed in both active branches. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100287 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/100287: commit references a PR
Date: Sat, 10 Mar 2007 13:53:10 +0000 (UTC)

 yar         2007-03-10 13:53:04 UTC
 
   FreeBSD src repository
 
   Modified files:        (Branch: RELENG_6)
     etc                  rc.subr 
   Log:
   MFC rev. 1.73: Allow for interpreted scripts using env(1)
   in their shebang lines.
   
   PR:     bin/100287
   
   Revision   Changes    Path
   1.34.2.19  +5 -0      src/etc/rc.subr
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
>Unformatted:
