From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3) with ESMTP id VAA18153 for ; Tue, 28 May 1996 21:55:42 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id HAA09068; Tue, 28 May 1996 07:37:20 -0400 (EDT) Resent-Date: Tue, 28 May 1996 07:37:20 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199605281134.NAA18699@turan.elte.hu> Subject: Re: $(nooutput) problem To: pws@ifh.de (Peter Stephenson) Date: Tue, 28 May 1996 13:34:37 +0200 (MET DST) Cc: zsh-workers@math.gatech.edu In-Reply-To: <199605280918.LAA10810@hydra.ifh.de> from Peter Stephenson at "May 28, 96 11:18:09 am" Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL15 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"pKqx4.0.cD2.lLkgn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1209 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > It seems care is needed: (1) if a command is not a simple one no > arguments may be necessary, so that having no arguments in execcmd() > is perfectly legal; (2) single word substitution needs to keeps its > arguments, for example the variable assignment code expects something > back from prefork(); (3) there's another bug/incompatibility (nearer > the latter than the former) resulting from the failure to delete empty > arguments: > > % ksh -c 'cmd=; $cmd print foo' > foo > % zsh -fc 'cmd=; $cmd print foo' > zsh: permission denied: print > > (which is certainly not the right answer in any case). > > For these reasons I've fixed the problem by getting prefork() to junk > empty nodes if and only if it is not doing single word substitution, > and execcmd() to return if and only if it is a `simple' command with > no arguments. I'm thinking about a different solution. The problem is more complicated since if one write foo* and there is no file beginning with foo and nullglob is set globlist() will produce empty args. I think globlist should be move before fork(). Probably it should be executed right after prefork. fixcline may come right after that. In execcmd there is a test for empty(args). This should be moved after prefork/globlist/fixcline. Also I think that command, exec, noglob, nocorrect and - should be removed from reswdtab and the related code should be removed from parse.c, and these should be handled in execcmd. This would enable to do things like FOO=exec ; $FOO something which whould improve sh compatibility. In bash and ksh exec is a builtin so it can be disabled or a function called exec can be defined. This may be implemented is zsh as well. Unfortunately I do not fully understand exec.c so it may take a while for me unless someone else wiser than me makes these changes. Zoltan