uutils / uutils/coreutils

tail -F (and -f) does not detect appends to a regular file on Linux

Open
#12,177 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - tail
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

Version: uutils tail 0.2.2 (Ubuntu 25.10 / questing)
Platform: Linux x86_64

Minimal repro:

tmp=$(mktemp -d)
echo "fileA-line1" > $tmp/A
ln $tmp/A $tmp/now
script -qc "tail -F $tmp/now & sleep 6; kill %1" $tmp/out < /dev/null > /dev/null 2>&1 &
sleep 1
echo "fileB-line1" > $tmp/B
ln $tmp/B $tmp/now.tmp
mv -f $tmp/now.tmp $tmp/now    # atomic hard-link replacement
sleep 1
echo "fileB-line2" >> $tmp/B   # NOT shown — bug
sleep 3
wait
cat $tmp/out

Actual output:

fileA-line1
tail: '<tmpdir>/now' has been replaced;  following new file
fileB-line1

Expected (matches GNU tail 9.5):

fileA-line1
tail: '<tmpdir>/now' has been replaced;  following new file
fileB-line1
fileB-line2

So replacement is correctly detected and the new file's initial content is read once, but IN_MODIFY events on the new inode are not handled — appends to the new file after the swap are silently missed.

Same behavior with tail -f (lowercase).

script is just to give tail a PTY so output isn't block-buffered; reproduces identically with a real interactive shell.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Linux reproduction for tail -F and tail -f, then trace the file-replacement and event-handling paths in the tail implementation. Confirm that IN_MODIFY events for the replacement inode are handled after the initial content is read, and verify that fileB-line2 appears in both modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.