From 5b0996fd80c6f2e5844dc42be2a0368ea3ff9e12 Mon Sep 17 00:00:00 2001 From: Michael Steed Date: Sun, 21 Feb 2016 14:59:03 -0700 Subject: make fish compatible with pcre2 10.21 pcre2_substitute() now sets the output buffer length to PCRE2_UNSET (~0) if the output buffer is determined to be too small. This change keeps track of the buffer size separately where pcre2 can't touch it. A better fix would be to let pcre2 tell fish what size buffer it needs. This can be done with PCRE2_SUBSTITUTE_OVERFLOW_LENGTH, but this requires pcre2 10.21 or later (released January 12), which may be too new to introduce as a dependency at this point. Fixes #2743 --- tests/string.in | 2 ++ tests/string.out | 1 + 2 files changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/string.in b/tests/string.in index 1c78e2b3..8afc97ff 100644 --- a/tests/string.in +++ b/tests/string.in @@ -55,6 +55,8 @@ string replace -r '(\w+)\s+(\w+)' '$2 $1 $$' 'left right' string replace -r '\s*newline\s*' '\n' 'put a newline here' +string replace -r -a '(\w)' '$1$1' ab + # test some failure cases string match -r '[' 'a[sd' 2>/dev/null; or echo "invalid expression error" diff --git a/tests/string.out b/tests/string.out index 64b956e3..45ccb369 100644 --- a/tests/string.out +++ b/tests/string.out @@ -41,6 +41,7 @@ spaces_to_underscores right left $ put a here +aabb invalid expression error invalid argument error missing argument returns 0 -- cgit v1.2.3