Subject: `split --number=l/N` no longer splits evenly

From: Victor Engmark <[email-masked]>
Date: Sun, 03 Dec 2023 13:25:01 +1300

Hi all

Commit fb6fc7f3ce6b0b70a5df7f605e71c4f8541e256b (part of v9.2)
introduced a regression in how `split --number=l/N` works.

Test script `tests/split/l-chunk2.sh`:

```
#!/bin/sh

. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ split

printf 'first\n' > exp1 || framework_failure_
printf 'second\n' > exp2 || framework_failure_
cat exp1 exp2 > in || framework_failure_
split -e -n l/2 in || framework_failure_
compare exp1 xaa || fail=1
compare exp2 xab || fail=1

Exit $fail
```

Relevant test output:

```
+ diff -u exp1 xaa
--- exp1	2023-12-03 12:42:50.511334991 +1300
+++ xaa	2023-12-03 12:42:50.513334908 +1300
@@ -1 +1,2 @@
 first
+second
```

and

```
+ diff -u exp2 xab
diff: xab: No such file or directory
```

In other words, it doesn't split the file at all, despite it containing
two lines of content.

The bug is still present in current master (commit
73d119f4f8052a9fb6cef13cd9e75d5a4e23311a).

Bisected on NixOS 23.11 using the following script:

```
#!/bin/sh

set -e

export CFLAGS=-w # Avoid build failure

git submodule update
git clean -fdx --exclude=bisect.sh --exclude=tests/split/l-chunk2.sh

./bootstrap
autoconf
./configure
make
make check TESTS=tests/split/l-chunk2.sh SUBDIRS=.
```

and these commands:

```
git bisect start master v9.1
git bisect run ./bisect.sh
```

Cheers
Victor