summaryrefslogtreecommitdiff
path: root/tests/misc/cut-huge-range.sh
diff options
context:
space:
mode:
authorCojocaru Alexandru <xojoc@gmx.com>2013-05-07 13:01:46 +0100
committerPádraig Brady <P@draigBrady.com>2013-05-07 13:07:02 +0100
commitb54b47f954c9b97bdb2dbbf51ead908ccb3a4f13 (patch)
tree1c2f45856aef15025b1a8ba5383207f975260aab /tests/misc/cut-huge-range.sh
parent7fbe8f46867aa7539799d981c28bdbd28d3a7dd0 (diff)
downloadcoreutils-b54b47f954c9b97bdb2dbbf51ead908ccb3a4f13.tar.xz
cut: fix handling of overlapping ranges
This issue was introduced in commit v8.21-43-g3e466ad * src/cut.c (set_fields): Process all range pairs when merging. * tests/misc/cut-huge-range.sh: Add a test for this edge case. Also fix an issue where we could miss reported errors due to truncation of the 'err' file.
Diffstat (limited to 'tests/misc/cut-huge-range.sh')
-rwxr-xr-xtests/misc/cut-huge-range.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/misc/cut-huge-range.sh b/tests/misc/cut-huge-range.sh
index 887197ae9..9905cd758 100755
--- a/tests/misc/cut-huge-range.sh
+++ b/tests/misc/cut-huge-range.sh
@@ -27,7 +27,13 @@ getlimits_
# Up to and including coreutils-8.21, cut would allocate possibly needed
# memory upfront. Subsequently memory is allocated as required.
-(ulimit -v 20000; : | cut -b1-$INT_MAX > err 2>&1) || fail=1
+(ulimit -v 20000; : | cut -b1-$INT_MAX >> err 2>&1) || fail=1
+
+# Ensure ranges are merged correctly when large range logic is in effect
+echo 1 > exp
+(dd bs=1MB if=/dev/zero count=1; echo '1') |
+cut -b1-1000000,2-3,4-5,1000001 2>>err | tail -c2 > out || fail=1
+compare exp out || fail=1
compare /dev/null err || fail=1