summaryrefslogtreecommitdiffstats
path: root/tests/split
diff options
context:
space:
mode:
Diffstat (limited to 'tests/split')
-rwxr-xr-xtests/split/additional-suffix.sh2
-rwxr-xr-xtests/split/b-chunk.sh2
-rwxr-xr-xtests/split/fail.sh2
-rwxr-xr-xtests/split/filter.sh2
-rwxr-xr-xtests/split/guard-input.sh2
-rwxr-xr-xtests/split/l-chunk-root.sh2
-rwxr-xr-xtests/split/l-chunk.sh2
-rwxr-xr-xtests/split/line-bytes.sh6
-rwxr-xr-xtests/split/lines.sh2
-rwxr-xr-xtests/split/non-utf8.sh38
-rwxr-xr-xtests/split/numeric.sh2
-rwxr-xr-xtests/split/r-chunk.sh4
-rwxr-xr-xtests/split/record-sep.sh2
-rwxr-xr-xtests/split/split-io-err.sh44
-rwxr-xr-xtests/split/suffix-auto-length.sh2
-rwxr-xr-xtests/split/suffix-length.sh2
16 files changed, 99 insertions, 17 deletions
diff --git a/tests/split/additional-suffix.sh b/tests/split/additional-suffix.sh
index cb6865f54..ad37e35e9 100755
--- a/tests/split/additional-suffix.sh
+++ b/tests/split/additional-suffix.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# show that 'split --additional-suffix=SUFFIX' works.
-# Copyright (C) 2012-2025 Free Software Foundation, Inc.
+# Copyright (C) 2012-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/b-chunk.sh b/tests/split/b-chunk.sh
index 3e745642d..5ee12a6e3 100755
--- a/tests/split/b-chunk.sh
+++ b/tests/split/b-chunk.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# test splitting into 3 chunks
-# Copyright (C) 2010-2025 Free Software Foundation, Inc.
+# Copyright (C) 2010-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/fail.sh b/tests/split/fail.sh
index 6852e1209..7cc8652e4 100755
--- a/tests/split/fail.sh
+++ b/tests/split/fail.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# split must fail when given length/count of zero.
-# Copyright (C) 2003-2025 Free Software Foundation, Inc.
+# Copyright (C) 2003-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/filter.sh b/tests/split/filter.sh
index 105b6d929..ba8f5e447 100755
--- a/tests/split/filter.sh
+++ b/tests/split/filter.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Exercise split's new --filter option.
-# Copyright (C) 2011-2025 Free Software Foundation, Inc.
+# Copyright (C) 2011-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/guard-input.sh b/tests/split/guard-input.sh
index 1eba9f1de..6800df6b7 100755
--- a/tests/split/guard-input.sh
+++ b/tests/split/guard-input.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# ensure split doesn't overwrite input with output.
-# Copyright (C) 2012-2025 Free Software Foundation, Inc.
+# Copyright (C) 2012-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/l-chunk-root.sh b/tests/split/l-chunk-root.sh
index df74a4384..dc618e715 100755
--- a/tests/split/l-chunk-root.sh
+++ b/tests/split/l-chunk-root.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# test splitting into newline delineated chunks from infinite input
-# Copyright (C) 2023-2025 Free Software Foundation, Inc.
+# Copyright (C) 2023-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/l-chunk.sh b/tests/split/l-chunk.sh
index d616978b6..d79ed9b00 100755
--- a/tests/split/l-chunk.sh
+++ b/tests/split/l-chunk.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# test splitting into newline delineated chunks (-n l/...)
-# Copyright (C) 2010-2025 Free Software Foundation, Inc.
+# Copyright (C) 2010-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/line-bytes.sh b/tests/split/line-bytes.sh
index 740c72ab2..2fbf1226d 100755
--- a/tests/split/line-bytes.sh
+++ b/tests/split/line-bytes.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# test -C, --lines-bytes
+# test -C, --line-bytes
-# Copyright (C) 2013-2025 Free Software Foundation, Inc.
+# Copyright (C) 2013-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@ for b in $(seq 10); do
compare no_eol_splits_exp no_eol_splits || fail=1
done
-# Test hold buffer management with --lines-bytes.
+# Test hold buffer management with --line-bytes.
# The following triggers (with ASAN) a heap overflow issue
# between coreutils 9.2 and 9.4 inclusive.
printf '%131070s\n' '' >expaa || framework_failure_
diff --git a/tests/split/lines.sh b/tests/split/lines.sh
index ff4f14e30..f63f9607a 100755
--- a/tests/split/lines.sh
+++ b/tests/split/lines.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# show that 'split --lines=2' works.
-# Copyright (C) 2002-2025 Free Software Foundation, Inc.
+# Copyright (C) 2002-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/non-utf8.sh b/tests/split/non-utf8.sh
new file mode 100755
index 000000000..224b7a9b5
--- /dev/null
+++ b/tests/split/non-utf8.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# Verify that split preserves non-UTF-8 bytes in prefix and suffix.
+
+# Copyright (C) 2026 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ split
+
+echo a > "$(bad_unicode)" \
+ || skip_ 'bad unicode not supported in shell or file system'
+
+# Non-UTF-8 bytes in prefix should be preserved, not replaced
+# by UTF-8 replacement characters (0xEF 0xBF 0xBD).
+prefix="$(bad_unicode)"
+printf 'AB' | split -b1 - "$prefix" || fail=1
+test -f "$(printf '%saa' $prefix)" || fail=1
+test -f "$(printf '%sab' $prefix)" || fail=1
+
+# Non-UTF-8 bytes in --additional-suffix should also be preserved.
+suffix="$(bad_unicode)"
+printf 'AB' | split -b1 --additional-suffix="$suffix" - q || fail=1
+test -f "$(printf 'qaa%s' "$suffix")" || fail=1
+test -f "$(printf 'qab%s' "$suffix")" || fail=1
+
+Exit $fail
diff --git a/tests/split/numeric.sh b/tests/split/numeric.sh
index 2469bd025..9ae6cb280 100755
--- a/tests/split/numeric.sh
+++ b/tests/split/numeric.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Test --{hex,numeric}-suffixes[=from]
-# Copyright (C) 2012-2025 Free Software Foundation, Inc.
+# Copyright (C) 2012-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/r-chunk.sh b/tests/split/r-chunk.sh
index 472690d28..71fdb3ad5 100755
--- a/tests/split/r-chunk.sh
+++ b/tests/split/r-chunk.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# test splitting into round-robin chunks
-# Copyright (C) 2010-2025 Free Software Foundation, Inc.
+# Copyright (C) 2010-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ compare exp out || fail=1
# Ensure we fall back to appending to a file at a time
# if we hit the limit for the number of open files.
rm x*
-(ulimit -n 20 && yes | head -n90 | split -n r/30 ) || fail=1
+(ulimit -n 20; yes | head -n90 | split -n r/30 ) || fail=1
test "$(stat -c %s x* | uniq -c | sed 's/^ *//; s/ /x/')" = "30x6" || fail=1
Exit $fail
diff --git a/tests/split/record-sep.sh b/tests/split/record-sep.sh
index 0b9870284..c1d1edbd3 100755
--- a/tests/split/record-sep.sh
+++ b/tests/split/record-sep.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# test split with custom record separators
-# Copyright (C) 2015-2025 Free Software Foundation, Inc.
+# Copyright (C) 2015-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/split-io-err.sh b/tests/split/split-io-err.sh
new file mode 100755
index 000000000..2e3b3f632
--- /dev/null
+++ b/tests/split/split-io-err.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Ensure we handle i/o errors correctly in split via /dev/full
+
+# Copyright (C) 2025-2026 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
+print_ver_ split
+getlimits_
+
+cp -sf /dev/full xaa || skip_ '/dev/full is required'
+
+# Create the expected error message
+printf '%s\n' "split: xaa: $ENOSPC" > exp || framework_failure_
+
+# the 'split' command should fail with exit code 1
+seq 2 | returns_ 1 split -b 1 2> err || fail=1
+# split does not cleanup broken file (while csplit does)
+test -e xaa || fail=1
+# split should not continue
+test -e xab && fail=1
+
+# Ensure we got the expected error message
+compare exp err || fail=1
+
+rm xaa || framework_failure_
+# Similar for directory
+mkdir xaa || framework_failure_
+seq 2 | returns_ 1 split -b 1 2 || fail=1
+test -d xaa || fail=1
+
+Exit $fail
diff --git a/tests/split/suffix-auto-length.sh b/tests/split/suffix-auto-length.sh
index 4aee286bb..231c43f29 100755
--- a/tests/split/suffix-auto-length.sh
+++ b/tests/split/suffix-auto-length.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Test the suffix auto width functionality
-# Copyright (C) 2012-2025 Free Software Foundation, Inc.
+# Copyright (C) 2012-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/tests/split/suffix-length.sh b/tests/split/suffix-length.sh
index ba003d62b..84fce04a2 100755
--- a/tests/split/suffix-length.sh
+++ b/tests/split/suffix-length.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# Show that split -a works.
-# Copyright (C) 2002-2025 Free Software Foundation, Inc.
+# Copyright (C) 2002-2026 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by