view sources/patches/musl-regex.patch @ 1786:0787ceb820bf draft 1.4.2

When x86-64 switched on NPTL in uClibc, distcc broke, and it turns out fully native compiles under qemu never worked due to qemu not quite emulating floating point right and confusing the perl build with zero not comparing equal to zero. As long as it's broken anyway, switch it over to musl and fix it up on that side. It's no longer worth trying to fix anything broken in uClibc, the project is dead. (I'm aware of uClibc-ng, and am treating it exactly the same way I treated the ecommstation reboot of OS/2.)
author Rob Landley <rob@landley.net>
date Fri, 11 Sep 2015 13:25:14 -0500
parents 9b4251fda364
children
line wrap: on
line source

diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
index 978dd87..d7e7a9c 100644
--- a/src/regex/regcomp.c
+++ b/src/regex/regcomp.c
@@ -1008,13 +1008,18 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx)
 		nbranch = tre_ast_new_catenation(ctx->mem, nbranch, ctx->n);
 		if ((ere && *s == '|') ||
 		    (ere && *s == ')' && depth) ||
-		    (!ere && *s == '\\' && s[1] == ')') ||
+		    (!ere && *s == '\\' && (s[1] == ')' || s[1] == '|')) ||
 		    !*s) {
 			/* extension: empty branch is unspecified (), (|a), (a|)
 			   here they are not rejected but match on empty string */
 			int c = *s;
 			nunion = tre_ast_new_union(ctx->mem, nunion, nbranch);
 			nbranch = 0;
+
+			if (c == '\\' && s[1] == '|') {
+				s++;
+				c = '|';
+			}
 			if (c != '|') {
 				if (c == '\\') {
 					if (!depth) return REG_EPAREN;