g_regex_match fails on multiple archs (including x86_64) with Fedora glib2-2.73.2-4.fc37
From: https://bugzilla.redhat.com/show_bug.cgi?id=2109187
The following code fails with Fedora glib2-2.73.2-4.fc37 even on x86_64, while with glib2-2.72.3-1.fc36 this is okay.
#undef G_DISABLE_ASSERT
#include <glib.h>
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
static const char xrandr_output2[] =
"Screen 0: minimum 1 x 1, current 3840 x 1080, maximum 8192 x 8192\n\
Virtual1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm\n\
1920x1080 60.00*+ 59.96 \n\
3840x2400 59.97 \n\
3840x2160 59.97 \n\
2880x1800 59.95 \n\
2560x1600 59.99 \n\
2560x1440 59.95 \n\
1920x1440 60.00 \n\
1856x1392 60.00 \n\
1792x1344 60.00 \n\
1920x1200 59.88 \n\
1600x1200 60.00 \n\
1680x1050 59.95 \n\
1400x1050 59.98 \n\
1280x1024 60.02 \n\
1440x900 59.89 \n\
1280x960 60.00 \n\
1360x768 60.02 \n\
1280x800 59.81 \n\
1152x864 75.00 \n\
1280x768 59.87 \n\
1280x720 59.86 \n\
1024x768 60.00 \n\
800x600 60.32 \n\
640x480 59.94 \n\
Virtual2 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 0mm x 0mm\n\
1920x1080 60.00*+ 59.96 \n\
3840x2400 59.97 \n\
3840x2160 59.97 \n\
2880x1800 59.95 \n\
2560x1600 59.99 \n\
2560x1440 59.95 \n\
1920x1440 60.00 \n\
1856x1392 60.00 \n\
1792x1344 60.00 \n\
1920x1200 59.88 \n\
1600x1200 60.00 \n\
1680x1050 59.95 \n\
1400x1050 59.98 \n\
1280x1024 60.02 \n\
1440x900 59.89 \n\
1280x960 60.00 \n\
1360x768 60.02 \n\
1280x800 59.81 \n\
1152x864 75.00 \n\
1280x768 59.87 \n\
1280x720 59.86 \n\
1024x768 60.00 \n\
800x600 60.32 \n\
640x480 59.94 \n\
Virtual3 disconnected (normal left inverted right x axis y axis)\n\
Virtual4 disconnected (normal left inverted right x axis y axis)\n\
Virtual5 disconnected (normal left inverted right x axis y axis)\n\
Virtual6 disconnected (normal left inverted right x axis y axis)\n\
Virtual7 disconnected (normal left inverted right x axis y axis)\n\
Virtual8 disconnected (normal left inverted right x axis y axis)\n\
";
#if 0
static const char pattern[] =
"\n([-\\.a-zA-Z]+[-\\.0-9]*) +connected ([^(\n ]*)[^\n]*"
"((\n +[0-9]+x[0-9]+[^\n]+)+)";
#else
static const char pattern[] =
"\n([\\-\\.a-zA-Z]+[\\-\\.0-9]*) +connected ([^(\n ]*)[^\n]*"
"((\n +[0-9]+x[0-9]+[^\n]+)+)";
#endif
int main(void) {
setlocale(LC_ALL, "C");
GError *error;
error = NULL;
GRegex *regex = g_regex_new(pattern, 0, 0, &error);
g_assert_nonnull(regex);
error = NULL;
GMatchInfo *match_info = NULL;
gboolean match_ok = g_regex_match(regex, xrandr_output2, 0, &match_info);
g_assert(match_ok);
g_match_info_free(match_info);
g_regex_unref(regex);
return 0;
}
With glib2-2.73.2-4.fc37 x86_64:
ERROR:/builddir/build/SOURCES/g_regex_test_2.c:91:main: assertion failed: (match_ok)