GNU bug report logs - #15068
`seq' prints the numbers from FIRST to (maybe almost) LAST by INCREMENT

Previous Next

Package: coreutils;

Reported by: jidanni <at> jidanni.org

Date: Sat, 10 Aug 2013 13:57:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.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 15068 in the body.
You can then email your comments to 15068 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#15068; Package coreutils. (Sat, 10 Aug 2013 13:57:08 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 10 Aug 2013 13:57:09 GMT) Full text and rfc822 format available.

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

From: jidanni <at> jidanni.org
To: bug-coreutils <at> gnu.org
Subject: `seq' prints the numbers from FIRST to (maybe almost) LAST by
 INCREMENT
Date: Sat, 10 Aug 2013 21:56:19 +0800
(info "(coreutils) seq invocation")

        ... seq [OPTION]... FIRST INCREMENT LAST

       `seq' prints the numbers from FIRST to LAST by INCREMENT.  By
    default, each number is printed on a separate line.  When INCREMENT is
    not specified, it defaults to `1', even when FIRST is larger than LAST.
    FIRST also defaults to `1'.  So `seq 1' prints `1', but `seq 0' and
    `seq 10 5' produce no output.  Floating-point numbers may be specified.
    *Note Floating point::.

OK but I think you forgot to mention cases like

$ seq 0 5 17

Will the last value printed be
15, 17, or 20?
the user wonders. Hard to tell from the man/info page.




Information forwarded to bug-coreutils <at> gnu.org:
bug#15068; Package coreutils. (Sat, 10 Aug 2013 15:21:02 GMT) Full text and rfc822 format available.

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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: jidanni <at> jidanni.org
Cc: 15068 <at> debbugs.gnu.org
Subject: Re: bug#15068: `seq' prints the numbers from FIRST to (maybe almost)
 LAST by INCREMENT
Date: Sat, 10 Aug 2013 17:20:43 +0200
On 08/10/2013 03:56 PM, jidanni <at> jidanni.org wrote:
> (info "(coreutils) seq invocation")
> 
>         ... seq [OPTION]... FIRST INCREMENT LAST
> 
>        `seq' prints the numbers from FIRST to LAST by INCREMENT.  By
>     default, each number is printed on a separate line.  When INCREMENT is
>     not specified, it defaults to `1', even when FIRST is larger than LAST.
>     FIRST also defaults to `1'.  So `seq 1' prints `1', but `seq 0' and
>     `seq 10 5' produce no output.  Floating-point numbers may be specified.
>     *Note Floating point::.
> 
> OK but I think you forgot to mention cases like
> 
> $ seq 0 5 17
> 
> Will the last value printed be
> 15, 17, or 20?
> the user wonders. Hard to tell from the man/info page.

Thanks for the report.

The following should fix it.

Have a nice day,
Berny

From 4e9f5eb4e2f7614b74c1f930312acc455cc106e7 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail <at> bernhard-voelker.de>
Date: Sat, 10 Aug 2013 17:19:06 +0200
Subject: [PATCH] doc: clarify when seq ends

* doc/coreutils.texi (seq invocation): Add a sentence clarifying
that seq terminates when LAST becomes smaller than the current number
plus INCREMENT.
* src/seq.c (usage): Likewise.
Fixes http://bugs.gnu.org/15068
---
 doc/coreutils.texi | 3 +++
 src/seq.c          | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index aef5cc9..21216b4 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -16810,6 +16810,9 @@ When @var{increment} is not specified, it defaults to @samp{1},
 even when @var{first} is larger than @var{last}.
 @var{first} also defaults to @samp{1}.  So @code{seq 1} prints
 @samp{1}, but @code{seq 0} and @code{seq 10 5} produce no output.
+The sequence of numbers ends when the sum of the current number and
+@var{increment} would become greater than @var{last},
+so @code{seq 1 10 10} only produces @samp{1}.
 Floating-point numbers may be specified.  @xref{Floating point}.

 The program accepts the following options.  Also see @ref{Common options}.
diff --git a/src/seq.c b/src/seq.c
index acbe235..35dfc8b 100644
--- a/src/seq.c
+++ b/src/seq.c
@@ -87,6 +87,8 @@ Print numbers from FIRST to LAST, in steps of INCREMENT.\n\
 \n\
 If FIRST or INCREMENT is omitted, it defaults to 1.  That is, an\n\
 omitted INCREMENT defaults to 1 even when LAST is smaller than FIRST.\n\
+The sequence of numbers ends when the sum of the current number and\n\
+INCREMENT would become greater than LAST.\n\
 FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
 INCREMENT is usually positive if FIRST is smaller than LAST, and\n\
 INCREMENT is usually negative if FIRST is greater than LAST.\n\
-- 
1.8.3.1





Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sun, 18 Aug 2013 00:38:03 GMT) Full text and rfc822 format available.

