summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-12-13 22:03:54 +0100
committerJim Meyering <jim@meyering.net>2006-12-13 22:03:54 +0100
commitec95137cc376119f634610a7683a296fc7b78ea4 (patch)
tree52d315f085e18022db44722d7e58f3e4635d84d9 /tests
parentae3ee95eb8372ec5947e3c790c6ea77bc703c160 (diff)
downloadcoreutils-ec95137cc376119f634610a7683a296fc7b78ea4.tar.xz
Remove some arbitrary restrictions on size fields,
so that commands like "sort -k 18446744073709551616" no longer fail merely because 18446744073709551616 doesn't fit in uintmax_t. The trick is that these fields can all be treated as effectively infinity; their exact values don't matter, since no internal buffer can be that long. * src/join.c (string_to_join_field): Verify that SIZE_MAX <= ULONG_MAX if the code assumes this. Silently truncate too-large values to SIZE_MAX, as the remaining code will do the right thing in this case. * src/sort.c (parse_field_count): Likewise. * src/uniq.c (size_opt, main): Likewise. * tests/join/Test.pm (bigfield): New test. * tests/sort/Test.pm (bigfield): New test. * tests/uniq/Test.pm (121): New test. Signed-off-by: Jim Meyering <jim@meyering.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/join/Makefile.am7
-rw-r--r--tests/join/Test.pm3
-rw-r--r--tests/sort/Makefile.am4
-rwxr-xr-xtests/sort/Test.pm3
-rw-r--r--tests/uniq/Makefile.am4
-rw-r--r--tests/uniq/Test.pm2
6 files changed, 16 insertions, 7 deletions
diff --git a/tests/join/Makefile.am b/tests/join/Makefile.am
index 54ce115b5..151d2fea3 100644
--- a/tests/join/Makefile.am
+++ b/tests/join/Makefile.am
@@ -30,14 +30,15 @@ maint_gen = 1a.I1 1a.I2 1a.X 1b.I1 1b.I2 1b.X 1c.I1 1c.I2 1c.X 1d.I1 1d.I2 \
5k.I2 5k.X 5l.I1 5l.I2 5l.X 5m.I1 5m.I2 5m.X 6a.I1 6a.I2 6a.X 6b.I1 6b.I2 \
6b.X 6c.I1 6c.I2 6c.X 7a.I1 7a.I2 7a.X 8a.I1 8a.I2 8a.X 8b.I1 8b.I2 8b.X \
9a.I1 9a.I2 9a.X trailing-sp.I1 trailing-sp.I2 trailing-sp.X sp-vs-blank.I1 \
-sp-vs-blank.I2 sp-vs-blank.X 8-bit-t.I1 8-bit-t.I2 8-bit-t.X invalid-j.X
+sp-vs-blank.I2 sp-vs-blank.X 8-bit-t.I1 8-bit-t.I2 8-bit-t.X bigfield.I1 \
+bigfield.I2 bigfield.X invalid-j.X
run_gen = 1a.O 1a.E 1b.O 1b.E 1c.O 1c.E 1d.O 1d.E 1e.O 1e.E 1f.O 1f.E 2a.O \
2a.E 2b.O 2b.E 2c.O 2c.E 3a.O 3a.E 4a.O 4a.E 4b.O 4b.E 4c.O 4c.E 4d.O 4d.E \
4e.O 4e.E 5a.O 5a.E 5b.O 5b.E 5c.O 5c.E 5d.O 5d.E 5e.O 5e.E 5f.O 5f.E 5g.O \
5g.E 5h.O 5h.E 5i.O 5i.E 5j.O 5j.E 5k.O 5k.E 5l.O 5l.E 5m.O 5m.E 6a.O 6a.E \
6b.O 6b.E 6c.O 6c.E 7a.O 7a.E 8a.O 8a.E 8b.O 8b.E 9a.O 9a.E trailing-sp.O \
-trailing-sp.E sp-vs-blank.O sp-vs-blank.E 8-bit-t.O 8-bit-t.E invalid-j.O \
-invalid-j.E
+trailing-sp.E sp-vs-blank.O sp-vs-blank.E 8-bit-t.O 8-bit-t.E bigfield.O \
+bigfield.E invalid-j.O invalid-j.E
##test-files-end
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
diff --git a/tests/join/Test.pm b/tests/join/Test.pm
index 37b1449ac..3d60ce3dc 100644
--- a/tests/join/Test.pm
+++ b/tests/join/Test.pm
@@ -136,6 +136,9 @@ my @tv = (
[t_subst "a:1\nb:1\n", t_subst "a:2:\nb:2:\n"],
t_subst "a:1:2:\nb:1:2:\n", 0],
+['bigfield', '-1 340282366920938463463374607431768211456 -2 2',
+ ["a\n", "b\n"], " a b\n", 0],
+
# FIXME: change this to ensure the diagnostic makes sense
['invalid-j', '-j x', {}, "", 1],
diff --git a/tests/sort/Makefile.am b/tests/sort/Makefile.am
index 5bb2fa70a..ead097249 100644
--- a/tests/sort/Makefile.am
+++ b/tests/sort/Makefile.am
@@ -40,7 +40,7 @@ n10b.X n11a.I n11a.X n11b.I n11b.X 01a.I 01a.X 02a.I 02a.X 02b.I 02b.X 02c.I \
21g.I 21g.X 22a.I 22a.X 22b.I 22b.X no-file1.X o-no-file1.X create-empty.X \
neg-nls.I neg-nls.X nul-nls.I nul-nls.X use-nl.I use-nl.X o2.I o2.X \
incompat1.I incompat1.X incompat2.I incompat2.X incompat3.I incompat3.X \
-incompat4.I incompat4.X nul-tab.I nul-tab.X
+incompat4.I incompat4.X nul-tab.I nul-tab.X bigfield.I bigfield.X
run_gen = n1.O n1.E n2.O n2.E n3.O n3.E n4.O n4.E n5.O n5.E n6.O n6.E n7.O \
n7.E n8a.O n8a.E n8b.O n8b.E n9a.O n9a.E n9b.O n9b.E n10a.O n10a.E n10b.O \
n10b.E n11a.O n11a.E n11b.O n11b.E 01a.O 01a.E 02a.O 02a.E 02b.O 02b.E 02c.O \
@@ -61,7 +61,7 @@ n10b.E n11a.O n11a.E n11b.O n11b.E 01a.O 01a.E 02a.O 02a.E 02b.O 02b.E 02c.O \
o-no-file1.E create-empty.O create-empty.E neg-nls.O neg-nls.E nul-nls.O \
nul-nls.E use-nl.O use-nl.E o2.O o2.E incompat1.O incompat1.E incompat2.O \
incompat2.E incompat3.O incompat3.E incompat4.O incompat4.E nul-tab.O \
-nul-tab.E
+nul-tab.E bigfield.O bigfield.E
##test-files-end
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
diff --git a/tests/sort/Test.pm b/tests/sort/Test.pm
index fbc6c49d0..6bed61b7f 100755
--- a/tests/sort/Test.pm
+++ b/tests/sort/Test.pm
@@ -275,6 +275,9 @@ my @tv = (
# -t '\0' is accepted, as of coreutils-5.0.91
['nul-tab', "-k2,2 -t '\\0'", "a\0z\01\nb\0y\02\n", "b\0y\02\na\0z\01\n", 0],
+
+["bigfield", '-k 340282366920938463463374607431768211456',
+ "2\n1\n", "1\n2\n", 0],
);
sub test_vector
diff --git a/tests/uniq/Makefile.am b/tests/uniq/Makefile.am
index b3bb3d17d..965433281 100644
--- a/tests/uniq/Makefile.am
+++ b/tests/uniq/Makefile.am
@@ -30,7 +30,7 @@ obs-plus44.I obs-plus44.X obs-plus45.I obs-plus45.X 50.I 50.X 51.I 51.X 52.I \
62.I 62.X 63.I 63.X 64.I 64.X 65.I 65.X 90.I 90.X 91.I 91.X 92.I 92.X 93.I \
93.X 94.I 94.X 101.I 101.X 102.I 102.X 110.I 110.X 111.I 111.X 112.I 112.X \
113.I 113.X 114.I 114.X 115.I 115.X 116.I 116.X 117.I 117.X 118.I 118.X 119.I \
-119.X 120.I 120.X
+119.X 120.I 120.X 121.I 121.X
run_gen = 1.O 1.E 2.O 2.E 3.O 3.E 4.O 4.E 5.O 5.E 6.O 6.E 7.O 7.E 8.O 8.E 9.O \
9.E 10.O 10.E 11.O 11.E 12.O 12.E 13.O 13.E 20.O 20.E 21.O 21.E 22.O 22.E \
23.O 23.E obs30.O obs30.E 31.O 31.E 32.O 32.E 33.O 33.E 34.O 34.E 35.O 35.E \
@@ -40,7 +40,7 @@ obs-plus44.O obs-plus44.E obs-plus45.O obs-plus45.E 50.O 50.E 51.O 51.E 52.O \
62.O 62.E 63.O 63.E 64.O 64.E 65.O 65.E 90.O 90.E 91.O 91.E 92.O 92.E 93.O \
93.E 94.O 94.E 101.O 101.E 102.O 102.E 110.O 110.E 111.O 111.E 112.O 112.E \
113.O 113.E 114.O 114.E 115.O 115.E 116.O 116.E 117.O 117.E 118.O 118.E 119.O \
-119.E 120.O 120.E
+119.E 120.O 120.E 121.O 121.E
##test-files-end
EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen)
diff --git a/tests/uniq/Test.pm b/tests/uniq/Test.pm
index fe0fc68a5..1eda7e224 100644
--- a/tests/uniq/Test.pm
+++ b/tests/uniq/Test.pm
@@ -105,6 +105,8 @@ my @tv = (
['119', '--all-repeated=badoption', "a\n", "", 1],
# Check that -d and -u suppress all output, as POSIX requires.
['120', '-d -u', "a\na\n\b", "", 0],
+['121', '-d -u -w340282366920938463463374607431768211456',
+ "a\na\n\b", "", 0],
);
sub test_vector