unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: `message' not outputting the newline "atomically"
Date: Mon, 24 Jun 2019 00:09:57 -0400	[thread overview]
Message-ID: <jwvblynvdhl.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 83r27kmk2m.fsf@gnu.org

>> Seeing none of the 32 bytes of fingerprint instead of only seeing the
>> first N of them seems like a very minor inconvenient.
>
> See my other message: seeing the full output could be priceless.

Maybe in some hypothetical scenario.  FWIW this kind of thing never
happened to me, wheres garbled output is something I've seen at least
once a week.

> Besides, with the current buffering mode you might not see any of the
> bytes at all.

Yes, that's what I said.  And I'm perfectly fine with that.

If you think the output of each byte is important, you can add `fflush`
in the loop, of course.

> (Not that this is a very important example, but I didn't invent it.)

In my experience buffered-but-not-printed output is only a problem if
the programs gets to another place in the code, such that the lack of
output leads you to believe the code hasn't yet reached that code when
in fact it's already further.
If it crashes in the middle, the actual output doesn't matter: the
debugger will immediately tell you where the program was.

>> Buffering can indeed be harmful, but only when significant
>> computation/time can pass between the `fprintf` and the moment the
>> corresponding text is "displayed", which is not the case here (nor
>> anywhere else in Emacs's C code, according to my quick "grep stderr").
> The time has no influence on this, because no stdio implementation
> I've seen flushes buffers based on time since the last output.

It's significant when as a user you expected the output to appear
a while ago and it hasn't appeared yet (it leads you to build up
a flawed model in your head of what the program is actually doing).
In my experience, this is the situation where buffering makes debugging
painful.

In the present case this is not an issue because the \n is printed right
after and causes a flush.

>> > So this looks like a net loss to me.
>> I don't have a strong opinion on this, but FWIW, I see a net gain and no
>> significant loss.
> I see a net loss.

Yup, we disagree ;-)


        Stefan




  reply	other threads:[~2019-06-24  4:09 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 14:12 `message' not outputting the newline "atomically" Lars Ingebrigtsen
