Pádraig Brady
a79dbb97bf
split: ensure input is processed when filters exit early
...
commit v8.25-4-g62e7af0 introduced the issue as it
broke out of the processing loop irrespective of
the value of new_file_flag which was used to indicate
a finite number of filters or not.
For example, this ran forever (as it should):
$ yes | split --filter="head -c1 >/dev/null" -b 1000
However this exited immediately due to EPIPE being propagated
back through cwrite and the loop not considering new filters:
$ yes | split --filter="head -c1 >/dev/null" -b 100000
Similarly processing would exit early for a bounded number of
output files, resulting in empty data sent to all but the first:
$ truncate -s10T big.in
$ split --filter='head -c1 >$FILE' -n 2 big.in
$ echo $(stat -c%s x??)
1 0
I was alerted to this code by clang-analyzer,
which indicated dead assigments, which is often
an indication of code that hasn't considered all cases.
* src/split.c (bytes_split): Change the last condition in
the processing loop to also consider the number of files
before breaking out of the processing loop.
* tests/split/filter.sh: Add a test case.
* NEWS: Mention the bug fix.
2017-03-26 15:20:23 -07:00
..
2016-11-22 20:04:24 +00:00
2016-11-22 20:04:24 +00:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-02-22 20:23:31 -08:00
2017-02-22 20:23:31 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2008-11-20 10:21:52 +01:00
2017-02-22 20:23:31 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-20 18:24:54 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-21 16:05:58 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-09 15:15:04 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-03-01 09:25:28 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2005-07-18 07:52:37 +00:00
2015-01-31 17:39:04 +01:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-02-12 18:05:37 -08:00
2017-02-12 18:05:37 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-09 15:15:04 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2003-07-06 06:08:40 +00:00
2017-03-03 00:23:56 -08:00
2017-01-01 22:38:02 +00:00
2017-02-11 23:14:02 -08:00
2017-03-07 21:34:06 -08:00
2017-01-01 22:38:02 +00:00
2017-03-08 23:02:06 -08:00
2017-01-14 23:59:01 -08:00
2012-01-09 21:51:59 +01:00
2017-01-01 22:38:02 +00:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-14 23:59:01 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-03-26 15:20:23 -07:00
2017-03-08 17:55:09 -08:00
2017-01-01 22:38:02 +00:00
2017-02-28 19:26:04 -08:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-02-16 00:40:50 -08:00
2017-02-16 00:40:50 -08:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-03-03 00:30:20 -08:00
2017-01-09 15:15:04 -08:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2007-07-10 19:00:00 +02:00
2007-07-10 19:00:00 +02:00
2017-01-01 22:38:02 +00:00
2012-01-09 21:51:59 +01:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-02-16 00:40:50 -08:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00
2017-01-01 22:38:02 +00:00