unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 160b4c295d8: ; * src/process.c (child_signal_notify): Avoid compiler warning (bug#65919).
       [not found] ` <20230915060543.76EF0C051F1@vcs2.savannah.gnu.org>
@ 2023-09-18 13:51   ` Robert Pluim
  2023-09-18 19:35     ` bug#65919: " Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Pluim @ 2023-09-18 13:51 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eli Zaretskii, Paul Eggert

>>>>> On Fri, 15 Sep 2023 02:05:43 -0400 (EDT), Eli Zaretskii <eliz@gnu.org> said:

    Eli> branch: master
    Eli> commit 160b4c295d8975755d4a8cc4ba6b6b75a549ed3c
    Eli> Author: Eli Zaretskii <eliz@gnu.org>
    Eli> Commit: Eli Zaretskii <eliz@gnu.org>

    Eli>     ; * src/process.c (child_signal_notify): Avoid compiler warning (bug#65919).
    Eli> ---
    Eli>  src/process.c | 18 ++++++++++++------
    Eli>  1 file changed, 12 insertions(+), 6 deletions(-)

    Eli> diff --git a/src/process.c b/src/process.c
    Eli> index 7410256dae9..2376d0f288d 100644
    Eli> --- a/src/process.c
    Eli> +++ b/src/process.c
    Eli> @@ -7415,10 +7415,14 @@ child_signal_notify (void)
    Eli>    int fd = child_signal_write_fd;
    Eli>    eassert (0 <= fd);
    Eli>    char dummy = 0;
    Eli> -  if (emacs_write (fd, &dummy, 1) != 1)
    Eli> -    /* This call is commented out.  It calls `emacs_perror', which in
    Eli> -       turn invokes a localized version of strerror that is not
    Eli> -       reentrant and must not be called within a signal
    Eli> handler:

Is it worth the effort to use strerror_r-posix here from Gnulib? Weʼd
have to use a static char buffer to avoid malloc, but it might be
better than nothing.

Robert
-- 



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

* bug#65919: master 160b4c295d8: ; * src/process.c (child_signal_notify): Avoid compiler warning (bug#65919).
  2023-09-18 13:51   ` master 160b4c295d8: ; * src/process.c (child_signal_notify): Avoid compiler warning (bug#65919) Robert Pluim
@ 2023-09-18 19:35     ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2023-09-18 19:35 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 65919, Eli Zaretskii, emacs-devel

On 2023-09-18 06:51, Robert Pluim wrote:
> Is it worth the effort to use strerror_r-posix here from Gnulib?

I don't think that'd suffice, since POSIX does not require strerror_r to 
be async-signal-safe 
<https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/V2_chap02.html#tag_15_04_03_03>.

Emacs could instead convert the error number to the textual 
representation of a decimal number and write that text to stderr; that 
would be async-signal-safe if done without using sprintf etc. The error 
number wouldn't be as nice as a strerror string but it would be better 
than nothing.

If you want to be fancier, whenever Emacs calls setlocale it could cache 
all the possible strerror strings into storage that safe to be used in a 
signal handler, and use one of those strings if available, outputting a 
decimal number otherwise.





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

end of thread, other threads:[~2023-09-18 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <169475794317.12794.4825888702595787215@vcs2.savannah.gnu.org>
     [not found] ` <20230915060543.76EF0C051F1@vcs2.savannah.gnu.org>
2023-09-18 13:51   ` master 160b4c295d8: ; * src/process.c (child_signal_notify): Avoid compiler warning (bug#65919) Robert Pluim
2023-09-18 19:35     ` bug#65919: " Paul Eggert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).