Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: timing builtins etc.

Peter Stephenson wrote:

> (Thought I'd sent this:  it looks like I exited Emacs before MH
> finished sending it.)
> I have been working on the bug that builtins and shell functions can't
> be timed.  I found a neat way of doing it which simply involved adding
> the current process to the job list.  This even supplied a more
> natural way of fixing the previous bug that a builtin run at the end
> of the pipeline lost its status to something before.  It was all very
> swish, and it works fine for builtins.
> Unfortunately it doesn't work for shell functions.  The culprit is the
> list_pipe code in exec.c, which randomly deletes the job from the
> table and it gets used for other purposes later (you can't simply
> hijack the new current job).  So the code worked where the shell
> function was inside a pipe, such as `echo foo | fn', but not on its
> own.
> Unfortunately, too, the list_pipe code is horrendously complicated and
> completely uncommented and I've never understood any of it.  Can
> anybody suggest anything?  Does anybody know why it randomly deletes
> jobs?  Isn't there a neater way of fixing the original problem?

Well, I should be able to say something about, but it's a while back
since I wrote it (one thing drives another thing out, you know...).

I only remember that after most of the stuff I wrote there worked
someone came up with an example of some compicated pipe that suddenly
stopped working. That made me add the deletepipejob() thing and the
first deletejob() in execpline(), but I don't remember the exact

I think it is clear that the whole exec.c/jobs.c stuff should be
rewritten (not doing so was the real mistake I made), but who will do
that (certainly not me ;-).

> I'm tempted to pretend that the code is already in a pipeline when
> `time' is used.  I'm not quite sure yet what effect this will have.


Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx

Messages sorted by: Reverse Date, Date, Thread, Author