Subject: bug#23110: seq apparent bug

From: Bernhard Voelker <[email-masked]>
Date: Thu, 7 Apr 2016 11:02:03 +0200

tags 23110 notabug
close 23110
thanks

On 04/06/2016 08:19 PM, Ruediger Meier wrote:
> This sounds all true, however then these one should also run forever:
> $ seq 10 0 2
> 
> Man page says:
>     INCREMENT is usually positive if FIRST is smaller than LAST,
>     and INCREMENT is usually negative if FIRST is greater than LAST.
>  
> This implicates IMO that seq should try to count _down_ if FIRST > LAST 
> and INCREMENT=0

Admittedly, the above documentation aims at useful constellations where
seq really operates as a sequence generator - maybe the wording around
"... usually ..." could be improved here.

In this case, it's not a matter of how increment is treated, but more
when seq ends - which is documented quite clearly both in the --help
output (and therefore in the generated man page), and in the Texinfo
manual:

  http://www.gnu.org/software/coreutils/seq

  The sequence of numbers ends when the sum of the current number
  and increment would become greater than last, [...]

> Moreover I'd say this one does not need to loop endless:
> $ seq 0 0 0

Why? The sum of 0+0 will never become _greater_ than 0.
Likewise for the OPs case ("seq -w 2 0 10"): the sum will never become
greater than 10.

Thus saying, I think this issue is more a confusion regarding the
expectations from the tool.  I don't see why an increment of 0 should
be treated special here.

Therefore, I'm marking this issue as "not a bug", and closing it.
As always, further discussion may continue here, and we can re-open
this issue if needed ... especially if someone proposes a better
wording for the above documentation snippet. ;-)

Have a nice day,
Berny