Zsh Mailing List Archive
Messages sorted by:
Re: It seems that I find a zle -F full CPU bug
- X-seq: zsh-workers 32419
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: It seems that I find a zle -F full CPU bug
- Date: Thu, 20 Feb 2014 12:47:18 -0800
- Cc: "lilydjwg@xxxxxxxxx" <lilydjwg@xxxxxxxxx>
- In-reply-to: <CAH+w=7ZQ3ivj3DOe0e4z7_w=Av-FvLxfxzdb3vtWQpzvhCmoLw@mail.gmail.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20140220050415.GA29027@lilyforest> <CAH+w=7Z+R_ZexSkesp2z+ndooHStOGJcMeWXtD7HCunjqJp9-Q@mail.gmail.com> <email@example.com> <20140220131659.GA21182@lilyforest> <CAH+w=7ZQ3ivj3DOe0e4z7_w=Av-FvLxfxzdb3vtWQpzvhCmoLw@mail.gmail.com>
On Thursday, February 20, 2014, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> Hmm ... looking at the loop, there is already some provision for this. If
> poll() [or select()] returns -1, we discard all the handler FDs etc. and
> repeat with just the SHTTY FD. I wonder if the situation that code is
> meant to handle is even possible.
Interrupt on a signal is a case where this can happen, it appears.
> Aside: Am I misreading the code, or is it the case that the (HAVE_TIO &&
> sun) #ifdef branch does not support zle -F ?
If there is user typeahead this branch is going to read it and return. If
not then it falls through to one of poll() or select() on the other
descriptors. So I this appears OK, though it may be delayed more than
other cases in calling the handlers.
> The handler can know that the fd is closed in case of 'poll': the
>> handler will get an argument like 'hup' or 'nval'.
> I don't think the handler ever gets anything but a file descriptor number?
Hmm. It appears that a widget handlers (zle -F -w) will never get
anything but a descriptor number. Without -w, the handler will get either
the descriptor number or a string describing the error condition (which
means in order to remove itself on an error, the handler has to know out of
band which descriptor it is watching?). Those error-string values are not
However ... and again I may be reading this wrong ... I think the outer
test for whether to call the handler at all will skip the handlers for FDs
with error states. In the HAVE_POLL branch, for example, it first looks
for the POLLIN flags but not for any error flags? So it will never reach
the set of tests that examine POLLNVAL et al.?
That aside, dropping the invalid descriptors for the select() case is easy,
just change the bitflags. For the poll() case it's going to be more work
because the fds array of structs will have to be rearranged.
Messages sorted by: