misc/123635: jot handles 'stuttering sequences' and reversed ranges incorrectly

Elias Pipping elias at pipping.org
Tue May 13 18:20:01 UTC 2008


>Number:         123635
>Category:       misc
>Synopsis:       jot handles 'stuttering sequences' and reversed ranges incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 13 18:20:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Elias Pipping
>Release:        current
>Organization:
>Environment:
The tests were run on an intel mac with the /usr.bin/jot code from CVS

$ uname -a
Darwin mac.local 9.2.2 Darwin Kernel Version 9.2.2: Tue Mar  4 21:17:34 PST 2008; root:xnu-1228.4.31~1/RELEASE_I386 i386
>Description:
Jot does not seem to be working correctly, with regard to both intuition
and to the manpage.

I'll use pp.awk to format the output of jot a bit -- you can find the
code further down.

The manpage suggests:

  The stuttering sequence 9, 9, 8, 8, 7, etc. can be produced by
  suitable choice of step size, as in
     jot - 9 0 -.5

This is what happens:

  $ jot - 9 0 -.5 | awk -f pp.awk
     2    3    4    5    6    7    8    9    0    1
     3    1    3    1    3    1    3    1    2    1

Furthermore, while this works:

  $ jot -r 10000 0 9 | awk -f pp.awk
     2    3    4    5    6    7    8    9    0    1
   999  977 1008  972  989 1007 1006 1053 1032  957

This should produce basically the same results, but it does not:

  $ jot -r 10000 9 0 | awk -f pp.awk
     9   10   11   12   13   14   15   16
  1237 1233 1271 1210 1247 1260 1262 1280


Appendix
========

$ cat pp.awk
{
  freq[$0]++
}

END \
{
  for (entry in freq)
    printf("%4s ", entry);
  print("");
  for (entry in freq)
    printf("%4d ", freq[entry]);
  print("");
}
>How-To-Repeat:
This script

  http://page.mi.fu-berlin.de/pipping/jot/test_jot.sh

runs a couple of tests with jot fetched from multiple BSDs' CVS repositories. (Tested on Mac OS X only)
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list