bug-coreutils
[Top][All Lists]
Advanced

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

bug#24903: "tail -f - foo" does not terminate when stdin is closed and f


From: Bernhard Voelker
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

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





reply via email to

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