Skip to content

head: printing all-but-last-n-lines discrepancy with GNU #7472

@karlmcdowall

Description

@karlmcdowall

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...

$head -n -1 seq_70000
...
69998
69999

Rust

$./target/debug/head -n -1 seq_70000
...
69997
69998

Issue only exists for large files, small files are handled fine.

I'm planning to fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions