emacs-devel
[Top][All Lists]
Advanced

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

Re: `message' not outputting the newline "atomically"


From: Paul Eggert
Subject: Re: `message' not outputting the newline "atomically"
Date: Wed, 3 Jul 2019 00:31:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2

Eli Zaretskii wrote:
I'm okay with making 'message' write in one go to stderr, but I don't
want to pay the price of having stderr buffered globally.

I came up with a fix that does all that. Although the fix does not alter the buffering of the stderr stream, it causes 'message' and similar functions to write in one go to avoid interleaving output. It also fixes the problem on AIX and Solaris where a single call to fprintf is implemented by multiple calls to 'write' even if the diagnostic is short, botching interleaving. It also fixes the INT_MAX overflow and memory-allocation issues of the current master's implementation of 'message'.

Proposed patches attached. The first one merely refactors and simplifies the C-level code, without changing behavior; this simplifies later patches. The second patch fixes buffering of most C-level diagnostics in Emacs, so that they interleave well with other processes' diagnostics. The third patch similarly fixes buffering of most Lisp-level diagnostics in Emacs. The last patch is one more simplification of the C code.

I still far prefer the three-line patch I submitted earlier, as it was much simpler and the objections to it were theoretical (i.e., not based on actual Emacs code). However, the attached patches work nearly as well, and they do so while obeying the constraints you imposed on fixing the problem.

Attachment: 0001-New-function-errprintf-for-printf-to-stderr.patch
Description: Text Data

Attachment: 0002-Avoid-interleaving-stderr-in-most-of-C-code-Emacs.patch
Description: Text Data

Attachment: 0003-Avoid-interleaving-stderr-in-most-of-Lisp-code-Emacs.patch
Description: Text Data

Attachment: 0004-Simplify-emacs_perror.patch
Description: Text Data


reply via email to

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