GNU bug report logs - #24903
"tail -f - foo" does not terminate when stdin is closed and foo is ignored

Previous Next

Package: coreutils;

Reported by: Julian Büning <julian.buening <at> rwth-aachen.de>

Date: Tue, 8 Nov 2016 16:40:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: Pádraig Brady <P <at> draigBrady.com>, 24903 <at> debbugs.gnu.org,  julian.buening <at> rwth-aachen.de
Subject: bug#24903: "tail -f - foo" does not terminate when stdin is closed and foo is ignored
Date: Wed, 9 Nov 2016 00:44:28 +0100
On 11/09/2016 12:19 AM, Pádraig Brady wrote:
> +  tail -f - 'untailable file' will now terminate when there is no more data
> +  to read from stdin.  Previously it behaved as if --retry was specified.
> +  [This bug was present in "the beginning".]

LGTM, thanks.

> BTW I see a related issue with `tail -f missing_file existing_file`.
> Currently it will keep trying to open("missing_file") even though
> --retry is not specified.  That seems inconsistent to me.
> Shouldn't we ignore items that fail the initial open()?
> I'll do another fix for that unless there are objections.

Good catch - and even more strange: when 'missing_file' then appears
later, tail doesn't terminate when both files are removed:

  $ set -x; rm missing_file; \
  >       touch existing_file; \
  >       src/tail -f missing_file existing_file & \
  >       sleep 5; \
  >       echo abc > missing_file; \
  >       sleep 3; \
  >       rm missing_file existing_file; \
  >       sleep 3; \
  >       ps )
  + rm missing_file
  rm: cannot remove ‘missing_file’: No such file or directory
  + touch existing_file
  + sleep 5
  + src/tail -f missing_file existing_file
  src/tail: cannot open 'missing_file' for reading: No such file or directory
  ==> existing_file <==
  + echo abc
  src/tail: 'missing_file' has appeared;  following new file
  + sleep 3

  ==> missing_file <==
  abc
  + rm missing_file existing_file
  + sleep 3
  + ps
    PID TTY          TIME CMD
   3036 pts/12   00:00:00 bash
   3039 pts/12   00:00:00 tail
   3053 pts/12   00:00:00 ps


Have a nice day,
Berny




This bug report was last modified 8 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.