]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
"seq .1 .1" would mistakenly generate no output on some systems
authorJim Meyering <meyering@redhat.com>
Sat, 17 Nov 2007 08:39:42 +0000 (09:39 +0100)
committerJim Meyering <meyering@redhat.com>
Sat, 17 Nov 2007 08:39:42 +0000 (09:39 +0100)
* NEWS: Say this.
* src/seq.c (print_numbers): Handle another floating point corner case.
This avoids failure of seq's eq-wid-7 test on FreeBSD 6.1.

ChangeLog
NEWS
src/seq.c

index 0e6c87a346f4e6a69d12a50c75287c801b74f440..d563ae900a18e173db765f64c77f14ecab169729 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-17  Jim Meyering  <meyering@redhat.com>
+
+       "seq .1 .1" would mistakenly generate no output on some systems
+       * NEWS: Say this.
+       * src/seq.c (print_numbers): Handle another floating point corner case.
+       This avoids failure of seq's eq-wid-7 test on FreeBSD 6.1.
+
 2007-11-16  Paul Eggert  <eggert@cs.ucla.edu>
 
        Port tests/rmdir/ignore away from GNU/Linux.
diff --git a/NEWS b/NEWS
index a8434c54cdd38ca231b5a684a6428f0231bea266..11efa75822961e8de11776eaca7d4e0bee6d8d8d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -142,6 +142,8 @@ GNU coreutils NEWS                                    -*- outline -*-
   seq would mistakenly reject some valid format strings containing %%,
   and would mistakenly accept some invalid ones. e.g., %g%% and %%g, resp.
 
+  "seq .1 .1" would mistakenly generate no output on some systems
+
   Obsolete sort usage with an invalid ordering-option character, e.g.,
   "env _POSIX2_VERSION=199209 sort +1x" no longer makes sort free an
   invalid pointer [introduced in coreutils-6.5]
index d7d2521b1454fafee12270cdfac3b6754ede349e..77d5586974a52dc3a91e9e24d17fb084d53f8cec 100644 (file)
--- a/src/seq.c
+++ b/src/seq.c
@@ -280,7 +280,13 @@ print_numbers (char const *fmt, struct layout layout,
              free (x_str);
            }
 
-         break;
+         /* With floating point arithmetic, we may well reach this point
+            with i == 0 and first == last.  E.g., ./seq .1 .1 on FreeBSD 6.1.
+            Hence the first conjunct: don't break out of this loop when
+            i == 0.  *unless* first and last themselves are out of order,
+            in which case we must print nothing, e.g. for ./seq -1  */
+         if (i || last < first)
+           break;
        }
 
       if (i)