From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7458 invoked by alias); 15 Mar 2010 15:31:20 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27795 Received: (qmail 10424 invoked from network); 15 Mar 2010 15:31:17 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Mon, 15 Mar 2010 15:30:42 +0000 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: Can't trace script not in PATH Message-ID: <20100315153042.6bfa14c7@news01> In-Reply-To: <20100315125923.63a6afa6@news01> References: <38D4FA2BB99A674BADDED237051D97A70EE02067@FFBRUE001.cfmu.corp.eurocontrol.int> <20100315125923.63a6afa6@news01> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 15 Mar 2010 15:30:43.0055 (UTC) FILETIME=[79A3B7F0:01CAC454] X-Scanned-By: MailControl A-09-22-10 (www.mailcontrol.com) on 10.68.0.117 On Mon, 15 Mar 2010 12:59:23 +0000 Peter Stephenson wrote: > if (*argv) { > if (unset(SHINSTDIN)) { > if (!cmd) > - SHIN = movefd(open(unmeta(*argv), O_RDONLY | O_NOCTTY)); > - if (SHIN == -1) { > - zerr("can't open input file: %s", *argv); > - exit(127); > - } > + *runscript = *argv; > opts[INTERACTIVE] &= 1; > - argzero = *argv; > - scriptfilename = argzero; > argv++; > } one more issue here... we should set argzero ($0) at this point if cmd is set since we won't execute the code for *runscript non-NULL. This affects zsh -c 'echo $0' foo where time-honoured (well, time-somethinged anyway) behaviour is that $0 returns "foo". I'll add a test for this, too. I don't think it's right to set scriptfilename in this case (i.e. -c, obviously we set it if there's a real script), however. It's used for debugging and it's just confusing to have the debug output look like it's running a script it isn't. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom