From owner-freebsd-current@FreeBSD.ORG Sat Oct 2 23:36:03 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 BE04116A4CE for ; Sat, 2 Oct 2004 23:36:03 +0000 (GMT) Received: from dglawrence.com (dsl-230-156.ipns.com [209.210.230.156]) by mx1.FreeBSD.org (Postfix) with ESMTP id 51ED743D1F for ; Sat, 2 Oct 2004 23:36:03 +0000 (GMT) (envelope-from dg@nexus.dglawrence.com) Received: from nexus.dglawrence.com (localhost [127.0.0.1]) by dglawrence.com (8.12.10/8.12.6) with ESMTP id i92NZgrW028218; Sat, 2 Oct 2004 16:35:42 -0700 (PDT) (envelope-from dg@nexus.dglawrence.com) Received: (from dg@localhost) by nexus.dglawrence.com (8.12.10/8.12.3/Submit) id i92NZg2F028217; Sat, 2 Oct 2004 16:35:42 -0700 (PDT) Date: Sat, 2 Oct 2004 16:35:42 -0700 From: "David G. Lawrence" To: Garance A Drosihn Message-ID: <20041002233542.GL714@nexus.dglawrence.com> References: <200410020349.i923nG8v021675@northstar.hetzel.org> <20041002052856.GE17792@nexus.dglawrence.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: cc: freebsd-current@freebsd.org Subject: Re: Bug in #! processing (long reply) 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: Sat, 02 Oct 2004 23:36:03 -0000 > fact, it seems to be the '--' which is causing the rest of the > line to be ignored, not the '#'. > > The PR is correct in that this feature is documented by perl books, > but the right way to support the feature is to change /bin/sh and > not the command interpreter. The PR includes a followup reply from > Ahmon Dancy with some additional proof that > the change to the command interpreter was the wrong way to fix this. > > Since this perl feature is documented in many places (including the > famous "Camel" book from O'Reilly), we can not just drop the support > in the command interpreter. But if we first fix /bin/sh then I > believe we can drop it. Err, your terminology is a bit off (/bin/sh is the "command interpreter"); what we're talking about is the behavior of the execve() system call in the kernel, specifically the imgact_shell image activation module. When the system sees that a file needs to be interpreted by something (e.g. sh, perl, python, or some other language interpreter) it parses the interpreter line specified at the top of the file (#!/bin/sh) and sets up to invoke that with the original file as the argument. ...but I see what you're saying and I agree with the thought. The interpreter should decide if the # is a comment, not the kernel. -DG David G. Lawrence President Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500 TeraSolutions, Inc. - http://www.terasolutions.com - (888) 346 7175 The FreeBSD Project - http://www.freebsd.org Pave the road of life with opportunities.