coreutils/src/uu/tail
Jeffrey Finkelstein 83f96ec29d tail: don't error when following non-UTF-8 data
Fix a bug where `tail -f` would terminate with an error due to failing
to parse a UTF-8 string from a sequence of bytes read from the
followed file. This commit replaces the call to `BufRead::read_line()`
with a call to `BufRead::read_until()` so that any sequence of bytes
regardless of encoding can be read.

Fixes #1050.
2022-01-24 21:32:52 -05:00
..
src tail: don't error when following non-UTF-8 data 2022-01-24 21:32:52 -05:00
Cargo.toml Merge pull request #2863 from tertsdiepraam/clap-3 2022-01-20 23:14:52 +01:00
README.md tail: handle - as an alias for stdin 2021-08-01 17:20:24 -04:00

Notes / ToDO

  • Rudimentary tail implementation.

Missing features

Flags with features

  • --max-unchanged-stats : with --follow=name, reopen a FILE which has not changed size after N (default 5) iterations to see if it has been unlinked or renamed (this is the usual case of rotated log files). With inotify, this option is rarely useful.
  • --retry : keep trying to open a file even when it is or becomes inaccessible; useful when following by name, i.e., with --follow=name

Others

  • The current implementation doesn't follow stdin in non-unix platforms

Possible optimizations

  • Don't read the whole file if not using -f and input is regular file. Read in chunks from the end going backwards, reading each individual chunk forward.