Fixed tail --follow=name continuing to tail a symlink target, unlike GNU tail. Closes #10328#10397
Fixed tail --follow=name continuing to tail a symlink target, unlike GNU tail. Closes #10328#10397trypsynth wants to merge 2 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
Merging this PR will improve performance by 4.4%
Performance Changes
Comparing Footnotes
|
src/uu/tail/src/follow/watch.rs
Outdated
| path.to_owned() | ||
| }; | ||
| let metadata = path.metadata().ok(); | ||
| let is_symlink = path |
There was a problem hiding this comment.
please dedup the declaration (see files:.rs:215)
src/uu/tail/src/follow/watch.rs
Outdated
| 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 |
| if self.follow_name() && !pd.is_symlink && new_is_symlink { | ||
| if pd.reader.is_some() { |
There was a problem hiding this comment.
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!( |
There was a problem hiding this comment.
see that it is duplicated from above
|
@sylvestre fixed, how's that? |
|
I think this doesn't strictly change the situation: checking Thanks |
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!