Project

General

Profile

Bug #6901

Updated by Garrett D'Amore over 4 years ago

From FreeBSD:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207681

It looks like we could support multibyte regexec. I believe this has been broken since the days of illumos - in particular bug #2 introduced the file in question:

usr/src/lib/libc/port/local/regexec.c -- which was borrowed from FreeBSD.

Here's the actual diff from FreeBSD:

```
<pre>

Index: lib/libc/regex/regex.3
===================================================================
--- lib/libc/regex/regex.3 (revision 286580)
+++ lib/libc/regex/regex.3 (working copy)
@@ -723,5 +723,3 @@
.Pp
The implementation of word-boundary matching is a bit of a kludge,
and bugs may lurk in combinations of word-boundary matching and anchoring.
-.Pp
-Word-boundary matching does not work properly in multibyte locales.
Index: lib/libc/regex/regexec.c
===================================================================
--- lib/libc/regex/regexec.c (revision 286580)
+++ lib/libc/regex/regexec.c (working copy)
@@ -116,9 +116,9 @@
#define FWD(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) << (n))
#define BACK(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) >> (n))
#define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
-/* no multibyte support */
-#define XMBRTOWC xmbrtowc_dummy
-#define ZAPSTATE(mbs) ((void)(mbs))
+/* multibyte support */
+#define XMBRTOWC xmbrtowc
+#define ZAPSTATE(mbs) memset((mbs), 0, sizeof(*(mbs)))
/* function names */
#define SNAMES /* engine.c looks after details */

@@ -170,9 +170,9 @@
#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
#define ISSETBACK(v, n) ((v)[here - (n)])
-/* no multibyte support */
-#define XMBRTOWC xmbrtowc_dummy
-#define ZAPSTATE(mbs) ((void)(mbs))
+/* multibyte support */
+#define XMBRTOWC xmbrtowc
+#define ZAPSTATE(mbs) memset((mbs), 0, sizeof(*(mbs)))
/* function names */
#define LNAMES /* flag */
</pre>


```
Some research needs to be done here.

Back