From owner-freebsd-current@FreeBSD.ORG Thu Sep 30 12:05:26 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 64C0116A4CE for ; Thu, 30 Sep 2004 12:05:26 +0000 (GMT) Received: from ptcnat.era.pl (ptcnat.era.pl [213.158.197.100]) by mx1.FreeBSD.org (Postfix) with ESMTP id 116F543D45 for ; Thu, 30 Sep 2004 12:05:24 +0000 (GMT) (envelope-from zaks@era.pl) Received: by localhost (Postfix, from userid 1001) id 0902A11652; Thu, 30 Sep 2004 14:05:19 +0200 (CEST) From: =?iso-8859-2?q?S=B3awek_=AFak?= To: Ryan Sommers References: <861xgm5ltz.fsf@thirst.unx.era.pl> <20040928194853.GT2493@submonkey.net> <86k6ud2t6t.fsf@thirst.unx.era.pl> <20040929131136.GA2493@submonkey.net> <415AB9BF.1070003@gamersimpact.com> Date: Thu, 30 Sep 2004 14:05:18 +0200 In-Reply-To: <415AB9BF.1070003@gamersimpact.com> (Ryan Sommers's message of "Wed, 29 Sep 2004 08:33:51 -0500") Message-ID: <86is9wx8qp.fsf@thirst.unx.era.pl> User-Agent: Gnus/5.110003 (No Gnus v0.3) XEmacs/21.4 (Reasonable Discussion, berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii cc: Ceri Davies cc: freebsd-current@freebsd.org Subject: Re: Bug in #! processing X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2004 12:05:26 -0000 Ryan Sommers writes: > Ceri Davies wrote: > >> That seems wrong too. #! shouldn't be magic anywhere other than at the >> >>beginning of a file. >> >> > I haven't looked at the code yet, on my list, but I'm guessing this was done to > avoid a possible circular reference. What circular reference? Could you elaborate? The algorithm goes like this: 1. skip all space till #! 2. skip #! and read path for the interpreter 3. find and split arguments 4. invoke intepreter with it's path at argv[0], arguments at subsequent positions and append path to the script at the end. That's it, modulo : and no interpreter path at all in the script as legacy which is a special case anyway. /S