From ae5717158f1b9f31b986b0f4416582684039ec55 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 22 May 2007 13:56:34 +0200 Subject: "cut -f 2-0" now fails; before, it was equivalent to "cut -f 2-" Also, diagnose the '-' in "cut -f -" as an invalid range, rather than interpreting it as the unlimited range, "1-". * NEWS: Mention these changes. * src/cut.c (set_fields): Don't interpret an accumulator "value" of 0 as an unspecified range endpoint. Give better diagnostics. Adjust a comment so that it is true also for 64-bit size_t. * tests/cut/Test.pm: Add tests for the above. --- tests/cut/Test.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/cut/Test.pm b/tests/cut/Test.pm index b4cd4e509..109a13f42 100755 --- a/tests/cut/Test.pm +++ b/tests/cut/Test.pm @@ -1,6 +1,6 @@ # Test 'cut'. -# Copyright (C) 1996, 1997, 1998, 1999, 2003, 2004 Free Software +# Copyright (C) 1996, 1997, 1998, 1999, 2003, 2004, 2007 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -113,6 +113,13 @@ my @tv = ( ['od-overlap4', '-b1-3,2-3 --output-d=:', "abcd\n", "abc\n", 0], ['od-overlap5', '-b1-3,1-4 --output-d=:', "abcde\n", "abcd\n", 0], +# None of the following invalid ranges provoked an error before coreutils-6.10. +['inval1', '-f 2-0', '', '', 1], +['inval2', '-f -', '', '', 1], +['inval3', '-f 4,-', '', '', 1], +['inval4', '-f 1-2,-', '', '', 1], +['inval5', '-f 1-,-', '', '', 1], +['inval6', '-f -1,-', '', '', 1], ); # Don't use a pipe for failing tests. Otherwise, sometimes they -- cgit v1.2.3-70-g09d2