zsh-workers
 help / color / mirror / code / Atom feed
* Re: execcmd() reordering
@ 1996-05-31 10:15 Duncan Sinclair
  1996-05-31 10:55 ` Zoltan Hidvegi
  0 siblings, 1 reply; 13+ messages in thread
From: Duncan Sinclair @ 1996-05-31 10:15 UTC (permalink / raw)
  To: schaefer; +Cc: Zoltan Hidvegi, zsh-workers


"Barton E. Schaefer" writes:
>On May 30,  9:10pm, Zoltan Hidvegi wrote:
>} Subject: Re: execcmd() reordering
>}
>} > When you've got a *huge* expansion which is 50% of the run-time
>} > of the command, I'd like to be able to get on with other things.
>} 
>} You can use (foo **/*) &
>
>I tend to agree with Duncan here, I'm afraid.  I may not have any idea
>how large a list the glob is going to expand into; it's ridiculous to
>expect me to subshell every command that might do a glob.
>
>Furthermore, it'd be really nice to be able to stop (^Z) an unexpectedly
>huge glob and then "bg" it, or to interrupt it with ^C if I decide it was
>a mistake.

Oh, absolutely!  Does this change mean I can't interrupt long globs???
This would be terrible - esp. if the glob goes into a loop.

All the other things, I can live with.  This gives me nightmares.

Bye for now,


Duncan.



^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: execcmd() reordering
@ 1996-05-30 18:05 Duncan Sinclair
  1996-05-30 19:10 ` Zoltan Hidvegi
  0 siblings, 1 reply; 13+ messages in thread
From: Duncan Sinclair @ 1996-05-30 18:05 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list


Peter wrote about exec stuff:
>Here's a biggish patch which does that. ...

>2) Now `nocorrect' must appear before any of the above.

Why?

>3) Also, variable assignment must appear before exec and friends.
>Again, this is natural and is required in other Bourne shell clones.

There's a flag (-k, I think) which will allow the bourne shell to take
variable assignments at any point of the command - does this work?

>5) `noglob typeset foo=~/file' do not do tilde expansion without...

>Maybe we should change.  Even
>magic_equal_subst is fairly sparing about when to expand:  it insists
>on the text before the = consisting only of characters which appear in
>identifiers, something I wrote but now rather regret.

Is this the stuff we argued about years ago?  I'm all for a change here.

>6) globbing is expanded before the fork.

I don't like this at all.

>Other than getting the
>prompt back an iota later when running background commands, I don't
>see this is a big deal.

When you've got a *huge* expansion which is 50% of the run-time
of the command, I'd like to be able to get on with other things.

>  (vii) I get extra brownie points for doing this the week before the
>        annual lattice field theory conference where I'm giving a
>        talk.  Please don't tell my collaborators :-).

Have fun!



Duncan.



^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: $(nooutput) problem
@ 1996-05-28 11:34 Zoltan Hidvegi
  1996-05-30 16:58 ` execcmd() reordering Peter Stephenson
  0 siblings, 1 reply; 13+ messages in thread
From: Zoltan Hidvegi @ 1996-05-28 11:34 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

> 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



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~1996-05-31 16:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-31 10:15 execcmd() reordering Duncan Sinclair
1996-05-31 10:55 ` Zoltan Hidvegi
1996-05-31 11:58   ` Peter Stephenson
1996-05-31 16:28     ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
1996-05-30 18:05 Duncan Sinclair
1996-05-30 19:10 ` Zoltan Hidvegi
1996-05-30 19:52   ` Barton E. Schaefer
1996-05-31 14:32     ` Hrvoje Niksic
1996-05-28 11:34 $(nooutput) problem Zoltan Hidvegi
1996-05-30 16:58 ` execcmd() reordering Peter Stephenson
1996-05-30 18:00   ` Zoltan Hidvegi
1996-05-30 18:26     ` Barton E. Schaefer
1996-05-30 18:46       ` Zoltan Hidvegi
1996-05-30 18:41     ` Zoltan Hidvegi

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).