[PATCH 0/1] Bug: "cut -s" incorrectly prints empty lines
Colin McAllister
colinmca242 at gmail.com
Wed Jul 17 21:33:34 UTC 2024
I recently found a bug with the cut provided by Busybox where a command
like "cut -s -d ' ' -f 2" will still print blank lines. This deviates
from the output produced by Coreutils cut.
Coreutils:
```
$ echo -e "\n\nfoo bar baz\n\na simple example\n\n" | cut -s -d ' ' -f 2
bar
simple
```
Busybox:
```
$ echo -e "\n\nfoo bar baz\n\na simple example\n\n" | busybox cut -s -d ' ' -f 2
bar
simple
```
This appears to be a regression in Busybox that was introduced by
0068ce2fa: cut: add toybox-compatible options -O OUTSEP, -D, -F LIST
I've included a patch that will fix this issue without introducing
any other issues. I've verified that all cut tests pass and also added a
new test that fails on the tip of master, without my change, and passes
with my change.
Please let me know if my solution is deemed acceptable.
Thank you,
Colin McAllister
Colin McAllister (1):
cut: Fix "-s" flag to omit blank lines
coreutils/cut.c | 6 ++++++
testsuite/cut.tests | 9 +++++++++
2 files changed, 15 insertions(+)
--
2.34.1
More information about the busybox
mailing list