zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: Re: Allowing traps
@ 2000-11-23  8:11 Sven Wischnowsky
  2000-11-23 19:14 ` Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Sven Wischnowsky @ 2000-11-23  8:11 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
> 
> } There's still one more problem, which is that it might be possible for a
> } trap to get queued while it's not ignored, but then become ignored before
> } the queue runs.
> } 
> } I'm still a bit concerned that there's going to be a bad interaction between
> } queued signals and queued traps.
> 
> This is what it comes down to:  The problem only occurs with signals that
> can arrive asynchronously.  We already have the signal queueing code to
> handle that case; if it needs to be applied more widely, we should do that,
> but I no longer believe that a blanket trap-handler-queue is a good idea.

Of course I have no objections to use a cleaner solution, but will the 
signal-blocking really allow us to execute more trap handlers
immediately? Considering the many places where concurrent execution is 
unsafe...

And who is going to find all the places where we have to block/unblock 
signals? (To keep the sections with signals blocked short.) Somehow I
envision many extra system calls, but I really haven't tried to make a 
list where we need to keep trap handlers from running, so I may be
wrong...


Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: PATCH: Re: Allowing traps
@ 2000-11-24  8:06 Sven Wischnowsky
  0 siblings, 0 replies; 8+ messages in thread
From: Sven Wischnowsky @ 2000-11-24  8:06 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
> 
> The short answer would be "everywhere that we manipulate global variables
> that are pointers."  That's a bit strong, as simple dereferencing should
> be OK.  Based on a grep of *.(c|h|e#pro) files, there appear to be at least
> 234 such variables (including structs that may contain pointers, though I
> may have missed some of those), of which 44 are static and 57 are part of
> the completion system.  Another 35 are part of ZLE.
> 
> So 25% of the global pointers are in the completion system, and I'd be
> willing to bet that it modifies its globals a lot more heavily than just
> about anything except the memory allocators.  That makes the completion
> system an awfully large target for an interactive shell that's receiving
> SIGALRM once every second; no wonder Thomas is seeing problems.
> 
> The other pesky bits are the parameter tables, which could mostly be
> covered by doctoring params.c.

Judging from the debugging output I got from Thomas I think it was
this part that finally caused the SEGVs (if I remember correctly).

And hence I'm not convinced that the completion code (note: `code',
not `system') is really a problem. In fact, it should be easy to make
safe once the other code is safe. Because nowadays we have only very
few entry points to the completion code that can be guarded to
disallow invoking the code while it is still being executed (i.e. make 
sure that trap handlers can't call it -- that wouldn't make much sense 
anyway, I think).

And later we can put all the completion state in a struct and use that 
to make it reentrant. Something I've been wishing to have for the
lexing, parsing and execution code for years (there we use structs to
safe and restore the state, copying it from/to global variables).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Allowing traps
@ 2000-11-20 16:54 Peter Stephenson
  2000-11-20 17:39 ` PATCH: " Bart Schaefer
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2000-11-20 16:54 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
> We don't need a flag ... the behavior should be that for all xxx, SIGxxx is
> blocked when running the trap for that signal.  The OS will enforce that if
> the trap is run directly from the signal handler, so we should emulate it
> when running the traps in deferred fashion.

That doesn't fix the problem that the shell will try and run traps already
in the queue from within shell code called from the trap handler --- which
may be the trap for another signal.  I don't see a way of stopping that
without a flag.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

end of thread, other threads:[~2000-11-24  8:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-23  8:11 PATCH: Re: Allowing traps Sven Wischnowsky
2000-11-23 19:14 ` Bart Schaefer
2000-11-23 21:42   ` Peter Stephenson
2000-11-23 21:58     ` Bart Schaefer
2000-11-23 22:05     ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-11-24  8:06 Sven Wischnowsky
2000-11-20 16:54 Peter Stephenson
2000-11-20 17:39 ` PATCH: " Bart Schaefer
2000-11-22 17:33   ` Bart Schaefer

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).