From unknown Fri Sep 05 15:36:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27368: Minor concern: Confusing tail warning Resent-From: Charlie Hagedorn Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 14 Jun 2017 23:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 27368 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 27368@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.149748142930182 (code B ref -1); Wed, 14 Jun 2017 23:04:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jun 2017 23:03:49 +0000 Received: from localhost ([127.0.0.1]:48095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLHKH-0007qj-3i for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLHJn-0007pa-1r for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLHJh-0003zE-7E for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:14 -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, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47278) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLHJh-0003zA-3x for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLHJf-0006Nm-Uu for bug-coreutils@gnu.org; Wed, 14 Jun 2017 19:03:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLHJf-0003yh-4f for bug-coreutils@gnu.org; Wed, 14 Jun 2017 19:03:11 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:34031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLHJe-0003yT-UY for bug-coreutils@gnu.org; Wed, 14 Jun 2017 19:03:11 -0400 Received: by mail-wr0-x229.google.com with SMTP id 77so20544187wrb.1 for ; Wed, 14 Jun 2017 16:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7kSCNX+xZ2z2brPenUtNsXqhLgWZ4WcWTsS7anq1lrE=; b=Go1yTaxN8cg+u+Sm1bbhmOl5vG6EjGqF7COr1u5GvLtzl8cdr6TSKdHaDYxKJ92N+6 YMYytVuF65yceuJJGqu51+Gw4tyBboJWTQ8nA2z/GnfzAXe6su301HsowMQYx6wWiEqe HNYXDva/Z+pSTAkMh3H2Zl7sl5YO7n51dVmmGvE/6BzWah9XpeC8Kf0z1lBjPBzbWEkJ 6LfXgM9Ef8ek8MClN0Y1tpvhKl0POTJbkD69APXlw0XnyVax5g9uRJvoClfHpyvQjm3c p/VbUm3s3+xtt66HPHhoD1b16RDP1g3kDu9cA9UJBLKB3eOsu53JW/WUgSaczlLMuzdP sufA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7kSCNX+xZ2z2brPenUtNsXqhLgWZ4WcWTsS7anq1lrE=; b=DMaHWt53ojONnLB79wuDD4XHUpl2ifClri6mOruUgj8fVnlOAU/3lTXu1PCMKmfMJ7 dMw4ijSYBsDeq0e9MDTkOnqHysxsqwdnyQMoatCcoWmOtRnPUCbmHNhFkIPHajJTW9Pt /ECuz8/WTt1NrY2qydFTiuwxckS0n+/E32myp7tSL07u54EeIK1DKVyTmZoIlhVEGwle nJg+rgxiceiFCahu4GiFuQ1D2/bewHDU7gBwupZ9Hv2VzAqzpRnGie1PlXf/t5e5cZg8 mDxYJYVrRUmXIPs/gJ7rng7mD1nmBFqpT2Yhy4QFwySt0CXohcUwGCrzZWdcJnHNwNB3 8ojg== X-Gm-Message-State: AKS2vOzHXD8EJeAx/JhNJqecILw3+JBqfGWvn3O1i2e+S1ocd+BmWyOP nuhilFBYR8+hDqCfYt5sb7rvpMnXeGDmHNA= X-Received: by 10.223.130.77 with SMTP id 71mr1427455wrb.21.1497481387798; Wed, 14 Jun 2017 16:03:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.58.80 with HTTP; Wed, 14 Jun 2017 16:03:07 -0700 (PDT) From: Charlie Hagedorn Date: Wed, 14 Jun 2017 16:03:07 -0700 Message-ID: Content-Type: multipart/alternative; boundary="001a114b38aa2d77bc0551f38e79" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Wed, 14 Jun 2017 19:03:48 -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: -4.0 (----) --001a114b38aa2d77bc0551f38e79 Content-Type: text/plain; charset="UTF-8" Hi! Thank you for maintaining such useful and reliable tools. Today I came across an unexpected warning in tail. The warning is intended to handle this case: [:~]$ tail -f tail: warning: following standard input indefinitely is ineffective which is both important and fun. Today, however, I was surprised to see it appear in this context: [:~]$ tail -f < /dev/ttyUSB0 > data.dat tail: warning: following standard input indefinitely is ineffective The warning was confusing and perhaps inappropriate, as this call actually *does* something, and is very effective at doing what I want; streaming the port's output into data.dat. (Importantly, for reasons I don't yet understand, tail -f /dev/ttyUSB0 > data.dat does not reliably tail the port; it redirects only one line of output instead of a continuous stream). System is Debian Jessie -- coreutils v8.23-4. Thanks! Charlie --001a114b38aa2d77bc0551f38e79 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

Thank you for maintaining such usef= ul and reliable tools.

Today I came across an unex= pected warning in tail. The warning is intended to handle this case:=C2=A0<= /div>

[:~]$ tail -f =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0=C2=A0
tail: warning: following standard input indefinitely is= ineffective=C2=A0

which is both important a= nd fun.

Today, however, I was surprised to see it = appear in this context:

[:~]$ tail -f < /d= ev/ttyUSB0 =C2=A0> data.dat =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
tail: warning: f= ollowing standard input indefinitely is ineffective=C2=A0
<= br>
The warning was confusing and perhaps inappropriate, as this = call actually *does* something, and is very effective at doing what I want;= streaming the port's output into data.dat.

(I= mportantly, for reasons I don't yet understand, tail -f /dev/ttyUSB0 &g= t; data.dat does not reliably tail the port; it redirects only one line of = output instead of a continuous stream).

System is = Debian Jessie -- coreutils v8.23-4.=C2=A0

Thanks!<= /div>

Charlie
--001a114b38aa2d77bc0551f38e79-- From unknown Fri Sep 05 15:36:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27368: Minor concern: Confusing tail warning Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 15 Jun 2017 09:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27368 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Charlie Hagedorn , 27368@debbugs.gnu.org Received: via spool by 27368-submit@debbugs.gnu.org id=B27368.149751965319750 (code B ref 27368); Thu, 15 Jun 2017 09:41:02 +0000 Received: (at 27368) by debbugs.gnu.org; 15 Jun 2017 09:40:53 +0000 Received: from localhost ([127.0.0.1]:48531 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLRGn-00058T-1E for submit@debbugs.gnu.org; Thu, 15 Jun 2017 05:40:53 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:55894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLRGl-00058J-DP for 27368@debbugs.gnu.org; Thu, 15 Jun 2017 05:40:52 -0400 Received: from localhost.localdomain (mobile-166-177-249-211.mycingular.net [166.177.249.211]) (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 3C8A2999D; Thu, 15 Jun 2017 10:40:48 +0100 (IST) References: From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: Date: Thu, 15 Jun 2017 02:40:46 -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=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) 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.0 (/) On 14/06/17 16:03, Charlie Hagedorn wrote: > Hi! > > Thank you for maintaining such useful and reliable tools. > > Today I came across an unexpected warning in tail. The warning is intended > to handle this case: > > [:~]$ tail -f > tail: warning: following standard input indefinitely is ineffective > > which is both important and fun. > > Today, however, I was surprised to see it appear in this context: > > [:~]$ tail -f < /dev/ttyUSB0 > data.dat > tail: warning: following standard input indefinitely is ineffective > > The warning was confusing and perhaps inappropriate, as this call actually > *does* something, and is very effective at doing what I want; streaming the > port's output into data.dat. Right. The above command will go into non inotify blocking mode and will thus work as you expect. Note tail will not output anything until the first time read() returns nothing. The following patch should suppress the warning if we would be using this mode. diff --git a/src/tail.c b/src/tail.c index 3918373..2f9b981 100644 --- a/src/tail.c +++ b/src/tail.c @@ -2365,12 +2365,22 @@ main (int argc, char **argv) if (found_hyphen && follow_mode == Follow_name) die (EXIT_FAILURE, 0, _("cannot follow %s by name"), quoteaf ("-")); - /* When following forever, warn if any file is '-'. + /* When following forever, and not using simple blocking, warn if + any file is '-' as the stats() used to check for input are ineffective. This is only a warning, since tail's output (before a failing seek, and that from any non-stdin files) might still be useful. */ - if (forever && found_hyphen && isatty (STDIN_FILENO)) - error (0, 0, _("warning: following standard input" - " indefinitely is ineffective")); + if (forever && found_hyphen) + { + struct stat in_stat; + bool blocking_stdin; + blocking_stdin = (pid == 0 && follow_mode == Follow_descriptor + && n_files == 1 && ! fstat (STDIN_FILENO, &in_stat) + && ! S_ISREG (in_stat.st_mode)); + + if (! blocking_stdin && isatty (STDIN_FILENO)) + error (0, 0, _("warning: following standard input" + " indefinitely is ineffective")); + } } > (Importantly, for reasons I don't yet understand, tail -f /dev/ttyUSB0 > > data.dat does not reliably tail the port; it redirects only one line of > output instead of a continuous stream). That looks like another case where we should be disabling inotify. I.E. you can see this waits forever for inotify events if you hit ctrl-d a few times: strace tail -f /dev/tty Ah yes that was discussed at http://bugs.gnu.org/21265 I suppose we should improve things here with a couple of patches. 1. Disable inotify if any non regular files (except fifo/pipe) (the kernel should really disallow this, but best handle I think) 2. Generalise the warning in the above patch to be: if (n_files > 1 && any_device_or_tty) printf ("warning: following a stdin/device in combination with other inputs is ineffective") cheers, Pádraig From unknown Fri Sep 05 15:36:54 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Charlie Hagedorn Subject: bug#27368: closed (Re: bug#27368: Minor concern: Confusing tail warning) Message-ID: References: <7fae0df8-0cc5-7d90-a273-03b4a1758527@draigBrady.com> X-Gnu-PR-Message: they-closed 27368 X-Gnu-PR-Package: coreutils Reply-To: 27368@debbugs.gnu.org Date: Sat, 17 Jun 2017 08:33:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1497688382-9110-1" This is a multi-part message in MIME format... ------------=_1497688382-9110-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #27368: Minor concern: Confusing tail warning which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 27368@debbugs.gnu.org. --=20 27368: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D27368 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1497688382-9110-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 27368-done) by debbugs.gnu.org; 17 Jun 2017 08:32:58 +0000 Received: from localhost ([127.0.0.1]:52053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dM99z-0002MW-SO for submit@debbugs.gnu.org; Sat, 17 Jun 2017 04:32:58 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:52150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dM99u-0002MK-Qc for 27368-done@debbugs.gnu.org; Sat, 17 Jun 2017 04:32:46 -0400 Received: from localhost.localdomain (mobile-166-170-38-143.mycingular.net [166.170.38.143]) (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 5E3384A6C; Sat, 17 Jun 2017 09:32:40 +0100 (IST) Subject: Re: bug#27368: Minor concern: Confusing tail warning To: Charlie Hagedorn , 27368-done@debbugs.gnu.org References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <7fae0df8-0cc5-7d90-a273-03b4a1758527@draigBrady.com> Date: Sat, 17 Jun 2017 01:32:34 -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: multipart/mixed; boundary="------------375E50308ED93DE4E9DD9D4D" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 27368-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: 0.0 (/) This is a multi-part message in MIME format. --------------375E50308ED93DE4E9DD9D4D Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 15/06/17 02:40, Pádraig Brady wrote: > On 14/06/17 16:03, Charlie Hagedorn wrote: >> Hi! >> >> Thank you for maintaining such useful and reliable tools. >> >> Today I came across an unexpected warning in tail. The warning is intended >> to handle this case: >> >> [:~]$ tail -f >> tail: warning: following standard input indefinitely is ineffective >> >> which is both important and fun. >> >> Today, however, I was surprised to see it appear in this context: >> >> [:~]$ tail -f < /dev/ttyUSB0 > data.dat >> tail: warning: following standard input indefinitely is ineffective >> >> The warning was confusing and perhaps inappropriate, as this call actually >> *does* something, and is very effective at doing what I want; streaming the >> port's output into data.dat. > > Right. The above command will go into non inotify blocking mode > and will thus work as you expect. Note tail will not output > anything until the first time read() returns nothing. > The following patch should suppress the warning if we would be using this mode. > > diff --git a/src/tail.c b/src/tail.c > index 3918373..2f9b981 100644 > --- a/src/tail.c > +++ b/src/tail.c > @@ -2365,12 +2365,22 @@ main (int argc, char **argv) > if (found_hyphen && follow_mode == Follow_name) > die (EXIT_FAILURE, 0, _("cannot follow %s by name"), quoteaf ("-")); > > - /* When following forever, warn if any file is '-'. > + /* When following forever, and not using simple blocking, warn if > + any file is '-' as the stats() used to check for input are ineffective. > This is only a warning, since tail's output (before a failing seek, > and that from any non-stdin files) might still be useful. */ > - if (forever && found_hyphen && isatty (STDIN_FILENO)) > - error (0, 0, _("warning: following standard input" > - " indefinitely is ineffective")); > + if (forever && found_hyphen) > + { > + struct stat in_stat; > + bool blocking_stdin; > + blocking_stdin = (pid == 0 && follow_mode == Follow_descriptor > + && n_files == 1 && ! fstat (STDIN_FILENO, &in_stat) > + && ! S_ISREG (in_stat.st_mode)); > + > + if (! blocking_stdin && isatty (STDIN_FILENO)) > + error (0, 0, _("warning: following standard input" > + " indefinitely is ineffective")); > + } > } > >> (Importantly, for reasons I don't yet understand, tail -f /dev/ttyUSB0 > >> data.dat does not reliably tail the port; it redirects only one line of >> output instead of a continuous stream). > > That looks like another case where we should be disabling inotify. > I.E. you can see this waits forever for inotify events if you hit ctrl-d a few times: > > strace tail -f /dev/tty > > Ah yes that was discussed at http://bugs.gnu.org/21265 > I suppose we should improve things here with a couple of patches. > > 1. Disable inotify if any non regular files (except fifo/pipe) > (the kernel should really disallow this, but best handle I think) > > 2. Generalise the warning in the above patch to be: > if (n_files > 1 && any_device_or_tty) > printf ("warning: following a stdin/device in combination with other inputs is ineffective") Two proposed patches for this are attached. cheers, Pádraig. --------------375E50308ED93DE4E9DD9D4D Content-Type: text/x-patch; name="tail-pipe.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tail-pipe.diff" >From 2a49ab8eae92859c02c0db7a14231b391287c5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 15 Jun 2017 02:41:14 -0700 Subject: [PATCH 1/2] tail: with -f don't warn if doing a blocking read of a tty * src/tail.c: (main): Only issue the warning about -f being ineffective when we're not going into simple blocking mode. * tests/tail-2/follow-stdin.sh: Ensure the warning is output correctly. Fixes http://bugs.gnu.org/27368 --- NEWS | 4 ++++ src/tail.c | 18 ++++++++++++++---- tests/tail-2/follow-stdin.sh | 21 ++++++++++++++++++++- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index d2672e8..22805c8 100644 --- a/NEWS +++ b/NEWS @@ -56,6 +56,10 @@ GNU coreutils NEWS -*- outline -*- tail -f will now exit immediately if the output is piped and the reader of the pipe terminates. + tail -f will no longer erroneously warn about being ineffective + when following a single tty, as the simple blocking loop used + is effective in this case. + * Noteworthy changes in release 8.27 (2017-03-08) [stable] diff --git a/src/tail.c b/src/tail.c index 3918373..2f9b981 100644 --- a/src/tail.c +++ b/src/tail.c @@ -2365,12 +2365,22 @@ main (int argc, char **argv) if (found_hyphen && follow_mode == Follow_name) die (EXIT_FAILURE, 0, _("cannot follow %s by name"), quoteaf ("-")); - /* When following forever, warn if any file is '-'. + /* When following forever, and not using simple blocking, warn if + any file is '-' as the stats() used to check for input are ineffective. This is only a warning, since tail's output (before a failing seek, and that from any non-stdin files) might still be useful. */ - if (forever && found_hyphen && isatty (STDIN_FILENO)) - error (0, 0, _("warning: following standard input" - " indefinitely is ineffective")); + if (forever && found_hyphen) + { + struct stat in_stat; + bool blocking_stdin; + blocking_stdin = (pid == 0 && follow_mode == Follow_descriptor + && n_files == 1 && ! fstat (STDIN_FILENO, &in_stat) + && ! S_ISREG (in_stat.st_mode)); + + if (! blocking_stdin && isatty (STDIN_FILENO)) + error (0, 0, _("warning: following standard input" + " indefinitely is ineffective")); + } } /* Don't read anything if we'll never output anything. */ diff --git a/tests/tail-2/follow-stdin.sh b/tests/tail-2/follow-stdin.sh index 7e82835..c922ea1 100755 --- a/tests/tail-2/follow-stdin.sh +++ b/tests/tail-2/follow-stdin.sh @@ -1,5 +1,5 @@ #!/bin/sh -# tail -f - would fail with the initial inotify implementation +# Test tail -f - # Copyright (C) 2009-2017 Free Software Foundation, Inc. @@ -19,6 +19,9 @@ . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src print_ver_ tail +################# +# tail -f - would fail with the initial inotify implementation + check_tail_output() { local delay="$1" @@ -51,6 +54,7 @@ for mode in '' '---disable-inotify'; do done +################# # Before coreutils-8.26 this would induce an UMR under UBSAN returns_ 1 timeout 10 tail -f - <&- 2>errt || fail=1 cat <<\EOF >exp || framework_failure_ @@ -63,4 +67,19 @@ sed 's/\(tail:.*\):.*/\1/' errt > err || framework_failure_ compare exp err || fail=1 +################# +# Before coreutils-8.28 this would erroneously issue a warning +if tty -s err || fail=1 + compare /dev/null err || fail=1 + done + + tail -f - /dev/null out & pid=$! + # Wait up to 12.7s for output to appear: + tail_re='ineffective' retry_delay_ check_tail_output .1 7 || + { cat out; fail=1; } + cleanup_ +fi + Exit $fail -- 2.9.3 >From 9066e57d421935747a4e99460478ec71b3191452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Fri, 16 Jun 2017 23:50:47 -0700 Subject: [PATCH 2/2] tail: only use inotify with regular files * src/tail.c (any_non_regular): A new function to check passed files. (main): Use the above to skip inotify if any non regular files passed like /dev/tty or /dev/ttyUSB0 etc. * tests/tail-2/inotify-only-regular.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/21265 and http://bugs.gnu.org/27368 --- NEWS | 4 ++++ src/tail.c | 17 +++++++++++++++++ tests/local.mk | 1 + tests/tail-2/inotify-only-regular.sh | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100755 tests/tail-2/inotify-only-regular.sh diff --git a/NEWS b/NEWS index 22805c8..86e6bc7 100644 --- a/NEWS +++ b/NEWS @@ -36,6 +36,10 @@ GNU coreutils NEWS -*- outline -*- or ignored until future events on the monitored files. [bug introduced with inotify support added in coreutils-7.5] + tail -f /dev/tty is now supported by not using inotify when any + non regular files are specified, as inotify is ineffective with these. + [bug introduced with inotify support added in coreutils-7.5] + uptime no longer outputs the AM/PM component of the current time, as that's inconsistent with the 24 hour time format used. [bug introduced in coreutils-7.0] diff --git a/src/tail.c b/src/tail.c index 2f9b981..b8be1d2 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1339,6 +1339,22 @@ any_symlinks (const struct File_spec *f, size_t n_files) return false; } +/* Return true if any of the N_FILES files in F is not + a regular file. This is used to avoid adding inotify + watches on a device file for example, which inotify + will accept, but not give any events for. */ + +static bool +any_non_regular (const struct File_spec *f, size_t n_files) +{ + size_t i; + + for (i = 0; i < n_files; i++) + if (0 <= f[i].fd && ! S_ISREG (f[i].mode)) + return true; + return false; +} + /* Return true if any of the N_FILES files in F represents stdin and is tailable. */ @@ -2457,6 +2473,7 @@ main (int argc, char **argv) || any_remote_file (F, n_files) || ! any_non_remote_file (F, n_files) || any_symlinks (F, n_files) + || any_non_regular (F, n_files) || (!ok && follow_mode == Follow_descriptor))) disable_inotify = true; diff --git a/tests/local.mk b/tests/local.mk index fdf3edf..6112e88 100644 --- a/tests/local.mk +++ b/tests/local.mk @@ -177,6 +177,7 @@ all_tests = \ tests/tail-2/inotify-rotate.sh \ tests/tail-2/inotify-rotate-resources.sh \ tests/tail-2/inotify-dir-recreate.sh \ + tests/tail-2/inotify-only-regular.sh \ tests/chmod/no-x.sh \ tests/chgrp/basic.sh \ tests/rm/dangling-symlink.sh \ diff --git a/tests/tail-2/inotify-only-regular.sh b/tests/tail-2/inotify-only-regular.sh new file mode 100755 index 0000000..4d106fb --- /dev/null +++ b/tests/tail-2/inotify-only-regular.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# ensure that tail -f only uses inotify for regular files + +# Copyright (C) 2017 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src +print_ver_ tail + +grep '^#define HAVE_INOTIFY 1' "$CONFIG_HEADER" >/dev/null \ + || skip_ 'inotify support required' + +require_strace_ 'inotify_add_watch' + +returns_ 124 timeout .1 strace -e inotify_add_watch -o strace.out \ + tail -f /dev/null || fail=1 + +grep 'inotify' strace.out && fail=1 + +Exit $fail -- 2.9.3 --------------375E50308ED93DE4E9DD9D4D-- ------------=_1497688382-9110-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Jun 2017 23:03:49 +0000 Received: from localhost ([127.0.0.1]:48095 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLHKH-0007qj-3i for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLHJn-0007pa-1r for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLHJh-0003zE-7E for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:14 -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, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:47278) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dLHJh-0003zA-3x for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:03:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLHJf-0006Nm-Uu for bug-coreutils@gnu.org; Wed, 14 Jun 2017 19:03:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLHJf-0003yh-4f for bug-coreutils@gnu.org; Wed, 14 Jun 2017 19:03:11 -0400 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:34031) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLHJe-0003yT-UY for bug-coreutils@gnu.org; Wed, 14 Jun 2017 19:03:11 -0400 Received: by mail-wr0-x229.google.com with SMTP id 77so20544187wrb.1 for ; Wed, 14 Jun 2017 16:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7kSCNX+xZ2z2brPenUtNsXqhLgWZ4WcWTsS7anq1lrE=; b=Go1yTaxN8cg+u+Sm1bbhmOl5vG6EjGqF7COr1u5GvLtzl8cdr6TSKdHaDYxKJ92N+6 YMYytVuF65yceuJJGqu51+Gw4tyBboJWTQ8nA2z/GnfzAXe6su301HsowMQYx6wWiEqe HNYXDva/Z+pSTAkMh3H2Zl7sl5YO7n51dVmmGvE/6BzWah9XpeC8Kf0z1lBjPBzbWEkJ 6LfXgM9Ef8ek8MClN0Y1tpvhKl0POTJbkD69APXlw0XnyVax5g9uRJvoClfHpyvQjm3c p/VbUm3s3+xtt66HPHhoD1b16RDP1g3kDu9cA9UJBLKB3eOsu53JW/WUgSaczlLMuzdP sufA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7kSCNX+xZ2z2brPenUtNsXqhLgWZ4WcWTsS7anq1lrE=; b=DMaHWt53ojONnLB79wuDD4XHUpl2ifClri6mOruUgj8fVnlOAU/3lTXu1PCMKmfMJ7 dMw4ijSYBsDeq0e9MDTkOnqHysxsqwdnyQMoatCcoWmOtRnPUCbmHNhFkIPHajJTW9Pt /ECuz8/WTt1NrY2qydFTiuwxckS0n+/E32myp7tSL07u54EeIK1DKVyTmZoIlhVEGwle nJg+rgxiceiFCahu4GiFuQ1D2/bewHDU7gBwupZ9Hv2VzAqzpRnGie1PlXf/t5e5cZg8 mDxYJYVrRUmXIPs/gJ7rng7mD1nmBFqpT2Yhy4QFwySt0CXohcUwGCrzZWdcJnHNwNB3 8ojg== X-Gm-Message-State: AKS2vOzHXD8EJeAx/JhNJqecILw3+JBqfGWvn3O1i2e+S1ocd+BmWyOP nuhilFBYR8+hDqCfYt5sb7rvpMnXeGDmHNA= X-Received: by 10.223.130.77 with SMTP id 71mr1427455wrb.21.1497481387798; Wed, 14 Jun 2017 16:03:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.58.80 with HTTP; Wed, 14 Jun 2017 16:03:07 -0700 (PDT) From: Charlie Hagedorn Date: Wed, 14 Jun 2017 16:03:07 -0700 Message-ID: Subject: Minor concern: Confusing tail warning To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary="001a114b38aa2d77bc0551f38e79" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 14 Jun 2017 19:03:48 -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: -4.0 (----) --001a114b38aa2d77bc0551f38e79 Content-Type: text/plain; charset="UTF-8" Hi! Thank you for maintaining such useful and reliable tools. Today I came across an unexpected warning in tail. The warning is intended to handle this case: [:~]$ tail -f tail: warning: following standard input indefinitely is ineffective which is both important and fun. Today, however, I was surprised to see it appear in this context: [:~]$ tail -f < /dev/ttyUSB0 > data.dat tail: warning: following standard input indefinitely is ineffective The warning was confusing and perhaps inappropriate, as this call actually *does* something, and is very effective at doing what I want; streaming the port's output into data.dat. (Importantly, for reasons I don't yet understand, tail -f /dev/ttyUSB0 > data.dat does not reliably tail the port; it redirects only one line of output instead of a continuous stream). System is Debian Jessie -- coreutils v8.23-4. Thanks! Charlie --001a114b38aa2d77bc0551f38e79 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi!

Thank you for maintaining such usef= ul and reliable tools.

Today I came across an unex= pected warning in tail. The warning is intended to handle this case:=C2=A0<= /div>

[:~]$ tail -f =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0=C2=A0
tail: warning: following standard input indefinitely is= ineffective=C2=A0

which is both important a= nd fun.

Today, however, I was surprised to see it = appear in this context:

[:~]$ tail -f < /d= ev/ttyUSB0 =C2=A0> data.dat =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
tail: warning: f= ollowing standard input indefinitely is ineffective=C2=A0
<= br>
The warning was confusing and perhaps inappropriate, as this = call actually *does* something, and is very effective at doing what I want;= streaming the port's output into data.dat.

(I= mportantly, for reasons I don't yet understand, tail -f /dev/ttyUSB0 &g= t; data.dat does not reliably tail the port; it redirects only one line of = output instead of a continuous stream).

System is = Debian Jessie -- coreutils v8.23-4.=C2=A0

Thanks!<= /div>

Charlie
--001a114b38aa2d77bc0551f38e79-- ------------=_1497688382-9110-1-- From unknown Fri Sep 05 15:36:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27368: Minor concern: Confusing tail warning Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 17 Jun 2017 14:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27368 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 27368@debbugs.gnu.org, =?UTF-8?Q?P=C3=A1draig?= Brady , charlie.hagedorn@gmail.com Cc: 27368-done@debbugs.gnu.org Received: via spool by 27368-submit@debbugs.gnu.org id=B27368.149771017417120 (code B ref 27368); Sat, 17 Jun 2017 14:37:01 +0000 Received: (at 27368) by debbugs.gnu.org; 17 Jun 2017 14:36:14 +0000 Received: from localhost ([127.0.0.1]:53510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMEph-0004S3-RP for submit@debbugs.gnu.org; Sat, 17 Jun 2017 10:36:14 -0400 Received: from mail-vk0-f54.google.com ([209.85.213.54]:33424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMEpg-0004Ro-Fu; Sat, 17 Jun 2017 10:36:12 -0400 Received: by mail-vk0-f54.google.com with SMTP id p62so34351941vkp.0; Sat, 17 Jun 2017 07:36:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=8dGkkpEMl2v1lppI4ycY4Kjh2TFB73NTMe/DmHHYrq4=; b=rR+cUeatoi8W6+DZpJuJlpXkff9j0ycbSTLRYoj5B3q58Aw+VpEmGOO5UJ7chtus7s KqYjkDBu7uIzgZE+fP7fqOeHAIS+3k37Bvola4zIUqioUvlpbh80t3m6Jlq+ohmIkYzz DK+l5pCrISFWiUSYqXvGmpsl8ab3RFCACZQM/SuTPPfG5nGJZEqiYE98s+1hnmq41b0V S3Ya+3loOvRxmWLi+zJGEGPmIjxZsahH97xa9RjccB85g3uRp1E3ylQzDkzrSY+VT6mG iYFJxxNBHXnnH3NUnnZM6OqUvzfoGvhwOKJDwO5KmU3izdvq4q/S1sk8CAdIa8eZBtYg zNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=8dGkkpEMl2v1lppI4ycY4Kjh2TFB73NTMe/DmHHYrq4=; b=I+tEbQNUoWmV23nV0yfdV3NRh3ebL4Bc94ixXYrLXZj1fQPrEdi1wlYVaWQ+w9vn/M pc8qTIBPpswD3uGn67B9TjxgzOSxjlUUE5qmbRcegHtSey/mSO48pWQkqvZicASc5g8R bZNmTwiYX6m+5fPVB367zOnyt0kpMRctlUD/c5qWuHZk1tbXxCmYqNq5P+Sr9gsxezYI HgbOkOKPQOk6+ZWeZgXl6FrwM1tzRWYp1umjVLfSfN3UUmIC+OqElPtiiaQ4Pfa++kMg VHEv3mSiCtJ7y6ZF0F8WBKOpLA9ZH842+Ev5Opf9bPUlamtRxwOle+vCqc0TlKh/QiPT JsZw== X-Gm-Message-State: AKS2vOzjGmgL4AqA1wFA0/RHqOiYm+aWcv/ovYRrXRUZ11kUXPDLodvN TbSVt9dtB/fB2IQHA3JfXVZOfuevAu2L X-Received: by 10.31.52.70 with SMTP id b67mr8663717vka.109.1497710165991; Sat, 17 Jun 2017 07:36:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.70.83 with HTTP; Sat, 17 Jun 2017 07:35:45 -0700 (PDT) In-Reply-To: <7fae0df8-0cc5-7d90-a273-03b4a1758527@draigBrady.com> References: <7fae0df8-0cc5-7d90-a273-03b4a1758527@draigBrady.com> From: Jim Meyering Date: Sat, 17 Jun 2017 07:35:45 -0700 X-Google-Sender-Auth: Boe-QAq3uCMAz4GoGW3T4pB_NVE Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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.0 (/) On Sat, Jun 17, 2017 at 1:32 AM, P=C3=A1draig Brady wrot= e: ... > Two proposed patches for this are attached. Nice fixes. Thank you! In the NEWS addition: tail -f will now exit immediately if the output is piped and the reader of the pipe terminates. + tail -f will no longer erroneously warn about being ineffective + when following a single tty, as the simple blocking loop used + is effective in this case. Please don't use "will" in these blurbs. I.e., use the present tense instead. Referencing the future makes sense only now, prior to the release. tail -f now exits immediately when the output is piped and the reader of the pipe terminates. tail -f no longer erroneously warns about being ineffective when following a single tty, as the simple blocking loop used is effective in this case. tail -f /dev/tty is now supported by avoiding inotify when any non regular file is specified, as inotify is ineffective with these. [bug introduced with inotify support added in coreutils-7.5] ---------------------- In this new function, please move the declaration of "i" into the for-loop: +static bool +any_non_regular (const struct File_spec *f, size_t n_files) +{ + size_t i; + + for (i =3D 0; i < n_files; i++) From unknown Fri Sep 05 15:36:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27368: Minor concern: Confusing tail warning Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 17 Jun 2017 21:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27368 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 27368@debbugs.gnu.org Received: via spool by 27368-submit@debbugs.gnu.org id=B27368.149773503730329 (code B ref 27368); Sat, 17 Jun 2017 21:31:01 +0000 Received: (at 27368) by debbugs.gnu.org; 17 Jun 2017 21:30:37 +0000 Received: from localhost ([127.0.0.1]:53725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMLIj-0007t7-Ih for submit@debbugs.gnu.org; Sat, 17 Jun 2017 17:30:37 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:37084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMLIh-0007sy-T0 for 27368@debbugs.gnu.org; Sat, 17 Jun 2017 17:30:36 -0400 Received: from localhost.localdomain (mobile-166-170-38-143.mycingular.net [166.170.38.143]) (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 E0FA7A61B for <27368@debbugs.gnu.org>; Sat, 17 Jun 2017 22:30:33 +0100 (IST) References: <7fae0df8-0cc5-7d90-a273-03b4a1758527@draigBrady.com> From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: <315a4ebf-5d47-08ba-7f38-055ef329aaa2@draigBrady.com> Date: Sat, 17 Jun 2017 14:30:29 -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=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) 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.0 (/) On 17/06/17 07:35, Jim Meyering wrote: > On Sat, Jun 17, 2017 at 1:32 AM, Pádraig Brady wrote: > ... >> Two proposed patches for this are attached. > > Nice fixes. Thank you! > > In the NEWS addition: > > tail -f will now exit immediately if the output is piped > and the reader of the pipe terminates. > > + tail -f will no longer erroneously warn about being ineffective > + when following a single tty, as the simple blocking loop used > + is effective in this case. > Please don't use "will" in [NEWS]. > I.e., use the present tense instead. Referencing the future makes > sense only now, prior to the release. > > ---------------------- > In this new function, please move the declaration of "i" into the for-loop: > > +static bool > +any_non_regular (const struct File_spec *f, size_t n_files) > +{ > + size_t i; > + > + for (i = 0; i < n_files; i++) > Cool. Thanks for the review From unknown Fri Sep 05 15:36:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27368: Minor concern: Confusing tail warning Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 17 Jun 2017 22:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27368 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 27368@debbugs.gnu.org Received: via spool by 27368-submit@debbugs.gnu.org id=B27368.149774023419486 (code B ref 27368); Sat, 17 Jun 2017 22:58:02 +0000 Received: (at 27368) by debbugs.gnu.org; 17 Jun 2017 22:57:14 +0000 Received: from localhost ([127.0.0.1]:53790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMMeY-00054E-Ge for submit@debbugs.gnu.org; Sat, 17 Jun 2017 18:57:14 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:37286) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMMeV-000544-PY for 27368@debbugs.gnu.org; Sat, 17 Jun 2017 18:57:12 -0400 Received: from localhost.localdomain (mobile-166-170-38-143.mycingular.net [166.170.38.143]) (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 B6D714B19 for <27368@debbugs.gnu.org>; Sat, 17 Jun 2017 23:57:05 +0100 (IST) References: <7fae0df8-0cc5-7d90-a273-03b4a1758527@draigBrady.com> <315a4ebf-5d47-08ba-7f38-055ef329aaa2@draigBrady.com> From: =?UTF-8?Q?P=C3=A1draig?= Brady Message-ID: <97daf08b-8f8b-abc0-bbf5-63a00a567fe2@draigBrady.com> Date: Sat, 17 Jun 2017 15:57:02 -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: <315a4ebf-5d47-08ba-7f38-055ef329aaa2@draigBrady.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) 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.0 (/) On 17/06/17 14:30, Pádraig Brady wrote: > On 17/06/17 07:35, Jim Meyering wrote: >> In this new function, please move the declaration of "i" into the for-loop: >> >> +static bool >> +any_non_regular (const struct File_spec *f, size_t n_files) >> +{ >> + size_t i; >> + >> + for (i = 0; i < n_files; i++) I did that in about 100 instances at: http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=1379bdc cheers, Pádraig From unknown Fri Sep 05 15:36:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#27368: Minor concern: Confusing tail warning Resent-From: Jim Meyering Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sat, 17 Jun 2017 23:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27368 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 27368@debbugs.gnu.org Received: via spool by 27368-submit@debbugs.gnu.org id=B27368.14977432725560 (code B ref 27368); Sat, 17 Jun 2017 23:48:01 +0000 Received: (at 27368) by debbugs.gnu.org; 17 Jun 2017 23:47:52 +0000 Received: from localhost ([127.0.0.1]:53829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMNRY-0001Rc-M0 for submit@debbugs.gnu.org; Sat, 17 Jun 2017 19:47:52 -0400 Received: from mail-ua0-f182.google.com ([209.85.217.182]:35894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMNRX-0001RP-Dd for 27368@debbugs.gnu.org; Sat, 17 Jun 2017 19:47:51 -0400 Received: by mail-ua0-f182.google.com with SMTP id g40so42410498uaa.3 for <27368@debbugs.gnu.org>; Sat, 17 Jun 2017 16:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=+9HdSaYqK990KvxxhcySTFvKdxKwgcgfobb0ogWxSkw=; b=M5lEMqz9gzzH/5NfeU7YMxNNnbooyJ/yDX3jmQkyGKdT+JnSROBZxEca+RshxN9HYv hHNnU7AhtWTwUKllhJUhMAYkxAjeuoVgCSMy7cXsljG6VUbLVsiDDi0PGNHAAhfQw5VT VMksEyxSBcFiUOpl2meQWmfXUknzljCbb8sFelOtsOABqvbt69gHbyNTmvH1TXa+SSGE 1jFcUJzswHLsHGgnx6Gwr7T/uApVlUWTLb4N7vMKVf/WnSTIn2WVOUzi3/wQwcaPzuxL 8Sb4KB1mqvETpo7pqb/EHSPPvOfD7IuauBn/HLsZq7P/to9h2OIlfdwaKOYIpGa3lGZq YAAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=+9HdSaYqK990KvxxhcySTFvKdxKwgcgfobb0ogWxSkw=; b=I30JEmy0kiYFoVqz7SlFRFKLa3v3T7JZ7MQcGYcYHQkWubIfLcadiK3YyJfcB/CXca UpZ2k9lOy1IbpIeeDCZ7JPODa3+QgqAVnxxw496j42ovKw/IC3uqSwN03xRs7K3x4UgD jrNfLq8e9wdIPDel9zo4ouNbpZETC7uCbiN+XAoUAAElj/CbLNeP/BdEpz0j42dxgG49 m9q6mzXaFygAICEDM/viO5YRs+0Yo9xku5Kcd3k3pjakrS15p+Z/SQg01T3cnsngBMze w3UcVHrN4dAMvh1iCjNEvn24oeFHmspC1wp3PIIo4qRCcMCcbBXyYDudw2hR4fhGp5Yy 6eUg== X-Gm-Message-State: AKS2vOyMwXdgWF6HQ4INn58b9mXD3zq7jcYuZ6CCMka23BekkUcpC33K 4b9zZRxQjiDPPEKCHE1XeprzX9oIiQ== X-Received: by 10.176.90.211 with SMTP id x19mr10841733uae.129.1497743265741; Sat, 17 Jun 2017 16:47:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.70.83 with HTTP; Sat, 17 Jun 2017 16:47:24 -0700 (PDT) In-Reply-To: <97daf08b-8f8b-abc0-bbf5-63a00a567fe2@draigBrady.com> References: <7fae0df8-0cc5-7d90-a273-03b4a1758527@draigBrady.com> <315a4ebf-5d47-08ba-7f38-055ef329aaa2@draigBrady.com> <97daf08b-8f8b-abc0-bbf5-63a00a567fe2@draigBrady.com> From: Jim Meyering Date: Sat, 17 Jun 2017 16:47:24 -0700 X-Google-Sender-Auth: ZOKtaaRhVG6_NPYD1Hzxi-IOH0U Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) 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.0 (/) On Sat, Jun 17, 2017 at 3:57 PM, P=C3=A1draig Brady wrot= e: > On 17/06/17 14:30, P=C3=A1draig Brady wrote: >> On 17/06/17 07:35, Jim Meyering wrote: >>> In this new function, please move the declaration of "i" into the for-l= oop: >>> >>> +static bool >>> +any_non_regular (const struct File_spec *f, size_t n_files) >>> +{ >>> + size_t i; >>> + >>> + for (i =3D 0; i < n_files; i++) > > I did that in about 100 instances at: > http://git.sv.gnu.org/gitweb/?p=3Dcoreutils.git;a=3Dcommitdiff;h=3D1379bd= c Nice! Thank you.