From unknown Sat Aug 09 19:20:51 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8544 <8544@debbugs.gnu.org> To: bug#8544 <8544@debbugs.gnu.org> Subject: Status: tail bug - starting in 7.5 "tail --follow=name" behaves like "tail --follow=name --retry" Reply-To: bug#8544 <8544@debbugs.gnu.org> Date: Sun, 10 Aug 2025 02:20:51 +0000 retitle 8544 tail bug - starting in 7.5 "tail --follow=3Dname" behaves like= "tail --follow=3Dname --retry" reassign 8544 coreutils submitter 8544 Jim Meyering severity 8544 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 24 17:23:04 2011 Received: (at submit) by debbugs.gnu.org; 24 Apr 2011 21:23:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QE6lj-0007eE-6J for submit@debbugs.gnu.org; Sun, 24 Apr 2011 17:23:04 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QE6lg-0007de-H2 for submit@debbugs.gnu.org; Sun, 24 Apr 2011 17:23:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QE6la-0004Lw-CD for submit@debbugs.gnu.org; Sun, 24 Apr 2011 17:22:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:39755) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QE6la-0004Ls-Ah for submit@debbugs.gnu.org; Sun, 24 Apr 2011 17:22:54 -0400 Received: from eggs.gnu.org ([140.186.70.92]:53627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QE6lY-0007mu-VS for bug-coreutils@gnu.org; Sun, 24 Apr 2011 17:22:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QE6lX-0004La-Ah for bug-coreutils@gnu.org; Sun, 24 Apr 2011 17:22:52 -0400 Received: from mx.meyering.net ([82.230.74.64]:49737) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QE6lW-0004LU-UY for bug-coreutils@gnu.org; Sun, 24 Apr 2011 17:22:51 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id DC33D60100; Sun, 24 Apr 2011 23:22:46 +0200 (CEST) From: Jim Meyering To: Tim Underwood Subject: Re: tail bug - starting in 7.5 "tail --follow=name" behaves like "tail --follow=name --retry" In-Reply-To: (Tim Underwood's message of "Thu, 21 Apr 2011 12:43:40 -0700") References: Date: Sun, 24 Apr 2011 23:22:46 +0200 Message-ID: <87oc3vibtl.fsf@rho.meyering.net> Lines: 161 MIME-Version: 1.0 Content-Type: text/plain 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 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: submit Cc: bug-coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.0 (------) Tim Underwood wrote: > Going from Ubuntu 10.04 (coreutils 7.4) to Ubuntu 10.10 (coreutils 8.5) I > noticed that "tail --follow=name" started behaving like "tail --follow=name > --retry". It looks like the issue started in 7.5 and still exists in 8.9. > > To reproduce: > > tail --follow=name this_file_does_not_exist > > The expected behavior is: > > $ ./coreutils-7.4/src/tail --follow=name this_file_does_not_exist > ./coreutils-7.4/src/tail: cannot open `this_file_does_not_exist' for > reading: No such file or directory > ./coreutils-7.4/src/tail: no files remaining > > The wrong behavior is: > > $ ./coreutils-7.5/src/tail --follow=name this_file_does_not_exist > ./coreutils-7.5/src/tail: cannot open `this_file_does_not_exist' for > reading: No such file or directory > is what --retry is for> > > Here's the wrong behavior on 8.9: > > $ ./coreutils-8.9/src/tail --follow=name this_file_does_not_exist > ./coreutils-8.9/src/tail: cannot open `this_file_does_not_exist' for > reading: No such file or directory > > > My specific use case is to tail a log file until it gets deleted at which > point tail should exit allowing my script to continue. Thanks again. Here's the fix I expect to use: >From 79a476abb35a69f409e2848019c8ebc24cc687cf Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 24 Apr 2011 23:20:01 +0200 Subject: [PATCH] tail --follow=name no longer implies --retry * src/tail.c (tail_forever_inotify): Just as without inotify, tail --follow=name now terminates when the last tailed-by-name file is unlinked or moved aside. This bug was introduced on 2009-06-15 via commit ae494d4b, "tail: use inotify if it is available". Reported by Tim Underwood in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286 * NEWS (Bug fixes): Mention this. * tests/tail-2/follow-name: Test for this. * tests/Makefile.am (TESTS): Add it. --- NEWS | 5 +++++ THANKS.in | 1 + src/tail.c | 10 ++++++++++ tests/Makefile.am | 1 + tests/tail-2/follow-name | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 49 insertions(+), 0 deletions(-) create mode 100755 tests/tail-2/follow-name diff --git a/NEWS b/NEWS index 7bc2ef3..3307e71 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ GNU coreutils NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** Bug fixes + + tail's --follow=name option no longer implies --retry on systems + with inotify support. [bug introduced in coreutils-7.5] + ** Changes in behavior cp's extent-based (FIEMAP) copying code is more reliable in the face diff --git a/THANKS.in b/THANKS.in index 342a52c..d1ca380 100644 --- a/THANKS.in +++ b/THANKS.in @@ -560,6 +560,7 @@ Tim J. Robbins tjr@FreeBSD.org Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu Tim Ryan Tim_Ryan@bnz.co.nz Tim Smithers mouse@dmouse.com.au +Tim Underwood timunderwood@gmail.com Tim Waugh twaugh@redhat Toby Peterson toby@opendarwin.org Todd A. Jacobs tjacobs@codegnome.org diff --git a/src/tail.c b/src/tail.c index 88fbd10..e6d8164 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1432,6 +1432,16 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files, struct File_spec *fspec; struct inotify_event *ev; + /* When following by name without --retry, and the last file has + been unlinked or renamed-away, diagnose it and return. */ + if (follow_mode == Follow_name + && ! reopen_inaccessible_files + && hash_get_n_entries (wd_to_name) == 0) + { + error (0, 0, _("no files remaining")); + return false; + } + /* When watching a PID, ensure that a read from WD will not block indefinitely. */ if (pid) diff --git a/tests/Makefile.am b/tests/Makefile.am index 685eb52..2f4a561 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -489,6 +489,7 @@ TESTS = \ tail-2/assert-2 \ tail-2/big-4gb \ tail-2/flush-initial \ + tail-2/follow-name \ tail-2/follow-stdin \ tail-2/pipe-f \ tail-2/pipe-f2 \ diff --git a/tests/tail-2/follow-name b/tests/tail-2/follow-name new file mode 100755 index 0000000..ef9434a --- /dev/null +++ b/tests/tail-2/follow-name @@ -0,0 +1,32 @@ +#!/bin/sh +# ensure that --follow=name does not imply --retry + +# Copyright (C) 2011 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=.}/init.sh"; path_prepend_ ../src +print_ver_ tail + +cat <<\EOF > exp || framework_failure_ +tail: cannot open `no-such' for reading: No such file or directory +tail: no files remaining +EOF + +timeout 10 tail --follow=name no-such > out 2> err +test $? = 1 || fail=1 + +compare err exp || fail=1 + +Exit $fail -- 1.7.5.rc3.316.gd1ff9 From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 25 05:23:22 2011 Received: (at 8544-done) by debbugs.gnu.org; 25 Apr 2011 09:23:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QEI0e-0000jk-9b for submit@debbugs.gnu.org; Mon, 25 Apr 2011 05:23:22 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QEI0c-0000jY-KY for 8544-done@debbugs.gnu.org; Mon, 25 Apr 2011 05:23:11 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 3B4C760278; Mon, 25 Apr 2011 11:23:04 +0200 (CEST) From: Jim Meyering To: Tim Underwood Subject: Re: bug#8544: tail bug - starting in 7.5 "tail --follow=name" behaves like "tail --follow=name --retry" In-Reply-To: <87oc3vibtl.fsf@rho.meyering.net> (Jim Meyering's message of "Sun, 24 Apr 2011 23:22:46 +0200") References: <87oc3vibtl.fsf@rho.meyering.net> Date: Mon, 25 Apr 2011 11:23:04 +0200 Message-ID: <87aafeheh3.fsf@rho.meyering.net> Lines: 23 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 8544-done Cc: 8544-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.0 (----) Jim Meyering wrote: > Tim Underwood wrote: >> Going from Ubuntu 10.04 (coreutils 7.4) to Ubuntu 10.10 (coreutils 8.5) I >> noticed that "tail --follow=name" started behaving like "tail --follow=name >> --retry". It looks like the issue started in 7.5 and still exists in 8.9. ... > > Thanks again. > Here's the fix I expect to use: > > Subject: [PATCH] tail --follow=name no longer implies --retry > > * src/tail.c (tail_forever_inotify): Just as without inotify, > tail --follow=name now terminates when the last tailed-by-name file > is unlinked or moved aside. This bug was introduced on 2009-06-15 > via commit ae494d4b, "tail: use inotify if it is available". > Reported by Tim Underwood in > http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286 > * NEWS (Bug fixes): Mention this. > * tests/tail-2/follow-name: Test for this. > * tests/Makefile.am (TESTS): Add it. I've pushed that, and am closing this issue. From debbugs-submit-bounces@debbugs.gnu.org Mon Apr 25 12:17:17 2011 Received: (at submit) by debbugs.gnu.org; 25 Apr 2011 16:17:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QEOTM-0002O3-FX for submit@debbugs.gnu.org; Mon, 25 Apr 2011 12:17:17 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QEODw-00020u-Lp for submit@debbugs.gnu.org; Mon, 25 Apr 2011 12:01:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEODk-0004g4-0o for submit@debbugs.gnu.org; Mon, 25 Apr 2011 12:01:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:57100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEODj-0004g0-VL for submit@debbugs.gnu.org; Mon, 25 Apr 2011 12:01:07 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEODi-0004PC-C9 for bug-coreutils@gnu.org; Mon, 25 Apr 2011 12:01:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEODg-0004fT-DV for bug-coreutils@gnu.org; Mon, 25 Apr 2011 12:01:06 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:36511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEODg-0004fH-5V for bug-coreutils@gnu.org; Mon, 25 Apr 2011 12:01:04 -0400 Received: by fxm18 with SMTP id 18so1785658fxm.0 for ; Mon, 25 Apr 2011 09:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=lmY0b/d5ZxtGwQamP0G+RUo0wW/7/TDu0RV9qIXDCY8=; b=kvf1ZYcILrTnAeb6gKT2MqTs3ScR5wYdHkDY7FzHJeZm1oO2axfn0gQKuEh18W6nRc bZOLJSvkAwmvejAVEbccO6BrOtHsxF5mwQnwbubrWJPntFBT87lm27WSVq5ej5Qb/rDr d9JVSz4kyQg9kiApWyYXN1YhCE8hZcGnVocyQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=cjdEio5lkZ26YJazNsrTn6HINqzKRHOTLy/b/+Th9ebX5uAPd0qIhp/wwGNyi24jiG Z/ZRmIIJvd3+d+iGgpFrdqwP8Xd2bB9RCslTZHpsOkPUK5IKDCI1AoNMC0Ud3H+opGw4 RZQgpkxyNuJkilvLiDkvbLF54KjZzALhW2fvg= MIME-Version: 1.0 Received: by 10.223.14.207 with SMTP id h15mr3450580faa.50.1303747261175; Mon, 25 Apr 2011 09:01:01 -0700 (PDT) Received: by 10.223.116.75 with HTTP; Mon, 25 Apr 2011 09:01:00 -0700 (PDT) In-Reply-To: <87oc3vibtl.fsf@rho.meyering.net> References: <87oc3vibtl.fsf@rho.meyering.net> Date: Mon, 25 Apr 2011 09:01:00 -0700 Message-ID: Subject: Re: tail bug - starting in 7.5 "tail --follow=name" behaves like "tail --follow=name --retry" From: Tim Underwood To: Jim Meyering Content-Type: multipart/alternative; boundary=0015174485ac6118d804a1c05019 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 25 Apr 2011 12:17:15 -0400 Cc: bug-coreutils@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) --0015174485ac6118d804a1c05019 Content-Type: text/plain; charset=ISO-8859-1 Thanks for the quick fix Jim! I verified the bug is now fixed in the git repository. -Tim On Sun, Apr 24, 2011 at 2:22 PM, Jim Meyering wrote: > Thanks again. > Here's the fix I expect to use: > > From 79a476abb35a69f409e2848019c8ebc24cc687cf Mon Sep 17 00:00:00 2001 > From: Jim Meyering > Date: Sun, 24 Apr 2011 23:20:01 +0200 > Subject: [PATCH] tail --follow=name no longer implies --retry > > * src/tail.c (tail_forever_inotify): Just as without inotify, > tail --follow=name now terminates when the last tailed-by-name file > is unlinked or moved aside. This bug was introduced on 2009-06-15 > via commit ae494d4b, "tail: use inotify if it is available". > Reported by Tim Underwood in > http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286 > * NEWS (Bug fixes): Mention this. > * tests/tail-2/follow-name: Test for this. > * tests/Makefile.am (TESTS): Add it. > --- > NEWS | 5 +++++ > THANKS.in | 1 + > src/tail.c | 10 ++++++++++ > tests/Makefile.am | 1 + > tests/tail-2/follow-name | 32 ++++++++++++++++++++++++++++++++ > 5 files changed, 49 insertions(+), 0 deletions(-) > create mode 100755 tests/tail-2/follow-name > > diff --git a/NEWS b/NEWS > index 7bc2ef3..3307e71 100644 > --- a/NEWS > +++ b/NEWS > @@ -2,6 +2,11 @@ GNU coreutils NEWS -*- > outline -*- > > * Noteworthy changes in release ?.? (????-??-??) [?] > > +** Bug fixes > + > + tail's --follow=name option no longer implies --retry on systems > + with inotify support. [bug introduced in coreutils-7.5] > + > ** Changes in behavior > > cp's extent-based (FIEMAP) copying code is more reliable in the face > diff --git a/THANKS.in b/THANKS.in > index 342a52c..d1ca380 100644 > --- a/THANKS.in > +++ b/THANKS.in > @@ -560,6 +560,7 @@ Tim J. Robbins tjr@FreeBSD.org > Tim Mooney mooney@dogbert.cc.ndsu.NoDak.edu > Tim Ryan Tim_Ryan@bnz.co.nz > Tim Smithers mouse@dmouse.com.au > +Tim Underwood timunderwood@gmail.com > Tim Waugh twaugh@redhat > Toby Peterson toby@opendarwin.org > Todd A. Jacobs tjacobs@codegnome.org > diff --git a/src/tail.c b/src/tail.c > index 88fbd10..e6d8164 100644 > --- a/src/tail.c > +++ b/src/tail.c > @@ -1432,6 +1432,16 @@ tail_forever_inotify (int wd, struct File_spec *f, > size_t n_files, > struct File_spec *fspec; > struct inotify_event *ev; > > + /* When following by name without --retry, and the last file has > + been unlinked or renamed-away, diagnose it and return. */ > + if (follow_mode == Follow_name > + && ! reopen_inaccessible_files > + && hash_get_n_entries (wd_to_name) == 0) > + { > + error (0, 0, _("no files remaining")); > + return false; > + } > + > /* When watching a PID, ensure that a read from WD will not block > indefinitely. */ > if (pid) > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 685eb52..2f4a561 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -489,6 +489,7 @@ TESTS = \ > tail-2/assert-2 \ > tail-2/big-4gb \ > tail-2/flush-initial \ > + tail-2/follow-name \ > tail-2/follow-stdin \ > tail-2/pipe-f \ > tail-2/pipe-f2 \ > diff --git a/tests/tail-2/follow-name b/tests/tail-2/follow-name > new file mode 100755 > index 0000000..ef9434a > --- /dev/null > +++ b/tests/tail-2/follow-name > @@ -0,0 +1,32 @@ > +#!/bin/sh > +# ensure that --follow=name does not imply --retry > + > +# Copyright (C) 2011 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=.}/init.sh"; path_prepend_ ../src > +print_ver_ tail > + > +cat <<\EOF > exp || framework_failure_ > +tail: cannot open `no-such' for reading: No such file or directory > +tail: no files remaining > +EOF > + > +timeout 10 tail --follow=name no-such > out 2> err > +test $? = 1 || fail=1 > + > +compare err exp || fail=1 > + > +Exit $fail > -- > 1.7.5.rc3.316.gd1ff9 > --0015174485ac6118d804a1c05019 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks for the quick fix Jim! =A0I verified the bug is now fixed in the git= repository.

