diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | src/cut.c | 3 | ||||
-rwxr-xr-x | tests/misc/cut.pl | 5 |
3 files changed, 12 insertions, 0 deletions
@@ -10,6 +10,10 @@ GNU coreutils NEWS -*- outline -*- ** Bug fixes + cut no longer accepts the invalid range 0-, which made it print empty lines. + Instead, cut now fails and emits an appropriate diagnostic. + [This bug was present in "the beginning".] + pr -n no longer crashes when passed values >= 32. Also line numbers are consistently padded with spaces, rather than with zeros for certain widths. [bug introduced in TEXTUTILS-1_22i] @@ -369,6 +369,9 @@ set_fields (const char *fieldstr) dash_found = true; fieldstr++; + if (lhs_specified && !value) + FATAL_ERROR (_("fields and positions are numbered from 1")); + initial = (lhs_specified ? value : 1); value = 0; } diff --git a/tests/misc/cut.pl b/tests/misc/cut.pl index 0ce051ab0..cd5655569 100755 --- a/tests/misc/cut.pl +++ b/tests/misc/cut.pl @@ -46,6 +46,11 @@ my @Tests = # It was treated just like "-2". ['zero-2', '-f0-2', {ERR=>$from_1}, {EXIT => 1} ], + # Up to coreutils-8.20, specifying a range of 0- was not an error. + ['zero-3b', '-b0-', {ERR=>$from_1}, {EXIT => 1} ], + ['zero-3c', '-c0-', {ERR=>$from_1}, {EXIT => 1} ], + ['zero-3f', '-f0-', {ERR=>$from_1}, {EXIT => 1} ], + ['1', '-d:', '-f1,3-', {IN=>"a:b:c\n"}, {OUT=>"a:c\n"}], ['2', '-d:', '-f1,3-', {IN=>"a:b:c\n"}, {OUT=>"a:c\n"}], ['3', qw(-d: -f2-), {IN=>"a:b:c\n"}, {OUT=>"b:c\n"}], |