regex library fails git tests

Mark Levedahl
Sat Jul 20 21:26:00 GMT 2013

Current git fails two sets of tests on cygwin due apparently to problems 
in the regex library. One set of tests does language based 
word-matching, and has a common failure during regex compilation. The 
suffix clause ("|[^[:space:]]|[\xc0-\xff][\x80-\xbf]+") is common to all 
of these, removing that clause eliminates the regcomp failure.

A test case extracted from the git sources is below - this works 
correctly on Fedora 18, fails on Cygwin:

$ gcc test-regex.c
$ ./a.out
failed regcomp() for pattern '[^<>=     ]+|[^[:space:]]|[â–’-â–’][â–’-â–’]+'

The failure disappears when the suffix clause is removed from pat_html.

This is happening on a current installation:
$ uname -a
CYGWIN_NT-5.1 virt-winxp 1.7.21(0.267/5/3) 2013-07-15 12:17 i686 Cygwin
$ cygcheck -c gcc-core gcc-g++
Cygwin Package Information
Package              Version        Status
gcc-core             4.7.3-1        OK
gcc-g++              4.7.3-1        OK


#include <regex.h>
#include <stdio.h>

int main(int argc, char **argv)
	char *pat_html = "[^<>= \t]+"
	char *str = "={}\nfred";
	regex_t r;
	regmatch_t m[1];

	if (regcomp(&r, pat_html, REG_EXTENDED | REG_NEWLINE)) {
		printf("failed regcomp() for pattern '%s'\n", pat_html);
		return 1;
	if (regexec(&r, str, 1, m, 0)) {
		printf("no match of pattern '%s' to string '%s'\n",
			   pat_html, str);
		return 1;
	return 0;


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list