From owner-freebsd-arch@FreeBSD.ORG Mon May 16 02:21:22 2005 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D5C716A4CE; Mon, 16 May 2005 02:21:22 +0000 (GMT) Received: from smtp4.server.rpi.edu (smtp4.server.rpi.edu [128.113.2.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A22F43D93; Mon, 16 May 2005 02:21:22 +0000 (GMT) (envelope-from gad@FreeBSD.org) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp4.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j4G2LJqD012754; Sun, 15 May 2005 22:21:20 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> <20041002233542.GL714@nexus.dglawrence.com> <421DAD8F.6000704@portaone.com> <4284D038.50805@FreeBSD.org> <4284D4BC.9070705@FreeBSD.org> <4284ED54.9010603@FreeBSD.org> Date: Sun, 15 May 2005 22:21:19 -0400 To: Maxim Sobolev From: Garance A Drosehn Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-CanItPRO-Stream: default X-RPI-SA-Score: undef - spam-scanning disabled X-Scanned-By: CanIt (www . canit . ca) on 128.113.2.4 cc: freebsd-arch@FreeBSD.org Subject: Re: Bug in #! processing - One More Time X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2005 02:21:22 -0000 At 4:53 AM -0400 5/15/05, Garance A Drosehn wrote: >... you might try the following shell script: > > #!/usr/bin/env BLAH=aBc BLAH2=OtheR /bin/sh > # > echo $BLAH $BLAH2 > >Assuming your change to works about the same as mine, that script >should be an infinite loop. Well, this behavior is the same as what the user would see with the same script on other OS's. I could add an option to `env' which script-writers could use to avoid this problem, but I'm not sure it's worth the trouble... >It also looks like something goes wrong with /bin/sh when options >are given on the #!-line, which may be left-over from my previous >change to it. I haven't tracked that down yet, but I want to >understand that before committing the fix we want. Well, `sh' is probably doing the right thing, but the end result still breaks the `#!'-trick which is documented in some books on perl and ruby (and python?). So I want to commit a fix to `sh' which will allow that trick to work, and then I'll commit the change to imgact_shell.c that I wrote up. Probably commit an entry to UPDATING at the same time, since the change could possibly break some people's scripts. Not likely, but possible... That's at: http://people.freebsd.org/~gad/imgact_shell.diff http://people.freebsd.org/~gad/imgact_shell.c -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA