NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/55527: incorrect output when -k is used and there are more patterns than matches
>Number: 55527
>Category: bin
>Synopsis: incorrect output when -k is used and there are more patterns than matches
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 31 16:35:00 +0000 2020
>Originator: silas_netbsd_gnats%nocafe.net@localhost
>Release: NetBSD 8.2
>Organization:
>Environment:
>Description:
When csplit -k flag (which does not remove created files) and there are more
patterns than matches for a file, the file created before the last one has
incorrect output.
Although I'm using NetBSD 8.2, I tested CVS version (1.7) and the behaviour is
the same.
>How-To-Repeat:
cd /tmp
echo '
a:
b:
c:
d:' > test
csplit -k test '/.*:/' '{999}'
# File xx03 should have "c:" but it has "c:\nd:"
>Fix:
The following patch fix that, but I'm not familiar enough with the codebase to
be sure it doesn't break in other situation.
--- csplit.c.orig 2020-07-31 12:29:24.234981477 -0300
+++ csplit.c 2020-07-31 12:33:11.423349708 -0300
@@ -410,8 +410,10 @@
first = 0;
}
- if (p == NULL)
+ if (p == NULL) {
+ toomuch(ofp, 1);
errx(1, "%s: no match", re);
+ }
if (ofs <= 0) {
/*
Home |
Main Index |
Thread Index |
Old Index