Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: $(nooutput) problem
- X-seq: zsh-workers 1209
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: pws@xxxxxx (Peter Stephenson)
- Subject: Re: $(nooutput) problem
- Date: Tue, 28 May 1996 13:34:37 +0200 (MET DST)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <199605280918.LAA10810@xxxxxxxxxxxx> 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
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author