[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the GNU GMP Library for Bignums in Emacs

From: Eli Zaretskii
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Mon, 23 Apr 2018 18:18:59 +0300

> From: Richard Stallman <address@hidden>
> CC: address@hidden, address@hidden, address@hidden
> Date: Sun, 22 Apr 2018 23:34:58 -0400
> Quiting always worked by setting a flag, tested by the QUIT macro.
> However, as I implemented it, some constructs used to specify to quit
> immediately straight from the signal handler.

This still happens, but much less frequently: only on text-mode
frames, and only when Emacs waits for input.

> I see that this feature has been deleted.  That is going to cause a
> bad results.  There are quite a few places in the C code of Emacs
> where execution can get stuck; that's why I added immediate quitting.
> The problems I fixed that way have all come back.
> What was the reason for this change?

The main reasons were described and discussed in bug#12471, in the
context of making signal handling in Emacs more robust.  I reproduce
that description below.

In addition, the asynchronous input code caused problems and
limitations, the most (in)famous being that we needed to refrain from
calling malloc in places that could be potentially run from the signal

Also note this discussion about actually making synchronous input the
default one:


And here's your agreement to making that the default:


 * Signal handlers can interrupt each other, leading to races.

 * Signals can be mishandled if they arrive right in the middle of
   code that is keeping track of whether signals have arrived.

 * Some variables are modified by signal handlers but are not
   declared 'volatile', which means accesses to them could be
   incorrectly optimized.

 * When debugging, the debugging code can get into an infinite
   signal-handling loop if there's a bug in the fatal error handler.

 * There are some bugs involving running out of memory in the middle
   of a vfork, in which signal handlers aren't restored correctly and
   Emacs is likely to misbehave.

 * Signals are always redirected to the main thread, resulting in
   incorrect backtraces when, for example, a subsidiary thread has
   a segmentation violation.  Thread-specific signals like SIGSEGV
   should have thread-specific backtraces.

 * When in batch mode, Emacs doesn't ignore SIGINT if the invoker has
   purposely ignored SIGINT.  Similarly for SIGTERM.  Emacs gets
   SIGHUP right, but the other two signals should be consistent
   with the usual behavior for batch programs.

 * Emacs isn't consistent about what tests it uses to decide whether
   it is in batch mode, leading to glitches when the tests disagree.

 * Emacs catches SIGPIPE, but it's better to ignore it, as this avoids

 * Emacs catches SIGFPE, but on IEEE hosts catching SIGFPE isn't
   needed and can mask bugs; it's better to catch SIGFPE only on (the
   now quite rare) non-IEEE hosts.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]