emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#35046: closed ([PATCH] factor: check the standard


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#35046: closed ([PATCH] factor: check the standard output instead of the standard input)
Date: Sun, 31 Mar 2019 22:54:03 +0000

Your message dated Sun, 31 Mar 2019 15:53:44 -0700
with message-id <address@hidden>
and subject line Re: bug#35046: [PATCH] factor: check the standard output 
instead of the standard input
has caused the debbugs.gnu.org bug report #35046,
regarding [PATCH] factor: check the standard output instead of the standard 
input
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
35046: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35046
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH] factor: check the standard output instead of the standard input Date: Sat, 30 Mar 2019 15:43:17 +0900 User-agent: Mournmail/0.2.0 Textbringer/0.3.2 Ruby/2.7.0
* src/factor.c (lbuf_putc): Use line buffered mode if the standard
output (not the standard input) is a terminal in the same way as the
stdio library.  User programs might use pty only for the standard out
like the example of Ruby's PTY module:
https://docs.ruby-lang.org/en/2.6.0/PTY.html#module-PTY-label-Example
---
 src/factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/factor.c b/src/factor.c
index 39e8918ff..173774045 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -2403,7 +2403,7 @@ lbuf_putc (char c)
       /* Provide immediate output for interactive input.  */
       static int line_buffered = -1;
       if (line_buffered == -1)
-        line_buffered = isatty (STDIN_FILENO);
+        line_buffered = isatty (STDOUT_FILENO);
       if (line_buffered)
         lbuf_flush ();
       else if (buffered >= FACTOR_PIPE_BUF)
-- 
2.11.0




--- End Message ---
--- Begin Message --- Subject: Re: bug#35046: [PATCH] factor: check the standard output instead of the standard input Date: Sun, 31 Mar 2019 15:53:44 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 30/03/19 22:14, Paul Eggert wrote:
> Pádraig Brady wrote:
>>> -        line_buffered = isatty (STDIN_FILENO);
>>> +        line_buffered = isatty (STDOUT_FILENO);
>>>         if (line_buffered)
>>>           lbuf_flush ();
>>>         else if (buffered >= FACTOR_PIPE_BUF)
>> That would impact use cases like:
>>
>>    factor | sed -u 's/.*: *//'
> 
> Sure, but the longstanding tradition for almost all GNU utilities is for 
> stdout 
> to be line-buffered if it is a tty (regardless of whether stdin is a tty), 
> and 
> that's how 'factor' behaved until we started fooling with buffering in 
> coreutils 
> 8.24. Shouldn't we simply go back to the longstanding tradition for deciding 
> whether to line-buffer stdout? Surely factor's current behavior is simply a 
> bug 
> introduced in 8.24 and not fixed in 8.26.

I should be clearer, sorry.

I think this could be improved.
I've pushed the change to set line_buffered if either stdin or stdout isatty():
https://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=6d78a28

I was wondering if there was a practical use case that this impacted.
Enough justification was provided in the commit message which I didn't read 
fully.

The original buffering adjustments were so that parallel invocations of factor,
output lines atomically, which factor is able to achieve given its restricted 
output format.

Marking this as done.

thanks,
Pádraig


--- End Message ---

reply via email to

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