Repository navigation
tail: report the follow mode actually used with --debug - #16670
costajohnt wants to merge 2 commits into
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: |
--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