From owner-freebsd-arch@FreeBSD.ORG Sun May 15 08:53:37 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 D83AF16A4CE; Sun, 15 May 2005 08:53:37 +0000 (GMT) Received: from smtp2.server.rpi.edu (smtp2.server.rpi.edu [128.113.2.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6EE0243D96; Sun, 15 May 2005 08:53:37 +0000 (GMT) (envelope-from gad@FreeBSD.org) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by smtp2.server.rpi.edu (8.13.0/8.13.0) with ESMTP id j4F8rXgv007767; Sun, 15 May 2005 04:53:34 -0400 Mime-Version: 1.0 Message-Id: In-Reply-To: <4284ED54.9010603@FreeBSD.org> 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 04:53:33 -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.2 cc: Paul Saab 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: Sun, 15 May 2005 08:53:38 -0000 At 9:09 PM +0300 5/13/05, Maxim Sobolev wrote: >Garance A Drosihn wrote: > >>Note that I'm not just "running this through buildworld". That's >>how all the previous changes were tested, too. I have a whole >>battery of tests that I've been slogging through. > >Well, I'd suggest you to put those tests into src/tools/regression, >to ensure that this won't be broken occasionally in the future. Some of the testing has to do with things outside of imgact_shell.c itself. This thread started out with a change that made to /bin/sh which worked fine in -current, but then didn't work in -stable due to a minor change in imgact_shell.c. So I'm a bit paranoid. I haven't been testing with your code, but if you have that code installed, then 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. That's because the historical code would startup 'env' with: DBG: arg[ 0] = '/usr/bin/env' DBG: arg[ 1] = 'BLAH=aBc' DBG: arg[ 2] = 'BLAH2=OtheR' DBG: arg[ 3] = '/bin/sh' DBG: arg[ 4] = '/tmp/shelltest3' While the new code starts it up with: DBG: arg[ 0] = '/usr/bin/env' DBG: arg[ 1] = 'BLAH=aBc BLAH2=OtheR /bin/sh' DBG: arg[ 2] = '/tmp/shelltest3' This threw me at first, because I have actually used that construct to start out some scripts. But it turns out that trick causes the exact same looping on solaris and linux, so I guess I was just lucky that I never tried it on anything but FreeBSD! I wonder if anyone else has used that. 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. My guess is that those are the only two programs in the base system which need to care about this change, but the update I have also provides a kludge (which would be undocumented and TEMPORARY) to give people a way to get the historical parsing-behavior if they needed it for some script. I'm not sure if I'll commit that part, but it's useful for my testing. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@FreeBSD.org Rensselaer Polytechnic Institute; Troy, NY; USA