From nobody@FreeBSD.org  Mon Jan 28 04:01:03 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7A0B216A46C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Jan 2008 04:01:03 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 6BB8013C478
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Jan 2008 04:01:03 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m0S3xKKA010041
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 28 Jan 2008 03:59:20 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m0S3xK8d010040;
	Mon, 28 Jan 2008 03:59:20 GMT
	(envelope-from nobody)
Message-Id: <200801280359.m0S3xK8d010040@www.freebsd.org>
Date: Mon, 28 Jan 2008 03:59:20 GMT
From: Brian Hourigan <brianh@webair.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Interpreter fails to invoke on 6.3-RELEASE, reproducable
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         120072
>Category:       kern
>Synopsis:       Interpreter fails to invoke on 6.3-RELEASE, reproducable
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 28 04:10:03 UTC 2008
>Closed-Date:    Sat May 15 15:31:04 UTC 2010
>Last-Modified:  Sat May 15 15:31:04 UTC 2010
>Originator:     Brian Hourigan
>Release:        6.3-STABLE (fresh cvsup)
>Organization:
>Environment:
FreeBSD test.server.com 6.3-STABLE FreeBSD 6.3-STABLE #0: Sun Jan 27 22:49:50 EST 2008     root@test.server.com:/usr/src/sys/amd64/compile/vsys  amd64
>Description:
Kernel doesn't seem to be invoking script itnerpreters, but rather allowing interpretation by the current shell.

I've reproduced this on both 6.3-STABLE and 6.2-RELEASE-p8 where I originally noticed the issue. I checked /usr/src/UPDATING, but found no reference. I've also looked through previous PRs unsuccessfully identifying a similar bug report.

>How-To-Repeat:
test# cat test.sh
#!/bin/sh

echo SHELL $SHELL
test# ./test.sh
SHELL /bin/csh
test# sh
# echo $SHELL
/bin/csh
# exit
test# bash
[root@test ~]# echo $SHELL
/bin/csh

>Fix:


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: jilles 
State-Changed-When: Sat May 15 15:31:03 UTC 2010 
State-Changed-Why:  
The problem is in your test script: the SHELL variable indicates the 
user's login shell (see environ(7)), not the currently running shell. If 
you put in ps $$ or shell-specific constructs, you will notice that #! 
is working correctly. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=120072 
>Unformatted:
