unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ioannis Kappas <ioannis.kappas@gmail.com>
Cc: 46388@debbugs.gnu.org
Subject: bug#46388: 27.1; emacs -batch does not output messages immediately when invoked outside of the command prompt
Date: Tue, 09 Feb 2021 22:52:13 +0200	[thread overview]
Message-ID: <83h7mlj75u.fsf@gnu.org> (raw)
In-Reply-To: <CAMRHuGC+8ZP270Erd8q=MTrw7CUS-7+PX7GTFc2JJgkexorAsw@mail.gmail.com> (message from Ioannis Kappas on Tue, 9 Feb 2021 20:15:34 +0000)

> From: Ioannis Kappas <ioannis.kappas@gmail.com>
> Date: Tue, 9 Feb 2021 20:15:34 +0000
> Cc: 46388@debbugs.gnu.org
> 
> Which appears to suggests that stderr always starts as "unbuffered"
> when a program starts, irrespective of how it was invoked?

AFAIR, on GNU/Linux stderr is not unbuffered by default.  We had a
long discussion of related issues in June 2019, I think people who
know about the glibc internals told there stderr is not really
completely unbuffered (and Posix allows that).

On MS-Windows it is by default unbuffered.

> Back to the windows behavior at hand, the simple test conducted with
> fwrite as the bug report mentioned, has a 2048 bytes associated with
> it which I will consider it to be categorized as "fully buffered",
> which brings it further away to the posix standard and even more further
> away from Linux being on the other end (always unbuffered).

I'm not sure your conclusion is correct.  I think the buffering is
imposed by the pipes which Emacs uses for communications with
subprocesses.  Or at least this is an additional buffering that is
related to the issue at hand.

> Unix convention is that stdin and stdout are line-buffered when
> associated with a terminal, and fully-buffered (aka block-buffered)
> otherwise. stderr is always unbuffered.
> 
> """
> 
> emphasis on *Unix convention ... stderr .. always unbuffered*, though
> it will be difficult to confirm this claim for all *nices)

I think Windows behaves the same, at least by default.  But GNU/Linux
isn't.

> For #2, emacs batch stderr behavior when invoked from outside the
> command line is not compatible with the posix standard, since it uses
> "fully buffered" mode, which actually makes it behave very differently
> from Linux (which is posix compliant by always having stderr as being
> unbuffered). Thus, the suggested patch actually addresses this
> concern, rather than invalidating it.

Again, are you sure it isn't the pipe that imposes buffering?

> (I understand ConPTY is the long term solution looking for a hacker,
> though I still do
> suppose the current behavior on windows is odd and needs to be
> addressed until that time).

I don't see it as odd.  The behavior of stdout and stdin could be odd
(again, due to pipes being used), but not that of stderr.





  reply	other threads:[~2021-02-09 20:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-08 21:20 bug#46388: 27.1; emacs -batch does not output messages immediately when invoked outside of the command prompt Ioannis Kappas
2021-02-08 21:42 ` Ioannis Kappas
2021-02-09  5:36   ` Eli Zaretskii
2021-02-09 20:15     ` Ioannis Kappas
2021-02-09 20:52       ` Eli Zaretskii [this message]
2021-02-09 21:14         ` Eli Zaretskii
     [not found]           ` <CAMRHuGC_p59uw_hmCL65Z0F1ZdFbVAf9MHcB-sX88bW6jchC-Q@mail.gmail.com>
2021-02-10 12:48             ` Ioannis Kappas
2021-02-10 15:57               ` Eli Zaretskii
2021-02-11  8:10                 ` Ioannis Kappas
2021-02-11 14:09                   ` Eli Zaretskii
2021-02-11 19:25                     ` Ioannis Kappas
2021-02-11 19:55                       ` Eli Zaretskii
2021-02-12 19:59                         ` Ioannis Kappas
2021-02-12 20:03                           ` Eli Zaretskii
2021-03-06 15:00                             ` Ioannis Kappas
2021-03-08  4:05                               ` Paul Eggert
2021-03-08  7:56                                 ` Ioannis Kappas
2021-03-11 14:27                                 ` Eli Zaretskii
2021-03-11 18:43                                   ` Paul Eggert
2021-02-11 21:15                     ` Paul Eggert
2021-02-09  3:38 ` 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=83h7mlj75u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=46388@debbugs.gnu.org \
    --cc=ioannis.kappas@gmail.com \
    /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).