2019-06-19 14:28 ` Andreas Schwab
2019-06-19 15:41 ` Eli Zaretskii
2019-06-19 15:47   ` Lars Ingebrigtsen
2019-06-19 16:05     ` Andreas Schwab
2019-06-19 23:22       ` Paul Eggert
2019-06-20  2:35         ` Eli Zaretskii
2019-06-20  7:47           ` Paul Eggert
2019-06-20  9:35             ` Lars Ingebrigtsen
2019-06-20 12:52             ` Eli Zaretskii
2019-06-20 12:55               ` Lars Ingebrigtsen
2019-06-20 13:13                 ` Eli Zaretskii
2019-06-20 14:05                 ` Andreas Schwab
2019-06-20 16:26               ` Paul Eggert
2019-06-20 16:45                 ` Eli Zaretskii
2019-06-20 17:41                   ` Paul Eggert
2019-06-20 18:06                     ` Eli Zaretskii
2019-06-20 19:33                       ` Paul Eggert
2019-06-21  5:46                         ` Eli Zaretskii
2019-06-21  6:06                           ` Eli Zaretskii
2019-06-22  0:20                           ` Paul Eggert
2019-06-22  7:32                             ` Eli Zaretskii
2019-06-22 19:14                               ` Paul Eggert
2019-06-23  2:25                                 ` Eli Zaretskii
2019-06-23  8:34                                   ` Paul Eggert
2019-06-23 11:37                                     ` Lars Ingebrigtsen
2019-06-23 14:47                                     ` Eli Zaretskii
2019-06-23 17:32                                       ` Paul Eggert
2019-06-23 18:28                                         ` Eli Zaretskii
2019-06-23 12:53                                   ` Stefan Monnier
2019-06-23 14:51                                     ` Eli Zaretskii
2019-06-24  4:09                                       ` Stefan Monnier [this message]
2019-06-22  8:26                             ` Andreas Schwab
2019-06-22 18:53                               ` Paul Eggert
2019-06-22 19:00                                 ` Eli Zaretskii
2019-06-22 19:15                                   ` Paul Eggert
2019-06-22 19:48                                 ` Andreas Schwab
2019-06-20 13:32             ` Stefan Monnier
2019-06-20 16:28               ` Paul Eggert
2019-06-23 18:59                 ` Daniele Nicolodi
2019-06-23 20:34                   ` Paul Eggert
2019-06-23 20:42                     ` Lars Ingebrigtsen
2019-06-23 21:00                       ` Paul Eggert
2019-06-23 22:18                         ` Lars Ingebrigtsen
2019-06-23 20:48                     ` Daniele Nicolodi
2019-06-24  2:32                     ` Eli Zaretskii
2019-06-24  2:51                     ` HaiJun Zhang
2019-06-24 19:48 ` Lars Ingebrigtsen
2019-06-24 20:03   ` Daniele Nicolodi
2019-06-24 20:17     ` Lars Ingebrigtsen
2019-06-24 21:11       ` Paul Eggert
2019-06-24 21:33         ` Lars Ingebrigtsen
2019-06-24 22:03           ` Paul Eggert
2019-06-24 22:06             ` Paul Eggert
2019-06-24 22:28             ` Lars Ingebrigtsen
2019-06-24 22:47               ` Lars Ingebrigtsen
2019-06-25 16:03                 ` Eli Zaretskii
2019-06-26  9:15                   ` Lars Ingebrigtsen
2019-06-26 15:22                     ` Eli Zaretskii
2019-06-27 10:52                       ` Lars Ingebrigtsen
2019-06-26 18:27                   ` Paul Eggert
2019-06-26 18:41                     ` Eli Zaretskii
2019-06-26 18:58                       ` Paul Eggert
2019-06-26 19:11                         ` Eli Zaretskii
2019-06-26 19:36                           ` Daniele Nicolodi
2019-06-27  2:34                             ` Eli Zaretskii
2019-06-27  5:43                               ` Paul Eggert
2019-06-30 20:11                               ` Daniele Nicolodi
2019-07-01  7:41                               ` Daniele Nicolodi
2019-07-01 14:39                                 ` Eli Zaretskii
2019-07-01 17:01                                   ` Daniele Nicolodi
2019-07-02  2:28                                     ` Eli Zaretskii
2019-07-02  7:58                                       ` Daniele Nicolodi
2019-07-02 14:47                                         ` Eli Zaretskii
2019-07-02 20:56                                           ` Daniele Nicolodi
2019-07-03  5:23                                             ` Eli Zaretskii
2019-07-01 17:03                                   ` Daniele Nicolodi
2019-07-02  2:26                                     ` Eli Zaretskii
2019-06-26 19:38                           ` Paul Eggert
2019-06-25 16:06             ` Eli Zaretskii
2019-06-26  9:21               ` Lars Ingebrigtsen
2019-06-26 15:23                 ` Eli Zaretskii
2019-06-27 11:03                   ` Lars Ingebrigtsen
2019-06-27 13:31                     ` Eli Zaretskii
2019-06-28  8:30                       ` Lars Ingebrigtsen
2019-07-03  7:31                       ` Paul Eggert
2019-07-03  7:41                         ` Eli Zaretskii
2019-07-03  7:47                           ` Eli Zaretskii
2019-07-03  7:57                             ` Eli Zaretskii
2019-07-03  8:45                               ` Paul Eggert
2019-07-03  9:30                                 ` Eli Zaretskii
2019-07-03 23:08                                   ` Paul Eggert
2019-07-04 13:24                                     ` Eli Zaretskii
2019-07-07  1:16                                       ` Paul Eggert
2019-07-07 14:51                                         ` Eli Zaretskii
2019-07-08 22:35                                           ` Richard Copley
2019-07-09  2:33                                             ` Eli Zaretskii
2019-07-09 13:45                                               ` Richard Copley
2019-07-09 15:16                                                 ` Eli Zaretskii
2019-07-09  2:47                                           ` Paul Eggert
2019-07-09 16:39                                             ` Eli Zaretskii
2019-07-09 18:12                                               ` Paul Eggert
2019-07-09 18:32                                                 ` Eli Zaretskii
2019-07-09 18:44                                                   ` Lars Ingebrigtsen
2019-07-09 19:17                                                     ` Eli Zaretskii
2019-07-14  0:42                                                   ` Paul Eggert
2019-07-14  6:01                                                     ` Eli Zaretskii
2019-06-25 16:08         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvblynvdhl.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).