-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
head: printing all-but-last-n-lines discrepancy with GNU #7472
Labels
Comments
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 18, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 18, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 18, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 18, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 18, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 18, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 18, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
karlmcdowall
added a commit
to karlmcdowall/coreutils
that referenced
this issue
Mar 19, 2025
Fixes issue uutils#7472. Update to head app when printing all-but-last-n-lines of a file. Code now checks if the last line of the input file is missing a terminating newline character, and if so prints an extra line. This aligns with GNU-head behavior. Also improved performance of this usecase by using an optimized iterator (memchr-iter) for searching through the input file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If the last line of a large file doesn't end with a newline then we get a discrepancy between GNU and Rust implementations.
Steps to reproduce...
1 - make a large file without a line ending...
$ seq 70000 | head -c -1 >seq_70000
2 - Compare GNU with Rust
GNU...
Rust
Issue only exists for large files, small files are handled fine.
I'm planning to fix this.
The text was updated successfully, but these errors were encountered: