Skip to content

Conversation

@trypsynth
Copy link
Contributor

Fixed tail --follow=name continuing to tail a symlink target, unlike GNU tail. Closes #10328. Also added a regression test for it. Note that I had a translation app do the French string, as I wasn't entirely sure on the protocol for PRs introducing new strings. Let me know if I need to change anything!

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/shuf/shuf-reservoir (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/sort/sort-stale-thread-mem (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/tail/inotify-dir-recreate is now passing!

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 20, 2026

Merging this PR will improve performance by 4.4%

⚡ 1 improved benchmark
✅ 283 untouched benchmarks
⏩ 38 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory cp_large_file[16] 120.4 KB 115.3 KB +4.4%

Comparing trypsynth:fix-tail-symlinks (6904ee8) with main (0f7a7c4)

Open in CodSpeed

Footnotes

  1. 38 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

path.to_owned()
};
let metadata = path.metadata().ok();
let is_symlink = path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dedup the declaration (see files:.rs:215)

EventKind::Modify(ModifyKind::Metadata(MetadataKind::Any | MetadataKind::WriteTime) | ModifyKind::Data(DataChange::Any) | ModifyKind::Name(RenameMode::To)) |
EventKind::Create(CreateKind::File | CreateKind::Folder | CreateKind::Any) => {
if let Ok(new_md) = event_path.metadata() {
let new_is_symlink = event_path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment on lines 316 to 317
if self.follow_name() && !pd.is_symlink && new_is_symlink {
if pd.reader.is_some() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add comments to describe why we could be here

.symlink_metadata()
.is_ok_and(|meta| meta.file_type().is_symlink());
if !pd.is_symlink && new_is_symlink {
show_error!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see that it is duplicated from above

@trypsynth
Copy link
Contributor Author

@sylvestre fixed, how's that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tail --follow=name accepts symlink replacements

2 participants