From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 30 04:30:05 2019 Received: (at submit) by debbugs.gnu.org; 30 Mar 2019 08:30:05 +0000 Received: from localhost ([127.0.0.1]:36226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hA9NM-0000O2-MP for submit@debbugs.gnu.org; Sat, 30 Mar 2019 04:30:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hA7iE-0006G9-NB for submit@debbugs.gnu.org; Sat, 30 Mar 2019 02:43:31 -0400 Received: from lists.gnu.org ([209.51.188.17]:54454) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hA7i9-0008HT-Hn for submit@debbugs.gnu.org; Sat, 30 Mar 2019 02:43:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hA7i8-0003YK-Ch for bug-coreutils@gnu.org; Sat, 30 Mar 2019 02:43:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hA7i7-0008H4-8f for bug-coreutils@gnu.org; Sat, 30 Mar 2019 02:43:24 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:33983) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hA7i6-0008FX-W3 for bug-coreutils@gnu.org; Sat, 30 Mar 2019 02:43:23 -0400 Received: by mail-pf1-x431.google.com with SMTP id b3so2072420pfd.1 for ; Fri, 29 Mar 2019 23:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:message-id:subject:mime-version :content-transfer-encoding:user-agent; bh=APn4FO/9BH3VKLxZ5J3iP799t+qVkzPu5Ua7vTlUxLk=; b=k3QqrgFWwUU4+sdhZPYhrapEF13XElrdi2G213FnRmKbGcQUpuNlOCUfI9PwyBfGXJ LK8KYvPPVO6TwKUv68ynbyXbjgUCYUIAf7A++ztuuEEAs4WCqjpZ89MSvYNdnTJGhlPl 7HrjuDI7KIrRvPLt1DM+kL9DokbJkCvssRkoGow+bQrNTRVfSaB10298Oz83eswQOQ1r 18xC5KJF4QV+T1NRDaVKfUe+2M68D14hkhVxg64xESQ4dxZVP4GLnkcsZbhtUPZQDRl5 U7eaeyZG0JID6i0dl6hVZuiYFA2FB9SUSfe4uqv4lSaqX5WALvFtQB8OM9peTsZTQg7J qUOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:message-id:subject :mime-version:content-transfer-encoding:user-agent; bh=APn4FO/9BH3VKLxZ5J3iP799t+qVkzPu5Ua7vTlUxLk=; b=LIbZ68LWdjVqUGsfXRpG7ssmMPj+6+odAb9rblYnTlUahVMkZc7hZaRveb0cMYKkSh K4Y3YFGmiUGXvaAD7Py6s96au8o75/PL+qHr8EDhHcyZ1eRpr0CNKvKMg1YzYcKKoHI6 iLJ01c2uTBei5pRNiYbv2CrPIUvdWS5PehUFXxpHONrYZSrbEi8fccnY6TerYHdgTDVK O3txtiJtIuv3Bg+iSruuwUV44XQitpoZikby1oEuWNEpSukdq6hJAMdm2O0q84Ye6zSs HyupHZxhjRe6sbFb2Re8QegUoe5PahuRJxvZ9pgYlehLaSPmgDWHitYBsE4g7UhL1M3Z kPDg== X-Gm-Message-State: APjAAAWQcvSbegAa6ExrCxW0owIMHOPLkAJUhaDc14Qr/Q/4cVjfteeG SNnAeX7X5RLLPhsLSXg386sjejQUOxE= X-Google-Smtp-Source: APXvYqzp1A0ve8opaSHZY++vjXi11YNOnPOnZ3gG8TRpu2EPYR1MfCWwP6ADcp79xS7aDWDGmDvSaw== X-Received: by 2002:a62:1815:: with SMTP id 21mr5301349pfy.107.1553928200148; Fri, 29 Mar 2019 23:43:20 -0700 (PDT) Received: from discovery (201.91.0.1.megaegg.ne.jp. [1.0.91.201]) by smtp.gmail.com with ESMTPSA id w6sm3535874pga.11.2019.03.29.23.43.18 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Mar 2019 23:43:19 -0700 (PDT) Date: Sat, 30 Mar 2019 15:43:17 +0900 From: Shugo Maeda To: bug-coreutils@gnu.org Message-ID: <5c9f10051a8e_1c333fa64c805ef89138d@discovery.mail> Subject: [PATCH] factor: check the standard output instead of the standard input Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit User-Agent: Mournmail/0.2.0 Textbringer/0.3.2 Ruby/2.7.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::431 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * 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 [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: ruby-lang.org] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (shugo.maeda[at]gmail.com) 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 30 Mar 2019 04:30:03 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) * 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 From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 30 17:58:59 2019 Received: (at 35046) by debbugs.gnu.org; 30 Mar 2019 21:58:59 +0000 Received: from localhost ([127.0.0.1]:37624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAM0A-0004qH-EG for submit@debbugs.gnu.org; Sat, 30 Mar 2019 17:58:58 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:57060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAM08-0004q8-8j for 35046@debbugs.gnu.org; Sat, 30 Mar 2019 17:58:57 -0400 Received: from localhost.localdomain (unknown [76.21.115.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 659B999DB; Sat, 30 Mar 2019 21:58:54 +0000 (GMT) Subject: Re: bug#35046: [PATCH] factor: check the standard output instead of the standard input To: Shugo Maeda , 35046@debbugs.gnu.org References: <5c9f10051a8e_1c333fa64c805ef89138d@discovery.mail> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <7d85b2c8-3427-9339-9708-ceaedef4f4cc@draigBrady.com> Date: Sat, 30 Mar 2019 14:58:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <5c9f10051a8e_1c333fa64c805ef89138d@discovery.mail> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35046 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 29/03/19 23:43, Shugo Maeda wrote: > * 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) That would impact use cases like: factor | sed -u 's/.*: *//' Do you have a use case like: slow_generator | factor To support both we could line buffer if either stdin/out is a tty. To support the following we'd need a flag: slow_generator | factor | sed -u 's/.*: *//' cheers, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 31 01:14:46 2019 Received: (at 35046) by debbugs.gnu.org; 31 Mar 2019 05:14:46 +0000 Received: from localhost ([127.0.0.1]:37721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hASnt-0006nt-N2 for submit@debbugs.gnu.org; Sun, 31 Mar 2019 01:14:45 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:40958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hASnr-0006ng-Jn for 35046@debbugs.gnu.org; Sun, 31 Mar 2019 01:14:44 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6818F1612BD; Sat, 30 Mar 2019 22:14:37 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id TYT8pJVYD2RB; Sat, 30 Mar 2019 22:14:36 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A15541612C4; Sat, 30 Mar 2019 22:14:36 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id seYpNXVeu2qa; Sat, 30 Mar 2019 22:14:36 -0700 (PDT) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 76702160A6F; Sat, 30 Mar 2019 22:14:36 -0700 (PDT) Subject: Re: bug#35046: [PATCH] factor: check the standard output instead of the standard input To: =?UTF-8?Q?P=c3=a1draig_Brady?= , Shugo Maeda , 35046@debbugs.gnu.org References: <5c9f10051a8e_1c333fa64c805ef89138d@discovery.mail> <7d85b2c8-3427-9339-9708-ceaedef4f4cc@draigBrady.com> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Sat, 30 Mar 2019 22:14:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <7d85b2c8-3427-9339-9708-ceaedef4f4cc@draigBrady.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 35046 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) P=C3=A1draig Brady wrote: >> - line_buffered =3D isatty (STDIN_FILENO); >> + line_buffered =3D isatty (STDOUT_FILENO); >> if (line_buffered) >> lbuf_flush (); >> else if (buffered >=3D FACTOR_PIPE_BUF) > That would impact use cases like: >=20 > factor | sed -u 's/.*: *//' Sure, but the longstanding tradition for almost all GNU utilities is for = stdout=20 to be line-buffered if it is a tty (regardless of whether stdin is a tty)= , and=20 that's how 'factor' behaved until we started fooling with buffering in co= reutils=20 8.24. Shouldn't we simply go back to the longstanding tradition for decid= ing=20 whether to line-buffer stdout? Surely factor's current behavior is simply= a bug=20 introduced in 8.24 and not fixed in 8.26. From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 31 18:53:51 2019 Received: (at 35046-done) by debbugs.gnu.org; 31 Mar 2019 22:53:51 +0000 Received: from localhost ([127.0.0.1]:38614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAjKo-0007AN-SF for submit@debbugs.gnu.org; Sun, 31 Mar 2019 18:53:51 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:41562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hAjKn-0007AE-ET for 35046-done@debbugs.gnu.org; Sun, 31 Mar 2019 18:53:49 -0400 Received: from localhost.localdomain (unknown [76.21.115.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id 6FAACA472; Sun, 31 Mar 2019 23:53:47 +0100 (IST) From: =?UTF-8?Q?P=c3=a1draig_Brady?= Subject: Re: bug#35046: [PATCH] factor: check the standard output instead of the standard input To: Paul Eggert , Shugo Maeda , 35046-done@debbugs.gnu.org References: <5c9f10051a8e_1c333fa64c805ef89138d@discovery.mail> <7d85b2c8-3427-9339-9708-ceaedef4f4cc@draigBrady.com> Message-ID: <67639d78-6c96-9935-be03-f148cadf4508@draigBrady.com> 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 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35046-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.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 From unknown Sat Jun 14 05:23:44 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 29 Apr 2019 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator