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: Sat, 22 Jun 2019 12:14:55 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1

Eli Zaretskii wrote:
an error message could legitimately be output piecemeal.

All such error messages in Emacs are output with a trailing newline right away, so there is no significant problem here. The trailing newline is standard practice, both in Emacs and elsewhere. For example, consider the following code (taken from src/pdumper.c):

  static void
  dump_fingerprint (const char *label, unsigned char const *xfingerprint)
  {
    fprintf (stderr, "%s: ", label);
    for (int i = 0; i < 32; ++i)
      fprintf (stderr, "%02x", (unsigned) xfingerprint[i]);
    fprintf (stderr, "\n");
  }

Here, GNU/Linux Emacs would issue 34 'write' system calls if stderr were using _IONBF (and the output line could be interleaved with other output lines, possibly causing confusion), whereas GNU/Linux Emacs issues just one 'write' system call now that stderr uses _IOLBF (thus avoiding the confusion).

I don't see any significant problem with line-buffering here, or anywhere else that Emacs outputs to stderr. And I've looked at quite a few uses.

You will audit the sources from now to eternity?

An audit is not necessary. I volunteered to audit only to allay any concerns with my assertion that this change is OK. If these concerns cannot be allayed by any such evidence, then of course an audit would be a waste of time.



reply via email to

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