-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
head: fix bug reading back through files #7248
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
Conversation
6c492ef to
8dfc2b6
Compare
8dfc2b6 to
74ef039
Compare
|
how can we reproduce the issue at the level of the command? thanks :) |
|
If you run you should see the issue. With GNU head you'll get the correct output... With the Rust implementation you'll see |
|
maybe add such test here https://github.com/uutils/coreutils/blob/main/tests/by-util/test_head.rs ? :) |
|
Sounds reasonable :) |
0b8afef to
9f0c360
Compare
|
GNU testsuite comparison: |
| } | ||
|
|
||
| #[test] | ||
| fn test_read_backwards_lines_large_file() { |
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.
sorry, I would prefer to create these files on the fly, no need to add big files in the tree :)
and I guess you can reproduce it with only 1 => 50 ?
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.
Updated the test code to generate the files on the fly. Files need to be pretty big since the bug is only seen for backward searches >128K (i.e. double the BUF_SIZE value in head.rs)
9f0c360 to
73c7469
Compare
|
GNU testsuite comparison: |
73c7469 to
9d5d4b6
Compare
|
GNU testsuite comparison: |
Fix issue uutils#7247. Rework logic for reading/seeking backwards through files. Bug was seen when reading back through large files. Added test case to validate fix.
9d5d4b6 to
3ceb338
Compare
|
GNU testsuite comparison: |
Fix issue #7247.
Rework logic for reading/seeking backwards through files. Bug was seen when reading back through large files. Added test case to validate fix.