Subject: bug#21356: BUG: split shorter version of '--numeric-suffixes' give error

From: Pádraig Brady <[email-masked]>
Date: Thu, 27 Aug 2015 16:18:51 +0100

On 27/08/15 13:06, Stephane Chazelas wrote:
> 2015-08-27 00:05:49 +0100, Pádraig Brady:
> [...]
>>> $ split -n10 -a4 -d5 echo.txt
>>> split: cannot split in more than one way
>>> Try 'split --help' for more information.
>>>
>>> where as using longer option for `-d` i.e. `--numeric-suffixes` works fine.
>>>
>>> $ split -n10 -a4 --numeric-suffixes=5 echo.txt
>>>
>>>
>>> FYI: I had asked it on unix.stackexchange as well, for reference http://unix.stackexchange.com/q/225704/17265
>>
>> -d can't take an _optional_ argument for backwards compat
>> and operational reasons.  I.E. generally short options
>> can't take an optional argument due to ambiguities that would introduce.
>>
>> The particular ambiguity in this case is that -d5 is equivalent
>> to -d -5, which is equivalent to -d -l5, hence the error.
> [...]
> 
> Note that GNU getopt supports short options with optional
> arguments (though doesn't allow an empty argument like the long
> option version).
> 
> The split documentation could be improved to avoid this kind of
> confusion:
> 
> info page:
> 
> `-l LINES'
> `--lines=LINES'
>      Put LINES lines of INPUT into each output file.
> 
>      For compatibility `split' also supports an obsolete option syntax
>      `-LINES'.  New scripts should use `-l LINES' instead.
> [...]
> `-d'
> `--numeric-suffixes[=FROM]'
>      Use digits in suffixes rather than lower-case letters.  The
>      numerical suffix counts from FROM if specified, 0 otherwise.  Note
>      specifying a FROM value also disables the default auto suffix
>      length expansion described above, and so you may also want to
>      specify `-a' to allow suffixes beyond `99'.
> 
> It's easy to miss that it's not `-d[FROM]` here. A note along
> these lines could help:
> 
> "Note that the FROM value can only be specified with the long
> option from."

Done at:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=da5505dd7f

I can't think of any suitably terse improvements for the man page.

thanks,
Pádraig.