aboutsummaryrefslogtreecommitdiff
path: root/tests/sed.test
AgeCommit message (Collapse)Author
2019-05-26Teach sed about +N range ending.Rob Landley
2019-05-06Greatly simplify and speed up regexec0() using REG_STARTEND.Rob Landley
This is a 15 year old freebsd extension (presumably thus also available on MacOS) that glibc adopted in 2004, uClibc adopted in 2005, and bionic supports. The only thing that DOESN'T support it is musl, once again because its maintainer explicitly decided not to (https://www.openwall.com/lists/musl/2013/01/15/26), so add an #ifdef to let musl stay uniquely broken. (It'll stop at first NUL, everything else can match NULs). Finally fixes "s/x/y/g on a megabyte line of x's takes forever" issue.
2019-02-13sed: fix endless loop in "b loop" test.Elliott Hughes
Very few places actually check for errors from emit, and I actually see the same endless loop from "sed (GNU sed) 4.4" on current Debian, so I'm not sure this isn't Broken As Designed, but an endless loop spewing "short write" (or saying nothing, in the case of GNU sed) really doesn't feel like useful behavior in face of EPIPE, which really isn't going to fix itself. Certainly not being able to run the sed tests to completion is pretty annoying --- which is why, unless we remove this test as invalid, we should probably also add a SKIP_HOST=1 to the "b loop" test. Note that even with this fix you'll see the error twice: sed: short write: Broken pipe sed: short write: Broken pipe Once from the first = command to fail, and then another from the !FLAG(n) flush of the pattern space.
2019-02-12sed: fix substitution of empty capturing groups.Elliott Hughes
The test for \N where N was larger than the number of capturing groups in the regular expression was incorrect, and firing for cases such as matching __(ARM_)?NR_([a-z]*) against __NR_read, where the first group is empty (because it failed to match) but the second group did match "read". Use regex_t's re_nsub for the error check, and treat rm_so == -1 as a signal to just copy nothing into the result. (Found trying to build minijail in AOSP.)
2019-01-12sed: add -z.Elliott Hughes
Used to construct SELinux policies in the AOSP build. I left loopfiles_lines with its hard-coded '\n' because although cut(1) also has a -z option, I can't find any case where it's used in any of the codebases searchable by me. (And fmt(1), the other user, doesn't even have the option.) YAGNI. Bug: http://b/122744241
2019-01-11Fix b ending with }Rob Landley
For a definition of "fix" that's even _more_ of a deviation from posix, but matches what debian does...
2019-01-11sed: add test for AOSP build breakage.Elliott Hughes
Bug: http://b/122744241
2016-10-17A few more sed tests.Rob Landley
2016-09-06Teach sed s/// how to handle [:space:] type sequences.Rob Landley
Or more accurately, s@[[:space:]@]@replace@ which can't treat the @ in [] as a delimiter but has to know about nested [[]] to make that decision.
2016-07-21Common test infrastructure says command name, don't have sed.tests say 'sed sed'Rob Landley
2016-04-11sed -f - should read from stdin.Rob Landley
2016-03-24Debian bug 635570 did something horribly nonstandard (depending on a sideRob Landley
effect of "sed -e 'a\'" with no trailing line). But there's an actual user, and it's not hard to implement, and it's not hard to implement, and there isn't an obvious _other_ way to do it, so add the behavior and a test for it. Fix some bad/missing comments while I was there, and add a couple TODOs.
2016-03-17Fix bug where all tests aren't being run with 'make test'.Andy Chu
The tests/*.test files shouldn't explicitly exit, because they are sourced in scripts/test.sh. No tests after sed were being run.
2016-03-10Fix segfault in sed -e 'c\'.Andy Chu
Found by afl-fuzz.
2016-03-02Factor out command name at the start of test name, have runtest.sh print it.Rob Landley
2016-02-17The perl build's attempt to escape spaces and such in LD_LIBRARY_PATH is _SAD_.Rob Landley
It uses a sed expression that assumes you can escape - to use it as a literal (you can't, it has to be first or last char of the range), and assumes you have to escape delimiters in sed [] context (you don't), and/or that non-printf escapes become the literal character (they don't, the backslash is preserved as a literal), meaning it winds up doing "s/[\-\]//" which is a length 1 range, which is officially undefined behavior according to posix, and regcomp errors out. But if we don't accept it (like other implementations do) the perl build breaks. So collapse [A-A] into just [A]. Testcae taken from perl 5.22.0 file Makefile.SH line 8. (While we're at it, remove an unused argument from a function.)
2016-01-21Add a sed test from the posix mailing list.Rob Landley
2015-12-04Replace duplicate sed test with case we hadn't covered yet.Rob Landley
2015-11-05Fix sed bug where any ] right after [ was skipped, not just first one in range.Rob Landley
2015-10-29Fix sed bug reported by Isabella Parakiss, where sed -e "/x/c\" -e "y" addedRob Landley
an extra newline because the test for whether we have an existing string to append a newline to was checking if struct step had data appended to it, and the /x/ regex is data appended to it. Change test to check for null terminator at ->arg1 offset.
2015-05-12Set the executable bits on all the *.test files. (Wasn't consistent, is now.)Rob Landley
2015-03-28Fix sed bug David Halls hit trying to compile libiconv.Rob Landley
2014-12-21Another sed bug. (The e2fsprogs build uses multiple line continuations on ↵Rob Landley
the same command.)
2014-12-14Make sed a\ line continuations work properly for different pattern input modes.Rob Landley
2014-11-27sed: c needs to trigger range logic like d, D works like d when there isn't ↵Rob Landley
anything left in the line, and more tests.
2014-11-15Debugging pass on sed: make the existing test suite pass.Rob Landley
2014-11-14Add a few more sed tests.Rob Landley
2014-11-09Yet more sed tests.Rob Landley
2014-11-06More sed tests.Rob Landley
2014-10-29First batch of sed tests.Rob Landley
Only good for TEST_HOST=1 at the moment because the test infrastructure itself depends on sed, so if an unfinished sed is in the $PATH it goes boing. But hey, corner cases! I have... more.