Debian Codegraph @

tests/glibc-infloop

raw
1 #!/bin/sh
2 # This would infloop when using glibc's regex at least until glibc-2.36.
3 . "${srcdir=.}/init.sh"; path_prepend_ ../src
4
5 require_timeout_
6 require_en_utf8_locale_
7
8 fail=0
9
10 cat <<\EOF > glibc-check.c
11 #include <features.h>
12 #ifdef __GLIBC__
13 int ok;
14 #else
15 # error "not glibc"
16 #endif
17 EOF
18 $CC -c glibc-check.c && glibc=1 || glibc=0
19
20 grep '^#define USE_INCLUDED_REGEX 1' "$CONFIG_HEADER" \
21 && included_regex=1 || included_regex=0
22
23 case $glibc:$included_regex in
24 0:0) skip_ 'runs only with glibc or when built with the included regex'
25 esac
26
27 echo a > in || framework_failure_
28 timeout 2 env LC_ALL=en_US.UTF-8 grep -E -w '((()|a)|())*' in || fail=1
29
30 Exit $fail