bug-coreutils
[Top][All Lists]
Advanced

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

Re: dd hangs with SIGINT


From: Jim Meyering
Subject: Re: dd hangs with SIGINT
Date: Thu, 07 Apr 2005 16:24:34 +0200

Bruno Haible <address@hidden> wrote:
> Guillaume Chazarain wrote:
>> As it prints a message for the first time, it has to
>> initialize gettext, and I'm not sure this qualifies for the "do as
>> little as possible in a signal handler" rule.
>
> I agree. The list of guaranteed async-safe function calls on POSIX systems
> is listed at
> http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
>
> fprintf() is not part of it. gettext() neither, nor are the calls made
> by gettext(), namely malloc(), free(), tsearch(), mmap(). So it would seem
> advisable to pre-fetch the translations before the SIGINT happens. Untested
> patch is appended. Unfortunately it forces to remove ngettext() calls, which
> is bad for plural handling. Also you need to check the quote() call whether
> it avoids calling malloc...

Hi Bruno,

Thanks for the patch, but that `cure' seems worse than the disease.
If there is no better way to solve the problem, then I'd consider
leaving the code the way it is.

Not only does that change make the code less maintainable in the sense
that every message that might be generated by print_stats must be
pre-translated, but it also moves the format strings away from
the corresponding argument lists; and that makes it so the compiler
can no longer verify types and number of format directives vs. arguments.

Jim



reply via email to

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