From: Pádraig Brady
Date: Fri, 20 May 2011 00:18:28 +0000 (+0100) Subject: split: diagnose when --filter is used with a chunk number X-Git-Tag: v8.13~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfffa909477924eaaa2a5e20ee44be087b0ac87d;p=thirdparty%2Fcoreutils.git 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. --- diff --git a/src/split.c b/src/split.c index 5e203f1b79..9e23f86892 100644 --- a/src/split.c +++ b/src/split.c @@ -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) { diff --git a/tests/split/filter b/tests/split/filter index a42c5539e5..5bc54581f7 100755 --- a/tests/split/filter +++ b/tests/split/filter @@ -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