You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let chunk_size_base = num_bytes / num_chunks;
let chunk_size_reminder = num_bytes % num_chunks;
...
while num_bytes_should_be_written <= num_bytes_written {
num_bytes_should_be_written +=
chunk_size_base + (chunk_size_reminder > chunk_number) as u64;
chunk_number += 1;
}
With chunk_size_base = 0, the increment is only the boolean term. Once chunk_number reaches chunk_size_reminder that term is 0 too, so num_bytes_should_be_written stops advancing while the loop condition stays true. Only chunk_number keeps counting.
Activity
sylvestre commentedon Aug 24, 2026
"fun" :)
mtvb commentedon Aug 24, 2026
If I may add some information I dug up:
src/uu/split/src/split.rs
With chunk_size_base = 0, the increment is only the boolean term. Once chunk_number reaches chunk_size_reminder that term is 0 too, so num_bytes_should_be_written stops advancing while the loop condition stays true. Only chunk_number keeps counting.
sylvestre commentedon Aug 24, 2026
Look good. Don't hesitate to submit a pr with a test
Split enters endless loop fix uutils#14118 (uutils#14123)
Split enters endless loop fix uutils#14118 (uutils#14123)