-Tim

On S= un, Apr 24, 2011 at 2:22 PM, Jim Meyering <jim@meyering.net> wrote:
Thanks ag= ain.
Here's the fix I expect to use:

>From 79a476abb35a69f409e2848019c8ebc24cc687cf Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redh= at.com>
Date: Sun, 24 Apr 2011 23:20:01 +0200
Subject: [PATCH] tail --follow=3Dname no longer implies --retry

* src/tail.c (tail_forever_inotify): Just as without inotify,
tail --follow=3Dname now terminates when the last tailed-by-name file
is unlinked or moved aside. =A0This bug was introduced on 2009-06-15
via commit ae494d4b, "tail: use inotify if it is available".
Reported by Tim Underwood in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286<= /a>
* NEWS (Bug fixes): Mention this.
* tests/tail-2/follow-name: Test for this.
* tests/Makefile.am (TESTS): Add it.
---
=A0NEWS =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A05 +++++
=A0THANKS.in =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A01 +
=A0src/tail.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =A0 10 ++++++++++
=A0tests/Makefile.am =A0 =A0 =A0 =A0| =A0 =A01 +
=A0tests/tail-2/follow-name | =A0 32 ++++++++++++++++++++++++++++++++
=A05 files changed, 49 insertions(+), 0 deletions(-)
=A0create mode 100755 tests/tail-2/follow-name

