zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Peter Stephenson <pws@ifh.de>, Zoltan Hidvegi <hzoli@cs.elte.hu>,
	sinclair@dis.strath.ac.uk (Duncan Sinclair),
	zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: execcmd() reordering
Date: Fri, 31 May 1996 09:28:19 -0700	[thread overview]
Message-ID: <960531092822.ZM1156@candle.brasslantern.com> (raw)
In-Reply-To: Zoltan Hidvegi <hzoli@cs.elte.hu> "Re: execcmd() reordering" (May 31, 12:55pm)
In-Reply-To: Peter Stephenson <pws@ifh.de> "Re: execcmd() reordering" (May 31,  1:58pm)

On May 31, 12:55pm, Zoltan Hidvegi wrote:
} Subject: Re: execcmd() reordering
}
} > Oh, absolutely!  Does this change mean I can't interrupt long globs???
} > This would be terrible - esp. if the glob goes into a loop.
} 
} Do not worry.  Zsh never forked for builtins and you were able to interrupt
} things like echo **/*.  This is not changed.

Well, it's changed a little:

zagzig% echo **/*		(wait a couple of seconds, ^C)
zsh: bad pattern: **/*

It didn't used to complain about the pattern.  (Beta 19 without the
ececcmd patch has the problem; I haven't tried the execcmd patch yet.)

} ^Z will not work for
} suspending external commands but other than that there should be no
} noticable change

That's a very noticeable change, to me.

} unless something is backgrounded.

And then what?

} ^Z never worked for builtins and shell functions

I know, and that has always annoyed me.

} and the number of arguments that can be passed
} to external commands is always limited by the OS (although on modern
} systems this limit is very high).

What does that have to do with anything?  Zsh is still going to finish
the entire glob.  Even a very small glob is pretty slow on a filesystem
that's NFS mounted over a PPP link (as a pathological example).

On May 31,  1:58pm, Peter Stephenson wrote:
} Subject: Re: execcmd() reordering
}
} I didn't realise the problem with backgrounding recursive globs
} before, since I've never tried it.  I can't think of a way round other
} than using a subshell.  Bummer.  (Interruption is definitely OK,
} though.)

What if globbing was always treated as if it were a command sub?  E.g.
implement

	echo **/*

as

	echo $(echo **/*)

You could even make this behavior an option, SPAWN_GLOBS or some such,
and have an extendedglob metacharacter to use it for individual globs.

Now you've got a process handling the glob, so that can be stopped and
started without messing up the parent shell ... zsh would then have to
do some magic with the job table so that it could stash a partially-
parsed command string along with the job entry.

If the job later is foregrounded again, the current shell restarts the
globjob and picks up the parsing where it left off.

Backgrounding is tougher.  It *could* fork, resume the globjob, and then
the new subshell would pick up the parse; but then the subshell would be
a sibling of the globjob and wouldn't get the exit status notification.
I'd be satisfied with an error about not being able to background the
glob, as long as I could stop it, do something else briefly, and then
pick up again where I left off (rather than having to interrupt and then
start over from scratch).

(Maybe doing it as a command sub works around the problem of not being
able to stop non-builtins?  Then we'd at least be no worse off than we
were before.  I don't know what effect this reordering has on all the
other kinds of substitutions.)

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



  reply	other threads:[~1996-05-31 16:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-31 10:15 Duncan Sinclair
1996-05-31 10:55 ` Zoltan Hidvegi
1996-05-31 11:58   ` Peter Stephenson
1996-05-31 16:28     ` Bart Schaefer [this message]
  -- 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=960531092822.ZM1156@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=hzoli@cs.elte.hu \
    --cc=pws@ifh.de \
    --cc=schaefer@nbn.com \
    --cc=sinclair@dis.strath.ac.uk \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).