Repository navigation
tail: report the follow mode actually used with --debug - #16670
Conversation
--debug always printed "using notification mode", once, before the initial output. Print the mode only once following actually starts, report blocking mode (-f) or polling mode (-F) when no input (stdin included) is a regular file, and report the switch to polling the first time a watched directory is removed. Closes uutils#16643
| @@ -540,11 +548,37 @@ fn report_inaccessible(display_name: &str) { | |||
| } | |||
|
|
|||
| #[allow(clippy::cognitive_complexity)] | |||
There was a problem hiding this comment.
this allow now applies to print_follow_mode instead of follow, so clippy is red. please move the new fn above it
| // already gone whenever tail handles the removal. | ||
| at.rename("dir", "dir.gone"); | ||
| at.remove("dir.gone/f"); | ||
| for _ in 0..100 { |
There was a problem hiding this comment.
the same wait loop is here 3 times, could you please add a small helper?
|
thanks for the PR! |
|
Binary size comparison: |
Put the cognitive_complexity allow back on follow(), drop the WASI stub Observer field that is no longer read, and classify stdin with fstat on fd 0 instead of stat on /dev/stdin.
|
Thanks! Moved the
The MSYS failure ( |
|
GNU testsuite comparison: |
| let no_regular_file = settings.inputs.iter().all(|input| match input.kind() { | ||
| InputKind::File(path) => path.metadata().is_ok_and(|md| !md.is_file()), | ||
| #[cfg(unix)] | ||
| InputKind::Stdin => rustix::fs::fstat(std::io::stdin()) |
There was a problem hiding this comment.
this is the same fstat check as stdin_is_regular in args.rs, could be a small shared helper, no?
|
thanks for this PR! |
|
Thanks! Both done:
About the red checks on the last push, I don't think they come from the diff:
Locally, clippy -D warnings on uu_tail is clean (also the tail tests built for the linux target), the wasm32-wasip1 clippy command from that job passes, and fmt and cspell pass too. |
Merging this PR will degrade performance by 7.53%1 warning, 1 note
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
|
Thanks for your PR |
--debugalways printedusing notification mode, once, before the initial output. Now the mode line comes when following actually starts, and it names the mode in use:-fwith no regular-file input (e.g./dev/null, a piped stdin) printsusing blocking mode, and-Fon the same printsusing polling mode, as in the issue.using polling modefollowsinotify cannot be used, reverting to polling(once, even with several files in that directory).tail --debug -f missing).Only the reported message changes for devices and FIFOs; the watcher underneath is the same.
The new tests cover the blocking and polling cases, the missing-file case and the switch to polling. The directory tests rename the directory before deleting its files and wait for tail's own output before the next step, so they don't depend on timing.
Closes #16643