-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fixed tail --follow=name continuing to tail a symlink target, unlike GNU tail. Closes #10328 #10397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
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)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
| if self.follow_name() && !pd.is_symlink && new_is_symlink { | ||
| if pd.reader.is_some() { |
There was a problem hiding this comment.
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!( |
There was a problem hiding this comment.
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
|
@sylvestre fixed, how's that? |
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!