-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test-regex: Add a test to check for a bug in the regex routines
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
- Loading branch information
Ramsay Jones
authored and
Junio C Hamano
committed
Sep 3, 2012
1 parent
d0f1ea6
commit c918415
Showing
4 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <git-compat-util.h> | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
char *pat = "[^={} \t]+"; | ||
char *str = "={}\nfred"; | ||
regex_t r; | ||
regmatch_t m[1]; | ||
|
||
if (regcomp(&r, pat, REG_EXTENDED | REG_NEWLINE)) | ||
die("failed regcomp() for pattern '%s'", pat); | ||
if (regexec(&r, str, 1, m, 0)) | ||
die("no match of pattern '%s' to string '%s'", pat, str); | ||
|
||
/* http://sourceware.org/bugzilla/show_bug.cgi?id=3957 */ | ||
if (m[0].rm_so == 3) /* matches '\n' when it should not */ | ||
die("regex bug confirmed: re-build git with NO_REGEX=1"); | ||
|
||
exit(0); | ||
} |