-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
tail: fix follow-name on BSD/macOS and improve test compatibility #8949
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
809be25
to
17d8631
Compare
GNU testsuite comparison:
|
5021374
to
702afb8
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
2 similar comments
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
1 similar comment
GNU testsuite comparison:
|
GNU testsuite comparison:
|
tests/by-util/test_tail.rs
Outdated
const DELAY_FOR_TAIL_NORMAL: u64 = 3000; // For default tail -f (1s interval) | ||
// For tail with -s.1 (100ms sleep): use 3x = 300ms | ||
const DELAY_FOR_TAIL_FAST: u64 = 300; // For tail -s.1 (100ms interval) | ||
// For tail with -s.1 (100ms sleep): use 6x = 600ms for stability |
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 explain why :)
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.
basically 3x wasn't enough for CI, bumped to 6x to handle platform differences
Addresses review feedback from @sylvestre on PR uutils#8949. Adds detailed explanation for why DELAY_FOR_TAIL_FAST uses 6x multiplier (600ms) instead of 3x (300ms): - Event notification delays vary significantly across platforms - tail event loop processing adds overhead per iteration - File system operations take longer in CI environments - Empirically determined from flaky test analysis The 6x multiplier provides reliable buffer while keeping tests fast.
CodSpeed Performance ReportMerging #8949 will not alter performanceComparing Summary
Footnotes
|
GNU testsuite comparison:
|
1 similar comment
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
57b5a87
to
43c39a7
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
Implement comprehensive fix for parent-directory watching in tail --follow=name mode, addressing issues identified in PR uutils#8949 where dual-watch setup (file + parent directory) breaks descriptor mode tests on Linux. Key Changes: 1. Watch Source Tracking (Phase 1) - Add WatchSource enum to identify event origins (File vs ParentDirectory) - Add WatchedPath struct to track file and parent directory paths - Refactor FileHandling to store watch metadata per monitored file 2. Event Path Resolution (Phase 2) - Implement resolve_event_paths() to map events to affected files - Add event_affects_file() helper to check parent event relevance - Properly handle events from both file and parent directory watches 3. Event Loop Integration (Phase 3) - Replace manual event resolution with systematic approach - Wire resolve_event_paths() into main follow loop - Process events based on watch source tracking 4. Seekable Reader (Phase 4) - Add BufReadSeek trait combining BufRead + Seek + Send - Refactor PathData::reader from Box<dyn BufRead> to Box<dyn BufReadSeek> - Add NonSeekableReader wrapper for stdin compatibility - Fix limitation preventing file growth detection after rename Platform-Specific Behavior: - Linux (inotify): Parent watching ACTIVE for --follow=name - macOS/BSD (kqueue): Parent watching INACTIVE (not beneficial) - Changes isolated via cfg!(target_os = "linux") Test Results: - macOS: 114/114 tests passing (100%) - Linux: Base branch shows 13 failures (validates our fix approach) - Zero regressions on macOS - 1 expected warning (unused field) Documentation: - TAIL_INVESTIGATION.md: Problem analysis and findings - TAIL_PARENT_WATCH_DESIGN.md: Architectural design - IMPLEMENTATION_COMPLETE.md: Complete implementation summary - LINUX_VALIDATION_RESULTS.md: Validation results and comparison Fixes uutils#3778 Related to PR uutils#8949
GNU testsuite comparison:
|
728f06e
to
2bc52d3
Compare
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
GNU testsuite comparison:
|
Watch parent directory to detect file recreation after rm/mv operations. Adds platform-specific handling for inotify (Linux) and kqueue (BSD/macOS). Fixes uutils#3778
a44f087
to
e54c336
Compare
GNU testsuite comparison:
|
This PR fixes tail's follow-name mode on macOS and BSD by extending the parent directory watching workaround to kqueue platforms. Previously this only worked on Linux with inotify. Now tail properly tracks files that get renamed or recreated, fixing test_follow_name_move_create1 and test_follow_name_move1.
I've also cleaned up test coverage by enabling the stat stdin pipe test on all Unix platforms and documenting why three tests stay disabled on FreeBSD and OpenBSD. Those failures are due to platform-specific permission models around dev stdout and dangling symlinks, not actual bugs. All three tests pass on macOS which also uses kqueue, confirming the issues are FreeBSD and OpenBSD specific. The original test disabling was done in commit 391709c.
Fixes #3778.