[Bug 269250] split(1): auto-extend suffix length if required

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 30 Jan 2023 16:20:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=269250

            Bug ID: 269250
           Summary: split(1): auto-extend suffix length if required
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jschauma@netmeister.org

I've just committed a change to NetBSD's split(1) to auto-extend the
suffix-length if needed:

If the input cannot be split into the number of files resulting from the
default suffix length, automatically extend the suffix length rather than
bailing out with 'too many files'.

Suffixes are extended such that the resulting files continue to sort lexically
and "cat *" would reproduce the input.  For example, splitting a 1M lines file
into (default) 1000 lines per file would yield files named 'xaa', 'xab', ...,
'xyy', 'xyz', 'xzaaa', 'xzaab', ..., 'xzanl'.

If '-a' is specified, the suffix length is not auto-extended.

This behavior matches GNU sort(1) since around version 8.16.

The NetBSD diffs are here:
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/split/split.c.diff?r1=1.28&r2=1.29

http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.bin/split/split.1.diff?r1=1.15&r2=1.16

-- 
You are receiving this mail because:
You are the assignee for the bug.