From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1333 invoked from network); 28 Oct 2008 22:13:57 -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=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.2.5 Received: from ns2.primenet.com.au (HELO primenet.com.au) (203.24.36.3) by ns1.primenet.com.au with (DHE-RSA-AES256-SHA encrypted) SMTP; 28 Oct 2008 22:13:57 -0000 Received: (qmail 17293 invoked from network); 28 Oct 2008 20:51:34 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns2.melb.primenet.com.au with SMTP; 28 Oct 2008 20:51:34 -0000 Received-SPF: none (ns2.melb.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 89332 invoked from network); 28 Oct 2008 20:50:18 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Oct 2008 20:50:18 -0000 Received: (qmail 18915 invoked by alias); 28 Oct 2008 20:50:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25937 Received: (qmail 18903 invoked from network); 28 Oct 2008 20:50:10 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 28 Oct 2008 20:50:10 -0000 Received: from mtaout03-winn.ispmail.ntl.com (mtaout03-winn.ispmail.ntl.com [81.103.221.49]) by bifrost.dotsrc.org (Postfix) with ESMTP id 835EA80524C0 for ; Tue, 28 Oct 2008 21:50:06 +0100 (CET) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout03-winn.ispmail.ntl.com (InterMail vM.7.05.02.00 201-2174-114-20060621) with ESMTP id <20081028205002.XENI1882.mtaout03-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Tue, 28 Oct 2008 20:50:02 +0000 Received: from pws-pc ([81.107.43.40]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20081028205002.MXXJ19264.aamtaout01-winn.ispmail.ntl.com@pws-pc> for ; Tue, 28 Oct 2008 20:50:02 +0000 Date: Tue, 28 Oct 2008 21:49:52 +0000 From: Peter Stephenson To: Zsh hackers list Subject: Re: "." not recognising "--" as the end-of-options Message-ID: <20081028214952.3bd0b64f@pws-pc> In-Reply-To: <20081028164318.GD4819@sc.homeunix.net> References: <20081028164318.GD4819@sc.homeunix.net> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.12; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=hJ19K13s918A:10 a=71IoqQORlHcA:10 a=NLZqzBF-AAAA:8 a=5T8cHam29Va65mgjvy8A:9 a=i8SoIrI_3jm96jHrw5oA:7 a=bUQnw9YG3jgFlCokqndgfA5NbGsA:4 a=_dQi-Dcv4p4A:10 a=LY0hPdMaydYA:10 X-Virus-Scanned: ClamAV 0.92.1/8528/Tue Oct 28 21:13:18 2008 on bifrost X-Virus-Status: Clean On Tue, 28 Oct 2008 16:43:19 +0000 Stephane Chazelas wrote: > $ zsh -c '. -- --help' > zsh:.:1: no such file or directory: -- > $ ARGV0=sh zsh -c '. -- --help' > zsh:.:1: no such file or directory: -- > > The handling of "--" is mandated by POSIX I beleive. > > With ksh, pdksh, bash you have to use: > > . -- "$1" > > if you can't guarantee that "$1" won't start with a "-". > > Unfortunately, that code doesn't work with zsh at the moment. This happens with builtins that are declared not to have any options. I've noticed it before and thought it a bit flakey but been too craven to fix it. We don't document option processing rules anywhere that I can find, so sticking with the standard is the only sensible bet. It's probably best to change for all such builtins. We already changed this for the functionally similar case of "exec" when that acquired options, so this should probably be considered unfinished business. This has probably missed 4.3.7, although that seems to be lost in the post at the moment. Index: README =================================================================== RCS file: /cvsroot/zsh/zsh/README,v retrieving revision 1.55 diff -u -r1.55 README --- README 26 Oct 2008 17:59:48 -0000 1.55 +++ README 28 Oct 2008 20:45:41 -0000 @@ -35,6 +35,12 @@ This section documents incompatibilities in the shell since the 4.2 series of releases. +In previous releases of the shell, builtin commands and precommand +modifiers that did not accept options also did not recognize the +argument "--" as marking the end of option processing without being +considered an argument. This was not documented and was incompatible +with other shells. All such commands now handle this syntax. + The configuration option --enable-lfs to enable large file support has been replaced by autoconf's standard --enable-largefile mechanism. As this is usually used whenever necessary, this won't usually Index: Src/builtin.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v retrieving revision 1.213 diff -u -r1.213 builtin.c --- Src/builtin.c 18 Oct 2008 14:13:16 -0000 1.213 +++ Src/builtin.c 28 Oct 2008 20:45:43 -0000 @@ -391,6 +391,9 @@ if (ops.ind['-']) break; } + } else if (*argv && !strcmp(*argv, "--")) { + ops.ind['-'] = 1; + argv++; } /* handle built-in options, for overloaded handler functions */ -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/