diff --git a/NEWS b/NEWS
index 7bc2ef3..3307e71 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU coreutils NEWS =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0-*- outline -*-

=A0* Noteworthy changes in release ?.? (????-??-??) [?]

+** Bug fixes
+
+ =A0tail's --follow=3Dname option no longer implies --retry on systems=
+ =A0with inotify support. =A0[bug introduced in coreutils-7.5]
+
=A0** Changes in behavior

=A0 cp's extent-based (FIEMAP) copying code is more reliable in the fa= ce
diff --git a/THANKS.in b/THANKS.in
index 342a52c..d1ca380 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -560,6 +560,7 @@ Tim J. Robbins =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0tjr@FreeBSD.org
=A0Tim Mooney =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
mooney@dogbert.cc.ndsu.NoDak.edu<= /a>
=A0Tim Ryan =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
Tim_Ryan@bnz.co.nz
=A0Tim Smithers =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0mouse@dmouse.com.au
+Tim Underwood =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 timunderwood@gmail.com
=A0Tim Waugh =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 twaugh@red= hat
=A0Toby Peterson =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 toby@opendarwin.org
=A0Todd A. Jacobs =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tjacobs@codegnome.org
diff --git a/src/tail.c b/src/tail.c
index 88fbd10..e6d8164 100644
--- a/src/tail.c
+++ b/src/tail.c
@@ -1432,6 +1432,16 @@ tail_forever_inotify (int wd, struct File_spec *f, s= ize_t n_files,
=A0 =A0 =A0 struct File_spec *fspec;
=A0 =A0 =A0 struct inotify_event *ev;

+ =A0 =A0 =A0/* When following by name without --retry, and the last file h= as
+ =A0 =A0 =A0 =A0 been unlinked or renamed-away, diagnose it and return. = =A0*/
+ =A0 =A0 =A0if (follow_mode =3D=3D Follow_name
+ =A0 =A0 =A0 =A0 =A0&& ! reopen_inaccessible_files
+ =A0 =A0 =A0 =A0 =A0&& hash_get_n_entries (wd_to_name) =3D=3D 0) + =A0 =A0 =A0 =A0{
+ =A0 =A0 =A0 =A0 =A0error (0, 0, _("no files remaining"));
+ =A0 =A0 =A0 =A0 =A0return false;
+ =A0 =A0 =A0 =A0}
+
=A0 =A0 =A0 /* When watching a PID, ensure that a read from WD will not bl= ock
=A0 =A0 =A0 =A0 =A0indefinitely. =A0*/
=A0 =A0 =A0 if (pid)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 685eb52..2f4a561 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -489,6 +489,7 @@ TESTS =3D =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \
=A0 tail-2/assert-2 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0\
=A0 tail-2/big-4gb =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 \
=A0 tail-2/flush-initial =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 \=
+ =A0tail-2/follow-name =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= \
=A0 tail-2/follow-stdin =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0\
=A0 tail-2/pipe-f =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0\
=A0 tail-2/pipe-f2 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 \
diff --git a/tests/tail-2/follow-name b/tests/tail-2/follow-name
new file mode 100755
index 0000000..ef9434a
--- /dev/null
+++ b/tests/tail-2/follow-name
@@ -0,0 +1,32 @@
+#!/bin/sh
+# ensure that --follow=3Dname does not imply --retry
+
+# Copyright (C) 2011 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. =A0See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. =A0If not, see <http://www.gnu.org/licenses/>.
+
+. "${srcdir=3D.}/init.sh"; path_prepend_ ../src
+print_ver_ tail
+
+cat <<\EOF > exp || framework_failure_
+tail: cannot open `no-such' for reading: No such file or directory
+tail: no files remaining
+EOF
+
+timeout 10 tail --follow=3Dname no-such > out 2> err
+test $? =3D 1 || fail=3D1
+
+compare err exp || fail=3D1
+
+Exit $fail
--
1.7.5.rc3.316.gd1ff9

--0015174485ac6118d804a1c05019-- From unknown Sat Aug 09 19:20:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 24 May 2011 11:24:03 +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