coreutils/src/uu/split
Owen Anderson 9fad6fde35
Fix a bug in split where chunking would be skipped when the chunk size (#3800)
* Fix a bug in split where chunking would be skipped when the chunk size
happened to be an exact divisor of the buffer size used to read the
input stream.

The issue here was that file was being split byte-wise in chunks of 1G.
The input stream was being read in chunks of 8KB, which evenly divides
the chunk size. Because the check to allocate the next output chunk was
done at the bottom of the loop previously, it would never occur because
the current input chunk was fully consumed at that point. By moving the
check to the top of the loop (but still late enough that we know we have
bytes to write) we resolve this issue.

This scenario is unfortunately hard to write a test for, since we don't
explicitly control the input chunk size.

Fixes https://github.com/uutils/coreutils/issues/3790
2022-08-16 11:02:52 +02:00
..
src Fix a bug in split where chunking would be skipped when the chunk size (#3800) 2022-08-16 11:02:52 +02:00
BENCHMARKING.md split: add BENCHMARKING.md documentation file 2022-02-08 22:58:00 -05:00
Cargo.toml bump clap from 3.1.18 to 3.2.15 2022-07-29 14:05:02 +02:00
LICENSE Include license text in all published crates 2022-03-05 21:21:46 +01:00
README.md change ~ make all sub-crates independent 2020-05-29 22:59:40 -05:00

Rudimentary "split" Implementation

Missing Features

Flags

  • --verbose - created file printing is implemented, don't know if there is anything else

Possible Optimizations

  • Use slice ([u8]) directly as the control.current_line.