1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-14 19:32:10 +02:00

split: diagnose when --filter is used with a chunk number

* src/split.c (main): Exit with a diagnostic if --filter
is specified along with a specific chunk number.
* test/split/filter: Ensure this combination fails.
This commit is contained in:
Pádraig Brady
2011-05-20 01:18:28 +01:00
parent 6eec064597
commit bfffa90947
2 changed files with 9 additions and 0 deletions

View File

@@ -1175,6 +1175,12 @@ main (int argc, char **argv)
}
}
if (k_units != 0 && filter_command)
{
error (0, 0, _("--filter does not process a chunk extracted to stdout"));
usage (EXIT_FAILURE);
}
/* Handle default case. */
if (split_type == type_undef)
{

View File

@@ -43,6 +43,9 @@ done
split -e -n 10 --filter='xz > $FILE.xz' /dev/null || fail=1
stat x?? 2>/dev/null && fail=1
# Ensure this invalid combination is flagged
split -n 1/2 --filter='true' /dev/null 2>/dev/null && fail=1
# Ensure SIGPIPEs sent by the children don't propagate back
# where they would result in a non zero exit from split.
yes | head -n200K | split -b1G --filter='head -c1 >/dev/null' || fail=1