xref: /openbsd/gnu/usr.bin/perl/t/lib/warnings/regexec (revision 9e6efb0a)
1  regexec.c
2
3  This test generates "bad free" warnings when run under
4  PERL_DESTRUCT_LEVEL.  This file merely serves as a placeholder
5  for investigation.
6
7  Complex regular subexpression recursion limit (%d) exceeded
8
9        $_ = 'a' x (2**15+1); /^()(a\1)*$/ ;
10  Complex regular subexpression recursion limit (%d) exceeded
11
12        $_ = 'a' x (2**15+1); /^()(a\1)*?$/ ;
13
14  (The actual value substituted for %d is masked in the tests so that
15  REG_INFTY configuration variable value does not affect outcome.)
16__END__
17# regexec.c
18print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
19use warnings 'regexp' ;
20$SIG{__WARN__} = sub{local ($m) = shift;
21                 $m =~ s/\(\d+\)/(*MASKED*)/;
22                 print STDERR $m};
23$_ = 'a' x (2**15+1);
24/^()(a\1)*$/ ;
25#
26# If this test fails with a segmentation violation or similar,
27# you may have to increase the default stacksize limit in your
28# shell.  You may need superuser privileges.
29#
30# Under the sh, ksh, zsh:
31#    $ ulimit -s
32#    8192
33#    $ ulimit -s 16000
34#
35# Under the csh:
36#    % limit stacksize
37#    stacksize        8192 kbytes
38#    % limit stacksize 16000
39#
40EXPECT
41Complex regular subexpression recursion limit (*MASKED*) exceeded at - line 9.
42########
43# regexec.c
44print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
45no warnings 'regexp' ;
46$SIG{__WARN__} = sub{local ($m) = shift;
47                 $m =~ s/\(\d+\)/(*MASKED*)/;
48                 print STDERR $m};
49$_ = 'a' x (2**15+1);
50/^()(a\1)*$/ ;
51#
52# If this test fails with a segmentation violation or similar,
53# you may have to increase the default stacksize limit in your
54# shell.  You may need superuser privileges.
55#
56# Under the sh, ksh, zsh:
57#    $ ulimit -s
58#    8192
59#    $ ulimit -s 16000
60#
61# Under the csh:
62#    % limit stacksize
63#    stacksize        8192 kbytes
64#    % limit stacksize 16000
65#
66EXPECT
67
68########
69# regexec.c
70print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
71use warnings 'regexp' ;
72$SIG{__WARN__} = sub{local ($m) = shift;
73                 $m =~ s/\(\d+\)/(*MASKED*)/;
74                 print STDERR $m};
75$_ = 'a' x (2**15+1);
76/^()(a\1)*?$/ ;
77#
78# If this test fails with a segmentation violation or similar,
79# you may have to increase the default stacksize limit in your
80# shell.  You may need superuser privileges.
81#
82# Under the sh, ksh, zsh:
83#    $ ulimit -s
84#    8192
85#    $ ulimit -s 16000
86#
87# Under the csh:
88#    % limit stacksize
89#    stacksize        8192 kbytes
90#    % limit stacksize 16000
91#
92EXPECT
93Complex regular subexpression recursion limit (*MASKED*) exceeded at - line 9.
94########
95# regexec.c
96print("SKIPPED\n# most systems run into stacksize limits\n"),exit;
97no warnings 'regexp' ;
98$SIG{__WARN__} = sub{local ($m) = shift;
99                 $m =~ s/\(\d+\)/(*MASKED*)/;
100                 print STDERR $m};
101$_ = 'a' x (2**15+1);
102/^()(a\1)*?$/ ;
103#
104# If this test fails with a segmentation violation or similar,
105# you may have to increase the default stacksize limit in your
106# shell.  You may need superuser privileges.
107#
108# Under the sh, ksh, zsh:
109#    $ ulimit -s
110#    8192
111#    $ ulimit -s 16000
112#
113# Under the csh:
114#    % limit stacksize
115#    stacksize        8192 kbytes
116#    % limit stacksize 16000
117#
118EXPECT
119
120########
121# NAME Wide character in non-UTF-8 locale
122require '../loc_tools.pl';
123unless (locales_enabled('LC_CTYPE')) {
124    print("SKIPPED\n# locales not available\n"),exit;
125}
126eval { require POSIX; POSIX->import("locale_h") };
127if ($@) {
128    print("SKIPPED\n# no POSIX\n"),exit;
129}
130use warnings 'locale';
131use locale;
132setlocale(&POSIX::LC_CTYPE, "C");
133"\x{100}" =~ /\x{100}|\x{101}/il;
134"\x{100}" =~ /\x{100}|\x{101}/l;
135"\x{100}" =~ /\w/l;
136"\x{100}" =~ /\x{100}+/l;
137"\x{100}" =~ /[\x{100}\x{102}]/l;
138no warnings 'locale';
139EXPECT
140Wide character (U+100) in pattern match (m//) at - line 12.
141Wide character (U+100) in pattern match (m//) at - line 12.
142Wide character (U+100) in pattern match (m//) at - line 13.
143Wide character (U+100) in pattern match (m//) at - line 13.
144Wide character (U+100) in pattern match (m//) at - line 13.
145Wide character (U+100) in pattern match (m//) at - line 14.
146Wide character (U+100) in pattern match (m//) at - line 14.
147Wide character (U+100) in pattern match (m//) at - line 15.
148Wide character (U+100) in pattern match (m//) at - line 16.
149Wide character (U+100) in pattern match (m//) at - line 16.
150########
151# NAME Wide character in UTF-8 locale
152require '../loc_tools.pl';
153unless (locales_enabled('LC_CTYPE')) {
154    print("SKIPPED\n# locales not available\n"),exit;
155}
156eval { require POSIX; POSIX->import("locale_h") };
157if ($@) {
158    print("SKIPPED\n# no POSIX\n"),exit;
159}
160my @utf8_locales = find_utf8_ctype_locale();
161unless (@utf8_locales) {
162    print("SKIPPED\n# no UTF-8 locales\n"),exit;
163}
164use warnings 'locale';
165use locale;
166setlocale(&POSIX::LC_CTYPE, $utf8_locales[0]);
167"\x{100}" =~ /\x{100}|\x{101}/il;
168"\x{100}" =~ /\x{100}|\x{101}/l;
169"\x{100}" =~ /\w/l;
170"\x{100}" =~ /\x{100}+/l;
171"\x{100}" =~ /[\x{100}\x{102}]/l;
172EXPECT
173########
174# NAME \b{} in non-UTF-8 locale
175require '../loc_tools.pl';
176unless (locales_enabled('LC_CTYPE')) {
177    print("SKIPPED\n# locales not available\n"),exit;
178}
179eval { require POSIX; POSIX->import("locale_h") };
180if ($@) {
181    print("SKIPPED\n# no POSIX\n"),exit;
182}
183use warnings 'locale';
184use locale;
185setlocale(&POSIX::LC_CTYPE, "C");
186"a" =~ /\b{gcb}/l;
187no warnings 'locale';
188"a" =~ /\b{gcb}/l;
189EXPECT
190Use of \b{} or \B{} for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 12.
191Use of \b{} or \B{} for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 12.
192########
193# NAME \b{} in UTF-8 locale
194require '../loc_tools.pl';
195unless (locales_enabled('LC_CTYPE')) {
196    print("SKIPPED\n# locales not available\n"),exit;
197}
198eval { require POSIX; POSIX->import("locale_h") };
199if ($@) {
200    print("SKIPPED\n# no POSIX\n"),exit;
201}
202my $utf8_locale = find_utf8_ctype_locale();
203unless ($utf8_locale) {
204    print("SKIPPED\n# No UTF-8 locale available\n"),exit;
205}
206use warnings 'locale';
207use locale;
208setlocale(&POSIX::LC_CTYPE, "C");
209 "abc def" =~ /\b{wb}.*?/;
210 "abc def" =~ /\B{wb}.*?/;
211setlocale(&POSIX::LC_CTYPE, $utf8_locale);
212 "abc def" =~ /\b{wb}.*?/;
213 "abc def" =~ /\B{wb}.*?/;
214EXPECT
215OPTION regex
216\AUse of \\b\{\} or \\B\{\} for non-UTF-8 locale is wrong\.  Assuming a UTF-8 locale at - line 16\.
217Use of \\b\{\} or \\B\{\} for non-UTF-8 locale is wrong\.  Assuming a UTF-8 locale at - line 16\.
218Use of \\b\{\} or \\B\{\} for non-UTF-8 locale is wrong\.  Assuming a UTF-8 locale at - line 17\.
219Use of \\b\{\} or \\B\{\} for non-UTF-8 locale is wrong\.  Assuming a UTF-8 locale at - line 17\.
220Use of \\b\{\} or \\B\{\} for non-UTF-8 locale is wrong\.  Assuming a UTF-8 locale at - line 17\.(?:
221Locale '.*' contains \(at least\) the following characters which have
222unexpected meanings: .*
223The Perl program will use the expected meanings; codeset=UTF-8)?\z
224########
225# NAME (?[ ]) in non-UTF-8 locale
226require '../loc_tools.pl';
227unless (locales_enabled('LC_CTYPE')) {
228    print("SKIPPED\n# locales not available\n"),exit;
229}
230eval { require POSIX; POSIX->import("locale_h") };
231if ($@) {
232    print("SKIPPED\n# no POSIX\n"),exit;
233}
234use warnings 'locale';
235use locale;
236setlocale(&POSIX::LC_CTYPE, "C");
237"\N{KELVIN SIGN}" =~ /(?[ \N{KELVIN SIGN} ])/i;
238"K" =~ /(?[ \N{KELVIN SIGN} ])/i;
239"k" =~ /(?[ \N{KELVIN SIGN} ])/i;
240":" =~ /(?[ \: ])/;
241no warnings 'locale';
242EXPECT
243Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 12.
244Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 12.
245Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 13.
246Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 13.
247Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 14.
248Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 14.
249Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 15.
250Use of (?[ ]) for non-UTF-8 locale is wrong.  Assuming a UTF-8 locale at - line 15.
251########
252# NAME (?[ ]) in UTF-8 locale
253require '../loc_tools.pl';
254unless (locales_enabled('LC_CTYPE')) {
255    print("SKIPPED\n# locales not available\n"),exit;
256}
257eval { require POSIX; POSIX->import("locale_h") };
258if ($@) {
259    print("SKIPPED\n# no POSIX\n"),exit;
260}
261my $utf8_locale = find_utf8_ctype_locale();
262unless ($utf8_locale) {
263    print("SKIPPED\n# No UTF-8 locale available\n"),exit;
264}
265use warnings 'locale';
266use locale;
267setlocale(&POSIX::LC_CTYPE, $utf8_locale);
268"\N{KELVIN SIGN}" =~ /(?[ \N{KELVIN SIGN} ])/i;
269"K" =~ /(?[ \N{KELVIN SIGN} ])/i;
270"k" =~ /(?[ \N{KELVIN SIGN} ])/i;
271":" =~ /(?[ \: ])/;
272EXPECT
273