-
-
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 improve performances by 3.04%Comparing Summary
Benchmarks breakdown
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: |
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: |
|
GNU testsuite comparison: |
ddbe063 to
9970fd3
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
a96184d to
f0e6d85
Compare
|
GNU testsuite comparison: |
f0e6d85 to
e54c336
Compare
- Add last_messages HashMap to track message timing - Suppress duplicate messages within 100ms window - Fixes duplicate stderr messages in follow_name tests
- Add handle_rename method to update file associations after renames - Import MetadataExt for inode comparison - Update reader after rename events to reflect new file state - Addresses STDOUT content under wrong headers issue
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
- Remove handle_rename method that was causing regressions - Keep only simple deduplication for stderr messages - Remove unused imports and methods - Focus on minimal, targeted fixes
|
GNU testsuite comparison: |
- Add update_reader_with_positioning() method for proper file positioning after truncate events - Implement synthetic event tracking to prevent duplicate 'has appeared' messages - Fix truncate event handling to use bounded_tail positioning logic - Remove unused imports and fix compiler warnings - Ensure proper file reader positioning for test_follow_name_truncate* and test_retry4 tests Resolves truncate test failures and improves event deduplication.
- Remove premature reset of last_event_was_synthetic after real events - Only reset synthetic flag after processing synthetic events - Prevents extra 'has appeared' messages in rename tests Fixes test_follow_name_move* and test_follow_name_move_retry* failures.
|
GNU testsuite comparison: |
- Simplified update_reader() to always reopen files for replacements - Fixed duplicate path reads by adding else branch for normal modify events - Improved file replacement detection and content reading This addresses issues with rename events where files weren't being properly reopened and content was being read multiple times.
|
GNU testsuite comparison: |
This commit removes the --debug flag implementation to be handled in a separate PR (uutils#8949). The current PR now focuses solely on: - Adding SHA3/SHAKE algorithm support - Enabling --length parameter for SHA3/SHAKE - Fixing error messages for cksum context The --debug flag will be implemented in a follow-up PR.
|
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.