From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83h7mlj75u.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35219"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46388@debbugs.gnu.org To: Ioannis Kappas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 09 21:53:37 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9a0t-00094A-EQ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 21:53:35 +0100 Original-Received: from localhost ([::1]:38262 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9a0s-0003fe-F4 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 09 Feb 2021 15:53:34 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l9a0O-0003TL-Cf for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 15:53:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43268) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l9a0L-0003G5-Vp for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 15:53:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l9a0L-0000oH-Ty for bug-gnu-emacs@gnu.org; Tue, 09 Feb 2021 15:53:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 09 Feb 2021 20:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46388 X-GNU-PR-Package: emacs Original-Received: via spool by 46388-submit@debbugs.gnu.org id=B46388.16129039503073 (code B ref 46388); Tue, 09 Feb 2021 20:53:01 +0000 Original-Received: (at 46388) by debbugs.gnu.org; 9 Feb 2021 20:52:30 +0000 Original-Received: from localhost ([127.0.0.1]:54814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9Zzp-0000nV-W9 for submit@debbugs.gnu.org; Tue, 09 Feb 2021 15:52:30 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:32828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l9Zzo-0000nK-Us for 46388@debbugs.gnu.org; Tue, 09 Feb 2021 15:52:29 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55376) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l9Zzh-0002wH-DT; Tue, 09 Feb 2021 15:52:22 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:3562 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l9Zzc-0005IT-ND; Tue, 09 Feb 2021 15:52:19 -0500 In-Reply-To: (message from Ioannis Kappas on Tue, 9 Feb 2021 20:15:34 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199732 Archived-At: > From: Ioannis Kappas > 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.