>From 1f50ec1b18705221dfb559393e169619a0777220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Fri, 20 May 2011 01:18:28 +0100 Subject: [PATCH] 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. --- src/split.c | 6 ++++++ tests/split/filter | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/split.c b/src/split.c index 05315e6..5f488d4 100644 --- a/src/split.c +++ b/src/split.c @@ -1148,6 +1148,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) { diff --git a/tests/split/filter b/tests/split/filter index 4c25c5f..1dc13fb 100755 --- a/tests/split/filter +++ b/tests/split/filter @@ -43,4 +43,7 @@ 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 + Exit $fail -- 1.7.4