mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-21 03:12:48 +02:00
sort: Fix two bugs with determining the end of field
* src/sort.c: When no specific number of chars to skip is specified for the end field, always skip the whole field. Also never include leading spaces from next field. * tests/misc/sort: Add 2 new tests for these cases. * NEWS: Mention this bug fix. * THANKS: Add bug reporter. Reported by Davide Canova.
This commit is contained in:
@@ -110,6 +110,8 @@ my @Tests =
|
||||
["07b", '-k 2,3', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
|
||||
["07c", '-k 2,3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
|
||||
["07d", '+1 -3', {IN=>"y k b\nz k a\n"}, {OUT=>"z k a\ny k b\n"}],
|
||||
# ensure a character position of 0 includes whole field
|
||||
["07e", '-k 2,3.0', {IN=>"a a b\nz a a\n"}, {OUT=>"z a a\na a b\n"}],
|
||||
#
|
||||
# report an error for `.' without following char spec
|
||||
["08a", '-k 2.,3', {EXIT=>2},
|
||||
@@ -210,6 +212,10 @@ my @Tests =
|
||||
# key start and key end.
|
||||
["18e", '-nb -k1.1,1.2', {IN=>" 901\n100\n"}, {OUT=>"100\n 901\n"}],
|
||||
|
||||
# When ignoring leading blanks for end position, ensure blanks from
|
||||
# next field are not included in the sort. I.E. order should not change here.
|
||||
["18f", '-k1,1b', {IN=>"a y\na z\n"}, {OUT=>"a y\na z\n"}],
|
||||
|
||||
# This looks odd, but works properly -- 2nd keyspec is never
|
||||
# used because all lines are different.
|
||||
["19a", '+0 +1nr', {IN=>"b 2\nb 1\nb 3\n"}, {OUT=>"b 1\nb 2\nb 3\n"}],
|
||||
|
||||
Reference in New Issue
Block a user