#1029103 coreutils: csplit: -z misdocumented

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
наб
Date:
2023-01-17 21:48:06 UTC
Severity:
normal
#1029103#5
Date:
2023-01-17 17:44:31 UTC
From:
To:
Dear Maintainer,

Quoth csplit(1):
-- >8 --
       -z, --elide-empty-files
              remove empty output files
-- >8 --

So given:
-- >8 --
$ (cd nz; printf '%s\n' q w e r t | csplit - 1 4)
0
6
4
$ find nz
nz
nz/xx02
nz/xx01
nz/xx00
$ head nz/*
==> nz/xx00 <==

==> nz/xx01 <==
q
w
e

==> nz/xx02 <==
r
t
-- >8 --

What do you expect the equivalent with -z to be?
Naturally, the manual says "remove", so I'd expect xx01 and xx02
to remain unchanged, but xx00 to be gone.

Let's see:
-- >8 --
$ (cd z; printf '%s\n' q w e r t | csplit -z - 1 4)
6
4
$ find z
z
z/xx01
z/xx00
$ head z/*
==> z/xx00 <==
q
w
e

==> z/xx01 <==
r
t
-- >8 --

Hm. Smells to me like the empty sexions are just ignored entirely
not removed afterward.

наб

#1029103#10
Date:
2023-01-17 21:44:20 UTC
From:
To:
Fair point.
I'll clarify like:

commit 70dc90c579adc972644c9047543ff1dc611b89cc (HEAD -> master)
Author: Pádraig Brady <P@draigBrady.com>
Date:   Tue Jan 17 21:31:31 2023 +0000

     doc: csplit: more accurate --elide-empty-files help

     * src/csplit.c (usage): Use "suppress" rather than "remove"
     when describing -z so it's more apparent that the effect
     is a particular numbered file is not created, rather than
     being removed later.  I.e., don't suggest -z may induce
     gaps in file numbering.

diff --git a/src/csplit.c b/src/csplit.c
index da4b36a7c..9a31697b6 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -1471,7 +1471,7 @@ Read standard input if FILE is -\n\
        fputs (_("\
    -n, --digits=DIGITS        use specified number of digits instead of 2\n\
    -s, --quiet, --silent      do not print counts of output file sizes\n\
-  -z, --elide-empty-files    remove empty output files\n\
+  -z, --elide-empty-files    suppress empty output files\n\
  "), stdout);
        fputs (HELP_OPTION_DESCRIPTION, stdout);
        fputs (VERSION_OPTION_DESCRIPTION, stdout);