From: Sylvestre Ledru Date: Mon, 25 May 2026 17:35:42 +0000 (+0200) Subject: tests: sort: check sort -m preserves long lines X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f8600f5d139d1da83c0d176b4536ca2b66283a1;p=thirdparty%2Fcoreutils.git tests: sort: check sort -m preserves long lines * tests/sort/sort-merge.pl: Add 'long-lines' case ensuring that merging input whose lines exceed the read buffer does not split lines on buffer boundaries. https://github.com/coreutils/coreutils/pull/270 --- diff --git a/tests/sort/sort-merge.pl b/tests/sort/sort-merge.pl index 33824790ba..16a6b03009 100755 --- a/tests/sort/sort-merge.pl +++ b/tests/sort/sort-merge.pl @@ -31,6 +31,11 @@ my @inputs = (+(map{{IN=> {"empty$_"=> ''}}}1..3), {IN=> {foo=> "foo\n"}}); my $big_input = "aaa\n" x 1024; +# lines longer than the default merge read buffer must not be split +my $long_lines_in = ('a' x 32000) . "\n" . + ('b' x 32000) . "\n" . + ('c' x 32000) . "\n"; + # don't need to check for existence, since we're running in a temp dir my $badtmp = 'does/not/exist'; @@ -75,6 +80,11 @@ my @Tests = # buffer size would cause the buffer size to be set to the minimum. ['batch-size', "--batch-size=16 -T$badtmp", {IN=> {big=> $big_input}}, {OUT=>$big_input}], + + # Merging input with lines longer than the read buffer must + # preserve line boundaries. + ['long-lines', '-m', {IN=> {long=> $long_lines_in}}, + {OUT=>$long_lines_in}], ); my $save_temps = $ENV{DEBUG};