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: Thu, 20 Jun 2019 00:47:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

Eli Zaretskii wrote:
What exactly is the problem you would like to fix here?

$ strace -o /tmp/tr emacs -Q -batch -eval '(message "hello")'
hello
$ grep '^write(2,' /tmp/tr
write(2, "hello", 5)                    = 5
write(2, "\n", 1)                       = 1

There should be just one 'write' system call, not two. Because of this problem, if two Emacs processes output the lines "foo" and "bar" to the same file descriptor at nearly the same time, the output might be "foobar\n\n" or "barfoo\n\n" rather than the more-desirable "foo\nbar\n" or "bar\nfoo\n". This can cause the annoying symptoms that Lars reported in <https://lists.gnu.org/r/emacs-devel/2019-06/msg00710.html>.

I fixed it on GNU and similar platforms by installing the attached patch into Emacs master. I fixed some other minor stdio glitches while I was in the neighborhood.

Attachment: 0001-Line-buffer-stderr.patch
Description: Text Data


reply via email to

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