Notification sent to jidanni <at> jidanni.org:
bug acknowledged by developer. (Sun, 18 Aug 2013 00:38:04 GMT) Full text and rfc822 format available.

Message #13 received at 15068-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Bernhard Voelker <mail <at> bernhard-voelker.de>
Cc: 15068-done <at> debbugs.gnu.org, jidanni <at> jidanni.org
Subject: Re: bug#15068: `seq' prints the numbers from FIRST to (maybe almost)
 LAST by INCREMENT
Date: Sun, 18 Aug 2013 01:37:15 +0100
On 08/10/2013 04:20 PM, Bernhard Voelker wrote:
> On 08/10/2013 03:56 PM, jidanni <at> jidanni.org wrote:
>> (info "(coreutils) seq invocation")
>>
>>         ... seq [OPTION]... FIRST INCREMENT LAST
>>
>>        `seq' prints the numbers from FIRST to LAST by INCREMENT.  By
>>     default, each number is printed on a separate line.  When INCREMENT is
>>     not specified, it defaults to `1', even when FIRST is larger than LAST.
>>     FIRST also defaults to `1'.  So `seq 1' prints `1', but `seq 0' and
>>     `seq 10 5' produce no output.  Floating-point numbers may be specified.
>>     *Note Floating point::.
>>
>> OK but I think you forgot to mention cases like
>>
>> $ seq 0 5 17
>>
>> Will the last value printed be
>> 15, 17, or 20?
>> the user wonders. Hard to tell from the man/info page.
> 
> Thanks for the report.
> 
> The following should fix it.
> 
> Have a nice day,
> Berny
> 
>>From 4e9f5eb4e2f7614b74c1f930312acc455cc106e7 Mon Sep 17 00:00:00 2001
> From: Bernhard Voelker <mail <at> bernhard-voelker.de>
> Date: Sat, 10 Aug 2013 17:19:06 +0200
> Subject: [PATCH] doc: clarify when seq ends
> 
> * doc/coreutils.texi (seq invocation): Add a sentence clarifying
> that seq terminates when LAST becomes smaller than the current number
> plus INCREMENT.
> * src/seq.c (usage): Likewise.
> Fixes http://bugs.gnu.org/15068
> ---
>  doc/coreutils.texi | 3 +++
>  src/seq.c          | 2 ++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/doc/coreutils.texi b/doc/coreutils.texi
> index aef5cc9..21216b4 100644
> --- a/doc/coreutils.texi
> +++ b/doc/coreutils.texi
> @@ -16810,6 +16810,9 @@ When @var{increment} is not specified, it defaults to @samp{1},
>  even when @var{first} is larger than @var{last}.
>  @var{first} also defaults to @samp{1}.  So @code{seq 1} prints
>  @samp{1}, but @code{seq 0} and @code{seq 10 5} produce no output.
> +The sequence of numbers ends when the sum of the current number and
> +@var{increment} would become greater than @var{last},
> +so @code{seq 1 10 10} only produces @samp{1}.
>  Floating-point numbers may be specified.  @xref{Floating point}.
> 
>  The program accepts the following options.  Also see @ref{Common options}.
> diff --git a/src/seq.c b/src/seq.c
> index acbe235..35dfc8b 100644
> --- a/src/seq.c
> +++ b/src/seq.c
> @@ -87,6 +87,8 @@ Print numbers from FIRST to LAST, in steps of INCREMENT.\n\
>  \n\
>  If FIRST or INCREMENT is omitted, it defaults to 1.  That is, an\n\
>  omitted INCREMENT defaults to 1 even when LAST is smaller than FIRST.\n\
> +The sequence of numbers ends when the sum of the current number and\n\
> +INCREMENT would become greater than LAST.\n\
>  FIRST, INCREMENT, and LAST are interpreted as floating point values.\n\
>  INCREMENT is usually positive if FIRST is smaller than LAST, and\n\
>  INCREMENT is usually negative if FIRST is greater than LAST.\n\
> 

Looks good to me.

thanks,
Pádraig.




Information forwarded to bug-coreutils <at> gnu.org:
bug#15068; Package coreutils. (Sun, 18 Aug 2013 21:55:02 GMT) Full text and rfc822 format available.

Message #16 received at 15068-done <at> debbugs.gnu.org (full text, mbox):

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: 15068-done <at> debbugs.gnu.org, P <at> draigBrady.com, jidanni <at> jidanni.org
Subject: Re: bug#15068: `seq' prints the numbers from FIRST to (maybe almost)
 LAST by INCREMENT
Date: Sun, 18 Aug 2013 23:54:45 +0200
On 08/18/2013 02:37 AM, Pádraig Brady wrote:
> Looks good to me.

Thanks for the review.

Pushed:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=4e9f5eb4

I'm hereby marking this bug as 'done'.

Have a nice day,
Berny




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 16 Sep 2013 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 231 days ago.

Previous Next


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