GNU bug report logs - #21356
BUG: split shorter version of '--numeric-suffixes' give error

Previous Next

Package: coreutils;

Reported by: Tareque Md Khan <mohdtarequekhan <at> gmail.com>

Date: Wed, 26 Aug 2015 22:22:01 UTC

Severity: normal

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 21356 <at> debbugs.gnu.org (full text, mbox):

From: Stephane Chazelas <stephane.chazelas <at> gmail.com>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 21356 <at> debbugs.gnu.org, Tareque Md Khan <mohdtarequekhan <at> gmail.com>
Subject: Re: bug#21356: BUG: split shorter version of '--numeric-suffixes'
 give error
Date: Thu, 27 Aug 2015 13:06:14 +0100
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."

For the --help output (in English at least), the distinction
doesn't appear:

  -d, --numeric-suffixes[=FROM]  use numeric suffixes instead of alphabetic.
                                   FROM changes the start value (default 0).
[...]
  -l, --lines=NUMBER      put NUMBER lines per output file

Can't tell from that that -d5 wouldn't work.

-- 
Stephane




This bug report was last modified 6 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.