head: fix bug reading back through files#7248
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.
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.
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.