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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21356 in the body.
You can then email your comments to 21356 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#21356; Package coreutils. (Wed, 26 Aug 2015 22:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tareque Md Khan <mohdtarequekhan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 26 Aug 2015 22:22:02 GMT) Full text and rfc822 format available.

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

From: Tareque Md Khan <mohdtarequekhan <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: BUG: split shorter version of '--numeric-suffixes' give error
Date: Thu, 27 Aug 2015 02:38:48 +0530
[Message part 1 (text/plain, inline)]
Hi,

My first bug-reporting.

I discovered a *cosmetic* bug in 'split' command. I wanted to split a file
in 'n' chunks, with suffix 'a' chars wide and numeric suffix starting from
'd'. I tried

$ 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

-Thanks,
Md Tareque Khan
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#21356; Package coreutils. (Wed, 26 Aug 2015 23:06:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Tareque Md Khan <mohdtarequekhan <at> gmail.com>, 21356 <at> debbugs.gnu.org
Subject: Re: bug#21356: BUG: split shorter version of '--numeric-suffixes'
 give error
Date: Thu, 27 Aug 2015 00:05:49 +0100
tag 21356 notabug
close 21356
stop

On 26/08/15 22:08, Tareque Md Khan wrote:
> Hi,
> 
> My first bug-reporting.
> 
> I discovered a /cosmetic/ bug in 'split' command. I wanted to split a file in 'n' chunks, with suffix 'a' chars wide and numeric suffix starting from 'd'. I tried
> 
> $ 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.

thanks,
Pádraig.





Information forwarded to bug-coreutils <at> gnu.org:
bug#21356; Package coreutils. (Thu, 27 Aug 2015 12:07:01 GMT) Full text and rfc822 format available.

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




Information forwarded to bug-coreutils <at> gnu.org:
bug#21356; Package coreutils. (Thu, 27 Aug 2015 15:20:06 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Stephane Chazelas <stephane.chazelas <at> gmail.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 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.




Information forwarded to bug-coreutils <at> gnu.org:
bug#21356; Package coreutils. (Thu, 27 Aug 2015 19:44:02 GMT) Full text and rfc822 format available.

Message #17 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 20:43:17 +0100
2015-08-27 16:18:51 +0100, Pádraig Brady:
[...]
> > info page:
[...]
> > 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

Thanks.

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

Maybe something like:

  -d                          use numeric suffixes instead of alphabetic
                              (starting at 0)
  --numeric-suffixes[=FROM]   same as above but allows changing the
                              starting value.

As in effect, they are different options.

-- 
Stephane





Information forwarded to bug-coreutils <at> gnu.org:
bug#21356; Package coreutils. (Mon, 31 Aug 2015 17:14:01 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Stephane Chazelas <stephane.chazelas <at> gmail.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: Mon, 31 Aug 2015 18:13:11 +0100
[Message part 1 (text/plain, inline)]
On 27/08/15 20:43, Stephane Chazelas wrote:
> 2015-08-27 16:18:51 +0100, Pádraig Brady:
> [...]
>>> info page:
> [...]
>>> 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
> 
> Thanks.
> 
>> I can't think of any suitably terse improvements for the man page.
> [...]
> 
> Maybe something like:
> 
>   -d                          use numeric suffixes instead of alphabetic
>                               (starting at 0)
>   --numeric-suffixes[=FROM]   same as above but allows changing the
>                               starting value.
> 
> As in effect, they are different options.
> 

I'll apply the attached later.

thanks,
Pádraig.
[short-optional-param.patch (text/x-patch, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#21356; Package coreutils. (Mon, 31 Aug 2015 19:57:02 GMT) Full text and rfc822 format available.

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

From: Jim Meyering <jim <at> meyering.net>
To: Pádraig Brady <P <at> draigbrady.com>
Cc: 21356 <at> debbugs.gnu.org, Stephane Chazelas <stephane.chazelas <at> gmail.com>,
 Tareque Md Khan <mohdtarequekhan <at> gmail.com>
Subject: Re: bug#21356: BUG: split shorter version of '--numeric-suffixes'
 give error
Date: Mon, 31 Aug 2015 12:56:29 -0700
On Mon, Aug 31, 2015 at 10:13 AM, Pádraig Brady <P <at> draigbrady.com> wrote:
> I'll apply the attached later.

Nice. Thanks to both of you.




bug closed, send any further explanations to 21356 <at> debbugs.gnu.org and Tareque Md Khan <mohdtarequekhan <at> gmail.com> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 24 Oct 2018 21:08:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Nov 2018 12:24:09 GMT) Full text and rfc822 format available.

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

Previous Next


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