Skip to content

split: print "creating file" with --verbose in the -n modes - #15600

Open
fixfon wants to merge 2 commits into
uutils:mainfrom
fixfon:fix/15583-split-verbose-n
Open

fixfon wants to merge 2 commits into
uutils:mainfrom
fixfon:fix/15583-split-verbose-n

Conversation

@fixfon

@fixfon fixfon commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

In the -n modes, split --verbose never printed "creating file". Those modes open their output files through OutFiles (init, and instantiate_writer for the lazy -e path), and neither of them called print_creating_file, which is what -b, -l and -C already use.

Both paths now call it right before the file is opened. I also added an announced flag on OutFile, so a file that gets reopened because of the fd limit isn't announced a second time. The K/N forms write to stdout and create no file, so they still print nothing.

Added test_verbose_number_of_chunks, which covers 14 combinations and fails on main, plus a small test checking that -n K/N stays quiet. I also compared the output against GNU 9.12 split on macOS for -n N, l/N, r/N, with and without -e, and for empty input. Output and order match in all of them.

Not touched, since main already behaves this way: with --filter, GNU prints "executing with FILE=..." while we print "creating file". When it runs into a low ulimit -n, GNU also announces a file again each time it reopens it.

Fixes #15583

--verbose announced the output files for -b, -l and -C but not for any
--number mode, because the files are opened through OutFiles, which never
called print_creating_file. Announce each file once, right before it is
first opened, whether OutFiles opens it up front or lazily (-e). Kth-chunk
modes write to stdout and still print nothing.

Fixes uutils#15583
clippy::format_collect fails the "Style and Lint" job on the
test_verbose_number_of_chunks test added for the -n modes. Append to a
String with writeln! instead of collecting format! results.
@xtqqczze

Copy link
Copy Markdown
Collaborator

Fuzzing failures tracked by #15567.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

split: --verbose prints nothing with -n/--number

2 participants