Subject: bug#55093: "split -n K/N <file>" BUG: Last Chunk incomplete if input file >= 262144 bytes

From: Adam Holt <[email-masked]>
Date: Sun, 24 Apr 2022 10:40:01 -0400

Hello !

Where do I report a serious data loss bug with GNU's split command?

Example:

$ dd if=/dev/random of=file bs=262144 count=1    # Create file containing
262144 bytes

$ split -n 1/2 file | wc -c
131072
$ split -n 2/2 file | wc -c
0    # SHOULD BE 131072

split -n 1/3 file | wc -c
87381
split -n 2/3 file | wc -c
87381
split -n 3/3 file | wc -c
0    # SHOULD BE 87382

The Last Chunk is completely missing, as you can see in both above examples.

Additionally, if the input file is larger than 2^18 = 262144 bytes, the
Last Chunk generated by "split -n K/N file" is then truncated (i.e. many
bytes are missing, from the beginning of the Last Chunk).

Here's the version number I'm running:

$ split --version
split (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund and Richard M. Stallman.

Thanks so much for your help forwarding this to anybody who might be able
to confirm and ideally resolve this for all !

Regards,
Adam

--
https://internet-in-a-box.org
https://twitter.com/internet_in_box