[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Test for regex module hangs
From: |
Eric Blake |
Subject: |
Re: Test for regex module hangs |
Date: |
Thu, 31 Jan 2013 16:08:05 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 |
On 01/31/2013 03:54 PM, Eric Blake wrote:
> On 01/31/2013 03:13 PM, Reuben Thomas wrote:
>> By the way, until this bug is fixed, a reasonable workaround is to pass
>> --with-included-regex to configure.
>>
>>
>> On 30 January 2013 13:50, Reuben Thomas <address@hidden> wrote:
>>
>>> When running the test for working re_compile_pattern, I get a hang;
>>> attaching to the process gives me:
>>>
>>> (gdb) where
>>> #0 __lll_lock_wait_private () at
>>> ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:93
>>> #1 0x00002ab6dd5c6221 in _L_lock_10625 () at malloc.c:5209
>
> I was able to reproduce the hang in an Ubuntu VM, although I could not
> reproduce it using Fedora 16 with glibc 1.14.90. At any rate, it's easy
2.14.90
> enough to fix; I'll add an alarm() handler to the m4 test (same as we
> have done for other tests that hang).
Here it is:
From a0b25daf001cb1a0352f329e2b5e1640acc88541 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 31 Jan 2013 15:57:38 -0700
Subject: [PATCH] regex: avoid infinite configure test
At least glibc 2.15 on Ubuntu ended up hanging.
* m4/regex.m4 (gl_REGEX): Add an alarm escape hatch.
Reported by Reuben Thomas.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 5 +++++
m4/regex.m4 | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index c18cbad..74dad7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-31 Eric Blake <address@hidden>
+
+ regex: avoid infinite configure test
+ * m4/regex.m4 (gl_REGEX): Add an alarm escape hatch.
+
2013-01-31 Reuben Thomas <address@hidden>
openpty: fix bug where HAVE_OPENPTY wasn't defined
diff --git a/m4/regex.m4 b/m4/regex.m4
index 2f5bd09..944dfaf 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,4 +1,4 @@
-# serial 62
+# serial 63
# Copyright (C) 1996-2001, 2003-2013 Free Software Foundation, Inc.
#
@@ -27,6 +27,7 @@ AC_DEFUN([gl_REGEX],
# following run test, then default to *not* using the included regex.c.
# If cross compiling, assume the test would fail and use the included
# regex.c.
+ AC_CHECK_FUNCS_ONCE([alarm])
AC_CACHE_CHECK([for working re_compile_pattern],
[gl_cv_func_re_compile_pattern_working],
[AC_RUN_IFELSE(
@@ -35,6 +36,10 @@ AC_DEFUN([gl_REGEX],
#include <locale.h>
#include <limits.h>
#include <regex.h>
+ #if HAVE_ALARM
+ # include <unistd.h>
+ # include <signal.h>
+ #endif
]],
[[int result = 0;
static struct re_pattern_buffer regex;
@@ -43,6 +48,11 @@ AC_DEFUN([gl_REGEX],
const char *s;
struct re_registers regs;
+#if HAVE_ALARM
+ /* Some builds of glibc go into an infinite loop on this
test. */
+ signal (SIGALRM, SIG_DFL);
+ alarm (2);
+#endif
if (setlocale (LC_ALL, "en_US.UTF-8"))
{
{
--
1.8.1
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature