summaryrefslogtreecommitdiff
path: root/src/seq.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2007-11-17 09:39:42 +0100
committerJim Meyering <meyering@redhat.com>2007-11-17 09:39:42 +0100
commita03811f5196aec86fd8eb682bd55bdff266f1451 (patch)
treec59e0b896fa1fbb619f6603aa7b58f5c8c0c19dd /src/seq.c
parent6076d0ae2fdae2ebaac6d5a6c793539615471742 (diff)
downloadcoreutils-a03811f5196aec86fd8eb682bd55bdff266f1451.tar.xz
"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.
Diffstat (limited to 'src/seq.c')
-rw-r--r--src/seq.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/seq.c b/src/seq.c
index d7d2521b1..77d558697 100644
--- 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)