Commit | Line | Data |
---|---|---|
8ebc5c01 | 1 | #!./perl -wT |
2 | ||
e3a2734b KW |
3 | binmode STDOUT, ':utf8'; |
4 | binmode STDERR, ':utf8'; | |
5 | ||
8ebc5c01 | 6 | BEGIN { |
7 | chdir 't' if -d 't'; | |
20822f61 | 8 | @INC = '../lib'; |
f9cbebe1 | 9 | unshift @INC, '.'; |
b002077a | 10 | require Config; import Config; |
97a0514d | 11 | if (!$Config{d_setlocale} || $Config{ccflags} =~ /\bD?NO_LOCALE\b/) { |
b002077a CS |
12 | print "1..0\n"; |
13 | exit; | |
14 | } | |
2de3dbcc | 15 | $| = 1; |
8ebc5c01 | 16 | } |
17 | ||
18 | use strict; | |
19 | ||
284102e8 JH |
20 | my $debug = 1; |
21 | ||
db4b7445 A |
22 | use Dumpvalue; |
23 | ||
24 | my $dumper = Dumpvalue->new( | |
25 | tick => qq{"}, | |
26 | quoteHighBit => 0, | |
27 | unctrl => "quote" | |
28 | ); | |
6be75cd7 | 29 | sub debug { |
db4b7445 A |
30 | return unless $debug; |
31 | my($mess) = join "", @_; | |
32 | chop $mess; | |
33 | print $dumper->stringify($mess,1), "\n"; | |
6be75cd7 JH |
34 | } |
35 | ||
36 | sub debugf { | |
37 | printf @_ if $debug; | |
38 | } | |
39 | ||
8ebc5c01 | 40 | my $have_setlocale = 0; |
41 | eval { | |
42 | require POSIX; | |
43 | import POSIX ':locale_h'; | |
44 | $have_setlocale++; | |
45 | }; | |
46 | ||
6dead956 | 47 | # Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1" |
f6c6487a | 48 | # and mingw32 uses said silly CRT |
3a2d1764 SH |
49 | # This doesn't seem to be an issue any more, at least on Windows XP, |
50 | # so re-enable the tests for Windows XP onwards. | |
51 | my $winxp = ($^O eq 'MSWin32' && defined &Win32::GetOSVersion && | |
52 | join('.', (Win32::GetOSVersion())[1..2]) >= 5.1); | |
53 | $have_setlocale = 0 if ((($^O eq 'MSWin32' && !$winxp) || $^O eq 'NetWare') && | |
54 | $Config{cc} =~ /^(cl|gcc)/i); | |
6dead956 | 55 | |
36a42ae7 | 56 | # UWIN seems to loop after taint tests, just skip for now |
cd19b65c JH |
57 | $have_setlocale = 0 if ($^O =~ /^uwin/); |
58 | ||
9a66ea41 | 59 | sub LC_ALL (); |
8ebc5c01 | 60 | |
0e053d1e | 61 | $a = 'abc %'; |
8ebc5c01 | 62 | |
c213d471 KW |
63 | my $test_num = 0; |
64 | ||
8ebc5c01 | 65 | sub ok { |
c213d471 | 66 | my ($result, $message) = @_; |
e3a2734b | 67 | $message = "" unless defined $message; |
8ebc5c01 | 68 | |
69 | print 'not ' unless ($result); | |
c213d471 | 70 | print "ok " . ++$test_num; |
e3a2734b KW |
71 | print " $message"; |
72 | print "\n"; | |
8ebc5c01 | 73 | } |
74 | ||
75 | # First we'll do a lot of taint checking for locales. | |
76 | # This is the easiest to test, actually, as any locale, | |
77 | # even the default locale will taint under 'use locale'. | |
78 | ||
79 | sub is_tainted { # hello, camel two. | |
9f1b1f2d | 80 | no warnings 'uninitialized' ; |
8ebc5c01 | 81 | my $dummy; |
ba74571d | 82 | local $@; |
8ebc5c01 | 83 | not eval { $dummy = join("", @_), kill 0; 1 } |
84 | } | |
85 | ||
36a42ae7 KW |
86 | sub check_taint ($) { |
87 | ok is_tainted($_[0]), "verify that is tainted"; | |
8ebc5c01 | 88 | } |
89 | ||
36a42ae7 KW |
90 | sub check_taint_not ($) { |
91 | ok((not is_tainted($_[0])), "verify that isn't tainted"); | |
8ebc5c01 | 92 | } |
93 | ||
94 | use locale; # engage locale and therefore locale taint. | |
95 | ||
36a42ae7 | 96 | check_taint_not $a; |
8ebc5c01 | 97 | |
36a42ae7 KW |
98 | check_taint uc($a); |
99 | check_taint "\U$a"; | |
100 | check_taint ucfirst($a); | |
101 | check_taint "\u$a"; | |
102 | check_taint lc($a); | |
103 | check_taint "\L$a"; | |
104 | check_taint lcfirst($a); | |
105 | check_taint "\l$a"; | |
8ebc5c01 | 106 | |
36a42ae7 KW |
107 | check_taint_not sprintf('%e', 123.456); |
108 | check_taint_not sprintf('%f', 123.456); | |
109 | check_taint_not sprintf('%g', 123.456); | |
110 | check_taint_not sprintf('%d', 123.456); | |
111 | check_taint_not sprintf('%x', 123.456); | |
8ebc5c01 | 112 | |
113 | $_ = $a; # untaint $_ | |
114 | ||
115 | $_ = uc($a); # taint $_ | |
116 | ||
36a42ae7 | 117 | check_taint $_; |
8ebc5c01 | 118 | |
119 | /(\w)/; # taint $&, $`, $', $+, $1. | |
36a42ae7 KW |
120 | check_taint $&; |
121 | check_taint $`; | |
122 | check_taint $'; | |
123 | check_taint $+; | |
124 | check_taint $1; | |
125 | check_taint_not $2; | |
8ebc5c01 | 126 | |
127 | /(.)/; # untaint $&, $`, $', $+, $1. | |
36a42ae7 KW |
128 | check_taint_not $&; |
129 | check_taint_not $`; | |
130 | check_taint_not $'; | |
131 | check_taint_not $+; | |
132 | check_taint_not $1; | |
133 | check_taint_not $2; | |
8ebc5c01 | 134 | |
135 | /(\W)/; # taint $&, $`, $', $+, $1. | |
36a42ae7 KW |
136 | check_taint $&; |
137 | check_taint $`; | |
138 | check_taint $'; | |
139 | check_taint $+; | |
140 | check_taint $1; | |
141 | check_taint_not $2; | |
8ebc5c01 | 142 | |
143 | /(\s)/; # taint $&, $`, $', $+, $1. | |
36a42ae7 KW |
144 | check_taint $&; |
145 | check_taint $`; | |
146 | check_taint $'; | |
147 | check_taint $+; | |
148 | check_taint $1; | |
149 | check_taint_not $2; | |
8ebc5c01 | 150 | |
151 | /(\S)/; # taint $&, $`, $', $+, $1. | |
36a42ae7 KW |
152 | check_taint $&; |
153 | check_taint $`; | |
154 | check_taint $'; | |
155 | check_taint $+; | |
156 | check_taint $1; | |
157 | check_taint_not $2; | |
8ebc5c01 | 158 | |
159 | $_ = $a; # untaint $_ | |
160 | ||
36a42ae7 | 161 | check_taint_not $_; |
8ebc5c01 | 162 | |
163 | /(b)/; # this must not taint | |
36a42ae7 KW |
164 | check_taint_not $&; |
165 | check_taint_not $`; | |
166 | check_taint_not $'; | |
167 | check_taint_not $+; | |
168 | check_taint_not $1; | |
169 | check_taint_not $2; | |
8ebc5c01 | 170 | |
171 | $_ = $a; # untaint $_ | |
172 | ||
36a42ae7 | 173 | check_taint_not $_; |
8ebc5c01 | 174 | |
175 | $b = uc($a); # taint $b | |
176 | s/(.+)/$b/; # this must taint only the $_ | |
177 | ||
36a42ae7 KW |
178 | check_taint $_; |
179 | check_taint_not $&; | |
180 | check_taint_not $`; | |
181 | check_taint_not $'; | |
182 | check_taint_not $+; | |
183 | check_taint_not $1; | |
184 | check_taint_not $2; | |
8ebc5c01 | 185 | |
186 | $_ = $a; # untaint $_ | |
187 | ||
188 | s/(.+)/b/; # this must not taint | |
36a42ae7 KW |
189 | check_taint_not $_; |
190 | check_taint_not $&; | |
191 | check_taint_not $`; | |
192 | check_taint_not $'; | |
193 | check_taint_not $+; | |
194 | check_taint_not $1; | |
195 | check_taint_not $2; | |
8ebc5c01 | 196 | |
197 | $b = $a; # untaint $b | |
198 | ||
199 | ($b = $a) =~ s/\w/$&/; | |
36a42ae7 KW |
200 | check_taint $b; # $b should be tainted. |
201 | check_taint_not $a; # $a should be not. | |
8ebc5c01 | 202 | |
203 | $_ = $a; # untaint $_ | |
204 | ||
205 | s/(\w)/\l$1/; # this must taint | |
36a42ae7 KW |
206 | check_taint $_; |
207 | check_taint $&; | |
208 | check_taint $`; | |
209 | check_taint $'; | |
210 | check_taint $+; | |
211 | check_taint $1; | |
212 | check_taint_not $2; | |
8ebc5c01 | 213 | |
214 | $_ = $a; # untaint $_ | |
215 | ||
216 | s/(\w)/\L$1/; # this must taint | |
36a42ae7 KW |
217 | check_taint $_; |
218 | check_taint $&; | |
219 | check_taint $`; | |
220 | check_taint $'; | |
221 | check_taint $+; | |
222 | check_taint $1; | |
223 | check_taint_not $2; | |
8ebc5c01 | 224 | |
225 | $_ = $a; # untaint $_ | |
226 | ||
227 | s/(\w)/\u$1/; # this must taint | |
36a42ae7 KW |
228 | check_taint $_; |
229 | check_taint $&; | |
230 | check_taint $`; | |
231 | check_taint $'; | |
232 | check_taint $+; | |
233 | check_taint $1; | |
234 | check_taint_not $2; | |
8ebc5c01 | 235 | |
236 | $_ = $a; # untaint $_ | |
237 | ||
238 | s/(\w)/\U$1/; # this must taint | |
36a42ae7 KW |
239 | check_taint $_; |
240 | check_taint $&; | |
241 | check_taint $`; | |
242 | check_taint $'; | |
243 | check_taint $+; | |
244 | check_taint $1; | |
245 | check_taint_not $2; | |
8ebc5c01 | 246 | |
247 | # After all this tainting $a should be cool. | |
248 | ||
36a42ae7 | 249 | check_taint_not $a; |
8ebc5c01 | 250 | |
251 | # I think we've seen quite enough of taint. | |
252 | # Let us do some *real* locale work now, | |
284102e8 | 253 | # unless setlocale() is missing (i.e. minitest). |
8ebc5c01 | 254 | |
fdf053ee KW |
255 | unless ($have_setlocale) { |
256 | print "1..$test_num\n"; | |
257 | exit; | |
258 | } | |
8ebc5c01 | 259 | |
6cf0b567 KW |
260 | # The test number before our first setlocale() |
261 | my $last_without_setlocale = $test_num; | |
262 | ||
284102e8 JH |
263 | # Find locales. |
264 | ||
6be75cd7 JH |
265 | debug "# Scanning for locales...\n"; |
266 | ||
267 | # Note that it's okay that some languages have their native names | |
268 | # capitalized here even though that's not "right". They are lowercased | |
269 | # anyway later during the scanning process (and besides, some clueless | |
98dc9551 | 270 | # vendor might have them capitalized erroneously anyway). |
6be75cd7 | 271 | |
284102e8 | 272 | my $locales = <<EOF; |
6be75cd7 | 273 | Afrikaans:af:za:1 15 |
284102e8 | 274 | Arabic:ar:dz eg sa:6 arabic8 |
6be75cd7 JH |
275 | Brezhoneg Breton:br:fr:1 15 |
276 | Bulgarski Bulgarian:bg:bg:5 | |
dd8482fc | 277 | Chinese:zh:cn tw:cn.EUC eucCN eucTW euc.CN euc.TW Big5 GB2312 tw.EUC |
6be75cd7 JH |
278 | Hrvatski Croatian:hr:hr:2 |
279 | Cymraeg Welsh:cy:cy:1 14 15 | |
284102e8 | 280 | Czech:cs:cz:2 |
6be75cd7 JH |
281 | Dansk Danish:dk:da:1 15 |
282 | Nederlands Dutch:nl:be nl:1 15 | |
dd8482fc | 283 | English American British:en:au ca gb ie nz us uk zw:1 15 cp850 |
6be75cd7 JH |
284 | Esperanto:eo:eo:3 |
285 | Eesti Estonian:et:ee:4 6 13 | |
286 | Suomi Finnish:fi:fi:1 15 | |
287 | Flamish::fl:1 15 | |
6be75cd7 JH |
288 | Deutsch German:de:at be ch de lu:1 15 |
289 | Euskaraz Basque:eu:es fr:1 15 | |
6be75cd7 JH |
290 | Galego Galician:gl:es:1 15 |
291 | Ellada Greek:el:gr:7 g8 | |
6be75cd7 JH |
292 | Frysk:fy:nl:1 15 |
293 | Greenlandic:kl:gl:4 6 | |
284102e8 JH |
294 | Hebrew:iw:il:8 hebrew8 |
295 | Hungarian:hu:hu:2 | |
6be75cd7 JH |
296 | Indonesian:in:id:1 15 |
297 | Gaeilge Irish:ga:IE:1 14 15 | |
298 | Italiano Italian:it:ch it:1 15 | |
299 | Nihongo Japanese:ja:jp:euc eucJP jp.EUC sjis | |
284102e8 | 300 | Korean:ko:kr: |
6be75cd7 JH |
301 | Latine Latin:la:va:1 15 |
302 | Latvian:lv:lv:4 6 13 | |
303 | Lithuanian:lt:lt:4 6 13 | |
304 | Macedonian:mk:mk:1 15 | |
305 | Maltese:mt:mt:3 | |
dd8482fc JH |
306 | Moldovan:mo:mo:2 |
307 | Norsk Norwegian:no no\@nynorsk:no:1 15 | |
6be75cd7 JH |
308 | Occitan:oc:es:1 15 |
309 | Polski Polish:pl:pl:2 | |
284102e8 | 310 | Rumanian:ro:ro:2 |
a528dad0 | 311 | Russki Russian:ru:ru su ua:5 koi8 koi8r KOI8-R koi8u cp1251 cp866 |
6be75cd7 | 312 | Serbski Serbian:sr:yu:5 |
284102e8 | 313 | Slovak:sk:sk:2 |
6be75cd7 | 314 | Slovene Slovenian:sl:si:2 |
d43ce814 JH |
315 | Sqhip Albanian:sq:sq:1 15 |
316 | Svenska Swedish:sv:fi se:1 15 | |
6be75cd7 | 317 | Thai:th:th:11 tis620 |
284102e8 | 318 | Turkish:tr:tr:9 turkish8 |
dd8482fc | 319 | Yiddish:yi::1 15 |
284102e8 JH |
320 | EOF |
321 | ||
ee50adbe | 322 | if ($^O eq 'os390') { |
dd8482fc | 323 | # These cause heartburn. Broken locales? |
ee50adbe PP |
324 | $locales =~ s/Svenska Swedish:sv:fi se:1 15\n//; |
325 | $locales =~ s/Thai:th:th:11 tis620\n//; | |
326 | } | |
327 | ||
ef4a39e5 | 328 | sub in_utf8 () { $^H & 0x08 || (${^OPEN} || "") =~ /:utf8/ } |
f9cbebe1 JH |
329 | |
330 | if (in_utf8) { | |
8a6cb2cb | 331 | require "lib/locale/utf8"; |
f9cbebe1 | 332 | } else { |
8a6cb2cb | 333 | require "lib/locale/latin1"; |
f9cbebe1 JH |
334 | } |
335 | ||
284102e8 JH |
336 | my @Locale; |
337 | my $Locale; | |
338 | my @Alnum_; | |
339 | ||
0e053d1e JH |
340 | my @utf8locale; |
341 | my %utf8skip; | |
342 | ||
284102e8 | 343 | sub getalnum_ { |
8ebc5c01 | 344 | sort grep /\w/, map { chr } 0..255 |
345 | } | |
346 | ||
284102e8 JH |
347 | sub trylocale { |
348 | my $locale = shift; | |
0b9f254b | 349 | return if grep { $locale eq $_ } @Locale; |
284102e8 JH |
350 | if (setlocale(LC_ALL, $locale)) { |
351 | push @Locale, $locale; | |
352 | } | |
353 | } | |
8ebc5c01 | 354 | |
284102e8 JH |
355 | sub decode_encodings { |
356 | my @enc; | |
8ebc5c01 | 357 | |
284102e8 JH |
358 | foreach (split(/ /, shift)) { |
359 | if (/^(\d+)$/) { | |
360 | push @enc, "ISO8859-$1"; | |
361 | push @enc, "iso8859$1"; # HP | |
362 | if ($1 eq '1') { | |
363 | push @enc, "roman8"; # HP | |
364 | } | |
365 | } else { | |
366 | push @enc, $_; | |
dd8482fc | 367 | push @enc, "$_.UTF-8"; |
8ebc5c01 | 368 | } |
369 | } | |
ee50adbe PP |
370 | if ($^O eq 'os390') { |
371 | push @enc, qw(IBM-037 IBM-819 IBM-1047); | |
372 | } | |
8ebc5c01 | 373 | |
284102e8 | 374 | return @enc; |
8ebc5c01 | 375 | } |
376 | ||
284102e8 JH |
377 | trylocale("C"); |
378 | trylocale("POSIX"); | |
379 | foreach (0..15) { | |
380 | trylocale("ISO8859-$_"); | |
284102e8 | 381 | trylocale("iso8859$_"); |
097ee67d JH |
382 | trylocale("iso8859-$_"); |
383 | trylocale("iso_8859_$_"); | |
384 | trylocale("isolatin$_"); | |
385 | trylocale("isolatin-$_"); | |
386 | trylocale("iso_latin_$_"); | |
8ebc5c01 | 387 | } |
388 | ||
645e49ed JH |
389 | # Sanitize the environment so that we can run the external 'locale' |
390 | # program without the taint mode getting grumpy. | |
cce5967e JH |
391 | |
392 | # $ENV{PATH} is special in VMS. | |
393 | delete $ENV{PATH} if $^O ne 'VMS' or $Config{d_setenv}; | |
394 | ||
395 | # Other subversive stuff. | |
396 | delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; | |
dd8482fc | 397 | |
21477fb4 | 398 | if (-x "/usr/bin/locale" && open(LOCALES, "/usr/bin/locale -a 2>/dev/null|")) { |
dd8482fc | 399 | while (<LOCALES>) { |
d281a6ac NC |
400 | # It seems that /usr/bin/locale steadfastly outputs 8 bit data, which |
401 | # ain't great when we're running this testPERL_UNICODE= so that utf8 | |
402 | # locales will cause all IO hadles to default to (assume) utf8 | |
403 | next unless utf8::valid($_); | |
dd8482fc JH |
404 | chomp; |
405 | trylocale($_); | |
284102e8 | 406 | } |
dd8482fc | 407 | close(LOCALES); |
a6259068 PP |
408 | } elsif ($^O eq 'VMS' && defined($ENV{'SYS$I18N_LOCALE'}) && -d 'SYS$I18N_LOCALE') { |
409 | # The SYS$I18N_LOCALE logical name search list was not present on | |
410 | # VAX VMS V5.5-12, but was on AXP && VAX VMS V6.2 as well as later versions. | |
411 | opendir(LOCALES, "SYS\$I18N_LOCALE:"); | |
412 | while ($_ = readdir(LOCALES)) { | |
413 | chomp; | |
414 | trylocale($_); | |
415 | } | |
416 | close(LOCALES); | |
87e33296 SP |
417 | } elsif ($^O eq 'openbsd' && -e '/usr/share/locale') { |
418 | ||
419 | # OpenBSD doesn't have a locale executable, so reading /usr/share/locale | |
420 | # is much easier and faster than the last resort method. | |
421 | ||
422 | opendir(LOCALES, '/usr/share/locale'); | |
423 | while ($_ = readdir(LOCALES)) { | |
424 | chomp; | |
425 | trylocale($_); | |
426 | } | |
427 | close(LOCALES); | |
dd8482fc JH |
428 | } else { |
429 | ||
430 | # This is going to be slow. | |
431 | ||
432 | foreach my $locale (split(/\n/, $locales)) { | |
433 | my ($locale_name, $language_codes, $country_codes, $encodings) = | |
434 | split(/:/, $locale); | |
435 | my @enc = decode_encodings($encodings); | |
436 | foreach my $loc (split(/ /, $locale_name)) { | |
437 | trylocale($loc); | |
284102e8 | 438 | foreach my $enc (@enc) { |
dd8482fc | 439 | trylocale("$loc.$enc"); |
284102e8 | 440 | } |
dd8482fc | 441 | $loc = lc $loc; |
284102e8 | 442 | foreach my $enc (@enc) { |
dd8482fc JH |
443 | trylocale("$loc.$enc"); |
444 | } | |
445 | } | |
446 | foreach my $lang (split(/ /, $language_codes)) { | |
447 | trylocale($lang); | |
448 | foreach my $country (split(/ /, $country_codes)) { | |
449 | my $lc = "${lang}_${country}"; | |
450 | trylocale($lc); | |
451 | foreach my $enc (@enc) { | |
452 | trylocale("$lc.$enc"); | |
453 | } | |
454 | my $lC = "${lang}_\U${country}"; | |
455 | trylocale($lC); | |
456 | foreach my $enc (@enc) { | |
457 | trylocale("$lC.$enc"); | |
458 | } | |
284102e8 JH |
459 | } |
460 | } | |
461 | } | |
462 | } | |
4599a1de | 463 | |
d43ce814 JH |
464 | setlocale(LC_ALL, "C"); |
465 | ||
86f50d7d | 466 | if ($^O eq 'darwin') { |
4373e181 | 467 | # Darwin 8/Mac OS X 10.4 and 10.5 have bad Basque locales: perl bug #35895, |
86f50d7d | 468 | # Apple bug ID# 4139653. It also has a problem in Byelorussian. |
4373e181 RGS |
469 | (my $v) = $Config{osvers} =~ /^(\d+)/; |
470 | if ($v >= 8 and $v < 10) { | |
86f50d7d | 471 | debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n"; |
a5ec937f | 472 | @Locale = grep ! m/^(eu_ES(?:\..*)?|be_BY\.CP1131)$/, @Locale; |
dfa5c78f | 473 | } elsif ($v < 12) { |
a44d0896 NC |
474 | debug "# Skipping be_BY locales -- buggy in Darwin\n"; |
475 | @Locale = grep ! m/^be_BY\.CP1131$/, @Locale; | |
a5ec937f | 476 | } |
86f50d7d DD |
477 | } |
478 | ||
4599a1de JH |
479 | @Locale = sort @Locale; |
480 | ||
887ef7ed PP |
481 | debug "# Locales =\n"; |
482 | for ( @Locale ) { | |
483 | debug "# $_\n"; | |
484 | } | |
8ebc5c01 | 485 | |
284102e8 | 486 | my %Problem; |
2a680da6 JH |
487 | my %Okay; |
488 | my %Testing; | |
097ee67d | 489 | my @Neoalpha; |
d8093b23 | 490 | my %Neoalpha; |
284102e8 | 491 | |
2a680da6 JH |
492 | sub tryneoalpha { |
493 | my ($Locale, $i, $test) = @_; | |
2a680da6 JH |
494 | unless ($test) { |
495 | $Problem{$i}{$Locale} = 1; | |
496 | debug "# failed $i with locale '$Locale'\n"; | |
497 | } else { | |
498 | push @{$Okay{$i}}, $Locale; | |
499 | } | |
500 | } | |
501 | ||
284102e8 JH |
502 | foreach $Locale (@Locale) { |
503 | debug "# Locale = $Locale\n"; | |
284102e8 JH |
504 | |
505 | unless (setlocale(LC_ALL, $Locale)) { | |
506 | foreach (99..103) { | |
507 | $Problem{$_}{$Locale} = -1; | |
8ebc5c01 | 508 | } |
284102e8 | 509 | next; |
8ebc5c01 | 510 | } |
8ebc5c01 | 511 | |
e5272a46 KW |
512 | @Alnum_ = getalnum_(); |
513 | debug "# w = ", join("",@Alnum_), "\n"; | |
514 | ||
284102e8 JH |
515 | # Sieve the uppercase and the lowercase. |
516 | ||
097ee67d JH |
517 | my %UPPER = (); |
518 | my %lower = (); | |
519 | my %BoThCaSe = (); | |
284102e8 JH |
520 | for (@Alnum_) { |
521 | if (/[^\d_]/) { # skip digits and the _ | |
522 | if (uc($_) eq $_) { | |
523 | $UPPER{$_} = $_; | |
524 | } | |
525 | if (lc($_) eq $_) { | |
526 | $lower{$_} = $_; | |
527 | } | |
528 | } | |
529 | } | |
530 | foreach (keys %UPPER) { | |
097ee67d | 531 | $BoThCaSe{$_}++ if exists $lower{$_}; |
284102e8 JH |
532 | } |
533 | foreach (keys %lower) { | |
097ee67d | 534 | $BoThCaSe{$_}++ if exists $UPPER{$_}; |
284102e8 | 535 | } |
097ee67d | 536 | foreach (keys %BoThCaSe) { |
284102e8 JH |
537 | delete $UPPER{$_}; |
538 | delete $lower{$_}; | |
539 | } | |
540 | ||
db4b7445 A |
541 | debug "# UPPER = ", join("", sort keys %UPPER ), "\n"; |
542 | debug "# lower = ", join("", sort keys %lower ), "\n"; | |
543 | debug "# BoThCaSe = ", join("", sort keys %BoThCaSe), "\n"; | |
284102e8 JH |
544 | |
545 | # Find the alphabets that are not alphabets in the default locale. | |
8ebc5c01 | 546 | |
284102e8 JH |
547 | { |
548 | no locale; | |
8ebc5c01 | 549 | |
284102e8 JH |
550 | @Neoalpha = (); |
551 | for (keys %UPPER, keys %lower) { | |
552 | push(@Neoalpha, $_) if (/\W/); | |
d8093b23 | 553 | $Neoalpha{$_} = $_; |
284102e8 | 554 | } |
8ebc5c01 | 555 | } |
8ebc5c01 | 556 | |
284102e8 | 557 | @Neoalpha = sort @Neoalpha; |
8ebc5c01 | 558 | |
db4b7445 | 559 | debug "# Neoalpha = ", join("",@Neoalpha), "\n"; |
8ebc5c01 | 560 | |
284102e8 JH |
561 | if (@Neoalpha == 0) { |
562 | # If we have no Neoalphas the remaining tests are no-ops. | |
6be75cd7 | 563 | debug "# no Neoalpha, skipping tests 99..102 for locale '$Locale'\n"; |
a88c3d7c GS |
564 | foreach (99..102) { |
565 | push @{$Okay{$_}}, $Locale; | |
566 | } | |
6be75cd7 | 567 | } else { |
8ebc5c01 | 568 | |
6be75cd7 | 569 | # Test \w. |
284102e8 | 570 | |
ef4a39e5 | 571 | my $word = join('', @Neoalpha); |
8ebc5c01 | 572 | |
5fef21a3 JH |
573 | my $badutf8; |
574 | { | |
575 | local $SIG{__WARN__} = sub { | |
576 | $badutf8 = $_[0] =~ /Malformed UTF-8/; | |
577 | }; | |
578 | $Locale =~ /utf-?8/i; | |
579 | } | |
580 | ||
581 | if ($badutf8) { | |
582 | debug "# Locale name contains bad UTF-8, skipping test 99 for locale '$Locale'\n"; | |
583 | } elsif ($Locale =~ /utf-?8/i) { | |
ef4a39e5 JH |
584 | debug "# unknown whether locale and Unicode have the same \\w, skipping test 99 for locale '$Locale'\n"; |
585 | push @{$Okay{99}}, $Locale; | |
586 | } else { | |
587 | if ($word =~ /^(\w+)$/) { | |
588 | tryneoalpha($Locale, 99, 1); | |
589 | } else { | |
590 | tryneoalpha($Locale, 99, 0); | |
591 | } | |
8ac0d9e6 | 592 | } |
ef4a39e5 | 593 | |
2a680da6 | 594 | # Cross-check the whole 8-bit character set. |
8ebc5c01 | 595 | |
6be75cd7 | 596 | for (map { chr } 0..255) { |
2a680da6 JH |
597 | tryneoalpha($Locale, 100, |
598 | (/\w/ xor /\W/) || | |
599 | (/\d/ xor /\D/) || | |
600 | (/\s/ xor /\S/)); | |
284102e8 | 601 | } |
8ebc5c01 | 602 | |
6be75cd7 | 603 | # Test for read-only scalars' locale vs non-locale comparisons. |
284102e8 | 604 | |
284102e8 | 605 | { |
6be75cd7 JH |
606 | no locale; |
607 | $a = "qwerty"; | |
608 | { | |
609 | use locale; | |
2a680da6 | 610 | tryneoalpha($Locale, 101, ($a cmp "qwerty") == 0); |
8ebc5c01 | 611 | } |
612 | } | |
8ebc5c01 | 613 | |
6be75cd7 JH |
614 | { |
615 | my ($from, $to, $lesser, $greater, | |
616 | @test, %test, $test, $yes, $no, $sign); | |
617 | ||
618 | for (0..9) { | |
619 | # Select a slice. | |
620 | $from = int(($_*@Alnum_)/10); | |
621 | $to = $from + int(@Alnum_/10); | |
622 | $to = $#Alnum_ if ($to > $#Alnum_); | |
623 | $lesser = join('', @Alnum_[$from..$to]); | |
624 | # Select a slice one character on. | |
625 | $from++; $to++; | |
626 | $to = $#Alnum_ if ($to > $#Alnum_); | |
627 | $greater = join('', @Alnum_[$from..$to]); | |
628 | ($yes, $no, $sign) = ($lesser lt $greater | |
629 | ? (" ", "not ", 1) | |
630 | : ("not ", " ", -1)); | |
631 | # all these tests should FAIL (return 0). | |
632 | # Exact lt or gt cannot be tested because | |
633 | # in some locales, say, eacute and E may test equal. | |
634 | @test = | |
635 | ( | |
636 | $no.' ($lesser le $greater)', # 1 | |
637 | 'not ($lesser ne $greater)', # 2 | |
638 | ' ($lesser eq $greater)', # 3 | |
639 | $yes.' ($lesser ge $greater)', # 4 | |
640 | $yes.' ($lesser ge $greater)', # 5 | |
641 | $yes.' ($greater le $lesser )', # 7 | |
642 | 'not ($greater ne $lesser )', # 8 | |
643 | ' ($greater eq $lesser )', # 9 | |
644 | $no.' ($greater ge $lesser )', # 10 | |
0e053d1e | 645 | 'not (($lesser cmp $greater) == -($sign))' # 11 |
6be75cd7 JH |
646 | ); |
647 | @test{@test} = 0 x @test; | |
648 | $test = 0; | |
284102e8 | 649 | for my $ti (@test) { |
6be75cd7 JH |
650 | $test{$ti} = eval $ti; |
651 | $test ||= $test{$ti} | |
284102e8 | 652 | } |
2a680da6 | 653 | tryneoalpha($Locale, 102, $test == 0); |
6be75cd7 | 654 | if ($test) { |
6be75cd7 JH |
655 | debug "# lesser = '$lesser'\n"; |
656 | debug "# greater = '$greater'\n"; | |
657 | debug "# lesser cmp greater = ", | |
658 | $lesser cmp $greater, "\n"; | |
659 | debug "# greater cmp lesser = ", | |
660 | $greater cmp $lesser, "\n"; | |
661 | debug "# (greater) from = $from, to = $to\n"; | |
662 | for my $ti (@test) { | |
663 | debugf("# %-40s %-4s", $ti, | |
664 | $test{$ti} ? 'FAIL' : 'ok'); | |
665 | if ($ti =~ /\(\.*(\$.+ +cmp +\$[^\)]+)\.*\)/) { | |
666 | debugf("(%s == %4d)", $1, eval $1); | |
667 | } | |
668 | debug "\n#"; | |
669 | } | |
284102e8 | 670 | |
6be75cd7 JH |
671 | last; |
672 | } | |
284102e8 | 673 | } |
8ebc5c01 | 674 | } |
675 | } | |
6be75cd7 JH |
676 | |
677 | use locale; | |
678 | ||
679 | my ($x, $y) = (1.23, 1.23); | |
680 | ||
0e053d1e | 681 | $a = "$x"; |
6be75cd7 | 682 | printf ''; # printf used to reset locale to "C" |
0e053d1e | 683 | $b = "$y"; |
6be75cd7 | 684 | |
2a680da6 JH |
685 | debug "# 103..107: a = $a, b = $b, Locale = $Locale\n"; |
686 | ||
687 | tryneoalpha($Locale, 103, $a eq $b); | |
6be75cd7 JH |
688 | |
689 | my $c = "$x"; | |
690 | my $z = sprintf ''; # sprintf used to reset locale to "C" | |
691 | my $d = "$y"; | |
692 | ||
2a680da6 | 693 | debug "# 104..107: c = $c, d = $d, Locale = $Locale\n"; |
6be75cd7 | 694 | |
2a680da6 | 695 | tryneoalpha($Locale, 104, $c eq $d); |
6be75cd7 | 696 | |
2a680da6 | 697 | { |
9f1b1f2d | 698 | use warnings; |
2a680da6 | 699 | my $w = 0; |
0e053d1e JH |
700 | local $SIG{__WARN__} = |
701 | sub { | |
906f284f | 702 | print "# @_\n"; |
0e053d1e JH |
703 | $w++; |
704 | }; | |
6be75cd7 | 705 | |
0e053d1e JH |
706 | # The == (among other ops) used to warn for locales |
707 | # that had something else than "." as the radix character. | |
6be75cd7 | 708 | |
2a680da6 | 709 | tryneoalpha($Locale, 105, $c == 1.23); |
6be75cd7 | 710 | |
2a680da6 | 711 | tryneoalpha($Locale, 106, $c == $x); |
6be75cd7 | 712 | |
2a680da6 | 713 | tryneoalpha($Locale, 107, $c == $d); |
6be75cd7 | 714 | |
2a680da6 | 715 | { |
2de3dbcc | 716 | # no locale; # XXX did this ever work correctly? |
6be75cd7 | 717 | |
2a680da6 | 718 | my $e = "$x"; |
6be75cd7 | 719 | |
2a680da6 | 720 | debug "# 108..110: e = $e, Locale = $Locale\n"; |
6be75cd7 | 721 | |
2a680da6 | 722 | tryneoalpha($Locale, 108, $e == 1.23); |
6be75cd7 | 723 | |
2a680da6 JH |
724 | tryneoalpha($Locale, 109, $e == $x); |
725 | ||
726 | tryneoalpha($Locale, 110, $e == $c); | |
6be75cd7 | 727 | } |
2a680da6 | 728 | |
2a680da6 | 729 | my $f = "1.23"; |
906f284f | 730 | my $g = 2.34; |
2a680da6 | 731 | |
906f284f | 732 | debug "# 111..115: f = $f, g = $g, locale = $Locale\n"; |
2a680da6 | 733 | |
906f284f | 734 | tryneoalpha($Locale, 111, $f == 1.23); |
6be75cd7 | 735 | |
906f284f | 736 | tryneoalpha($Locale, 112, $f == $x); |
2a680da6 | 737 | |
906f284f NC |
738 | tryneoalpha($Locale, 113, $f == $c); |
739 | ||
740 | tryneoalpha($Locale, 114, abs(($f + $g) - 3.57) < 0.01); | |
741 | ||
742 | tryneoalpha($Locale, 115, $w == 0); | |
6be75cd7 JH |
743 | } |
744 | ||
26d80d95 LC |
745 | # Does taking lc separately differ from taking |
746 | # the lc "in-line"? (This was the bug 19990704.002, change #3568.) | |
747 | # The bug was in the caching of the 'o'-magic. | |
2a680da6 JH |
748 | { |
749 | use locale; | |
6be75cd7 | 750 | |
2a680da6 JH |
751 | sub lcA { |
752 | my $lc0 = lc $_[0]; | |
753 | my $lc1 = lc $_[1]; | |
754 | return $lc0 cmp $lc1; | |
755 | } | |
6be75cd7 | 756 | |
2a680da6 JH |
757 | sub lcB { |
758 | return lc($_[0]) cmp lc($_[1]); | |
759 | } | |
6be75cd7 | 760 | |
2a680da6 JH |
761 | my $x = "ab"; |
762 | my $y = "aa"; | |
763 | my $z = "AB"; | |
6be75cd7 | 764 | |
906f284f | 765 | tryneoalpha($Locale, 116, |
2a680da6 JH |
766 | lcA($x, $y) == 1 && lcB($x, $y) == 1 || |
767 | lcA($x, $z) == 0 && lcB($x, $z) == 0); | |
6be75cd7 | 768 | } |
d8093b23 | 769 | |
26d80d95 LC |
770 | # Does lc of an UPPER (if different from the UPPER) match |
771 | # case-insensitively the UPPER, and does the UPPER match | |
772 | # case-insensitively the lc of the UPPER. And vice versa. | |
3ba0e062 | 773 | { |
ef4a39e5 JH |
774 | use locale; |
775 | no utf8; | |
776 | my $re = qr/[\[\(\{\*\+\?\|\^\$\\]/; | |
777 | ||
778 | my @f = (); | |
779 | foreach my $x (keys %UPPER) { | |
780 | my $y = lc $x; | |
781 | next unless uc $y eq $x; | |
782 | print "# UPPER $x lc $y ", | |
783 | $x =~ /$y/i ? 1 : 0, " ", | |
784 | $y =~ /$x/i ? 1 : 0, "\n" if 0; | |
83d38f53 | 785 | # |
ef4a39e5 JH |
786 | # If $x and $y contain regular expression characters |
787 | # AND THEY lowercase (/i) to regular expression characters, | |
788 | # regcomp() will be mightily confused. No, the \Q doesn't | |
789 | # help here (maybe regex engine internal lowercasing | |
790 | # is done after the \Q?) An example of this happening is | |
791 | # the bg_BG (Bulgarian) locale under EBCDIC (OS/390 USS): | |
792 | # the chr(173) (the "[") is the lowercase of the chr(235). | |
83d38f53 | 793 | # |
ef4a39e5 JH |
794 | # Similarly losing EBCDIC locales include cs_cz, cs_CZ, |
795 | # el_gr, el_GR, en_us.IBM-037 (!), en_US.IBM-037 (!), | |
796 | # et_ee, et_EE, hr_hr, hr_HR, hu_hu, hu_HU, lt_LT, | |
797 | # mk_mk, mk_MK, nl_nl.IBM-037, nl_NL.IBM-037, | |
798 | # pl_pl, pl_PL, ro_ro, ro_RO, ru_ru, ru_RU, | |
799 | # sk_sk, sk_SK, sl_si, sl_SI, tr_tr, tr_TR. | |
83d38f53 JH |
800 | # |
801 | # Similar things can happen even under (bastardised) | |
802 | # non-EBCDIC locales: in many European countries before the | |
803 | # advent of ISO 8859-x nationally customised versions of | |
804 | # ISO 646 were devised, reusing certain punctuation | |
805 | # characters for modified characters needed by the | |
806 | # country/language. For example, the "|" might have | |
807 | # stood for U+00F6 or LATIN SMALL LETTER O WITH DIAERESIS. | |
808 | # | |
ef4a39e5 JH |
809 | if ($x =~ $re || $y =~ $re) { |
810 | print "# Regex characters in '$x' or '$y', skipping test 117 for locale '$Locale'\n"; | |
811 | next; | |
8ac0d9e6 | 812 | } |
ef4a39e5 JH |
813 | # With utf8 both will fail since the locale concept |
814 | # of upper/lower does not work well in Unicode. | |
815 | push @f, $x unless $x =~ /$y/i == $y =~ /$x/i; | |
c00ff1c7 | 816 | } |
ef4a39e5 | 817 | |
c00ff1c7 DM |
818 | foreach my $x (keys %lower) { |
819 | my $y = uc $x; | |
820 | next unless lc $y eq $x; | |
821 | print "# lower $x uc $y ", | |
822 | $x =~ /$y/i ? 1 : 0, " ", | |
823 | $y =~ /$x/i ? 1 : 0, "\n" if 0; | |
824 | if ($x =~ $re || $y =~ $re) { # See above. | |
825 | print "# Regex characters in '$x' or '$y', skipping test 117 for locale '$Locale'\n"; | |
826 | next; | |
8ac0d9e6 | 827 | } |
c00ff1c7 DM |
828 | # With utf8 both will fail since the locale concept |
829 | # of upper/lower does not work well in Unicode. | |
830 | push @f, $x unless $x =~ /$y/i == $y =~ /$x/i; | |
831 | } | |
832 | tryneoalpha($Locale, 117, @f == 0); | |
833 | if (@f) { | |
834 | print "# failed 117 locale '$Locale' characters @f\n" | |
835 | } | |
d8093b23 | 836 | } |
8ebc5c01 | 837 | } |
284102e8 | 838 | |
6cf0b567 KW |
839 | my $last_locales = $have_setlocale ? &last_locales : $last_without_setlocale; |
840 | ||
2a680da6 JH |
841 | # Recount the errors. |
842 | ||
6cf0b567 | 843 | foreach ($last_without_setlocale+1..$last_locales) { |
2a680da6 | 844 | if ($Problem{$_} || !defined $Okay{$_} || !@{$Okay{$_}}) { |
097ee67d JH |
845 | if ($_ == 102) { |
846 | print "# The failure of test 102 is not necessarily fatal.\n"; | |
b4e009be | 847 | print "# It usually indicates a problem in the environment,\n"; |
284102e8 JH |
848 | print "# not in Perl itself.\n"; |
849 | } | |
850 | print "not "; | |
8ebc5c01 | 851 | } |
284102e8 | 852 | print "ok $_\n"; |
8ebc5c01 | 853 | } |
fb73857a | 854 | |
2a680da6 JH |
855 | # Give final advice. |
856 | ||
284102e8 JH |
857 | my $didwarn = 0; |
858 | ||
98daf176 | 859 | foreach (99..$last_locales) { |
284102e8 JH |
860 | if ($Problem{$_}) { |
861 | my @f = sort keys %{ $Problem{$_} }; | |
862 | my $f = join(" ", @f); | |
863 | $f =~ s/(.{50,60}) /$1\n#\t/g; | |
2a680da6 JH |
864 | |
865 | "#\n", | |
866 | "# The locale ", (@f == 1 ? "definition" : "definitions"), "\n#\n", | |
284102e8 JH |
867 | "#\t", $f, "\n#\n", |
868 | "# on your system may have errors because the locale test $_\n", | |
869 | "# failed in ", (@f == 1 ? "that locale" : "those locales"), | |
870 | ".\n"; | |
2a680da6 | 871 | print <<EOW; |
284102e8 JH |
872 | # |
873 | # If your users are not using these locales you are safe for the moment, | |
874 | # but please report this failure first to perlbug\@perl.com using the | |
875 | # perlbug script (as described in the INSTALL file) so that the exact | |
876 | # details of the failures can be sorted out first and then your operating | |
877 | # system supplier can be alerted about these anomalies. | |
878 | # | |
879 | EOW | |
880 | $didwarn = 1; | |
fb73857a | 881 | } |
882 | } | |
774d564b | 883 | |
26d80d95 | 884 | # Tell which locales were okay and which were not. |
2a680da6 | 885 | |
284102e8 | 886 | if ($didwarn) { |
26d80d95 | 887 | my (@s, @F); |
284102e8 JH |
888 | |
889 | foreach my $l (@Locale) { | |
890 | my $p = 0; | |
98daf176 | 891 | foreach my $t (102..$last_locales) { |
284102e8 | 892 | $p++ if $Problem{$t}{$l}; |
8ebc5c01 | 893 | } |
284102e8 | 894 | push @s, $l if $p == 0; |
26d80d95 | 895 | push @F, $l unless $p == 0; |
8ebc5c01 | 896 | } |
284102e8 | 897 | |
68d47915 CK |
898 | if (@s) { |
899 | my $s = join(" ", @s); | |
900 | $s =~ s/(.{50,60}) /$1\n#\t/g; | |
901 | ||
902 | warn | |
903 | "# The following locales\n#\n", | |
904 | "#\t", $s, "\n#\n", | |
905 | "# tested okay.\n#\n", | |
906 | } else { | |
26d80d95 LC |
907 | warn "# None of your locales were fully okay.\n"; |
908 | } | |
909 | ||
910 | if (@F) { | |
911 | my $F = join(" ", @F); | |
912 | $F =~ s/(.{50,60}) /$1\n#\t/g; | |
913 | ||
914 | warn | |
915 | "# The following locales\n#\n", | |
0e053d1e | 916 | "#\t", $F, "\n#\n", |
26d80d95 LC |
917 | "# had problems.\n#\n", |
918 | } else { | |
919 | warn "# None of your locales were broken.\n"; | |
68d47915 | 920 | } |
0e053d1e | 921 | |
c406fbf4 JH |
922 | if (@utf8locale) { |
923 | my $S = join(" ", @utf8locale); | |
924 | $S =~ s/(.{50,60}) /$1\n#\t/g; | |
925 | ||
926 | warn "#\n# The following locales\n#\n", | |
927 | "#\t", $S, "\n#\n", | |
928 | "# were skipped for the tests ", | |
929 | join(" ", sort {$a<=>$b} keys %utf8skip), "\n", | |
930 | "# because UTF-8 and locales do not work together in Perl.\n#\n"; | |
931 | } | |
8ebc5c01 | 932 | } |
90248788 | 933 | |
98daf176 KW |
934 | sub last_locales { 117 } |
935 | ||
c213d471 | 936 | $test_num = $last_locales; |
c213d471 | 937 | |
094a2f8c KW |
938 | # Test that tainting and case changing works on utf8 strings. These tests are |
939 | # placed last to avoid disturbing the hard-coded test numbers above this in | |
940 | # this file. | |
941 | setlocale(LC_ALL, "C"); | |
942 | { | |
943 | use locale; | |
944 | ||
094a2f8c KW |
945 | foreach my $function ("uc", "ucfirst", "lc", "lcfirst") { |
946 | my @list; # List of code points to test for $function | |
947 | ||
948 | # Used to calculate the changed case for ASCII characters by using the | |
949 | # ord, instead of using one of the functions under test. | |
950 | my $ascii_case_change_delta; | |
951 | my $above_latin1_case_change_delta; # Same for the specific ords > 255 | |
952 | # that we use | |
953 | ||
954 | # We test an ASCII character, which should change case and be tainted; | |
955 | # a Latin1 character, which shouldn't change case under this C locale, | |
956 | # and is tainted. | |
957 | # an above-Latin1 character that when the case is changed would cross | |
958 | # the 255/256 boundary, so doesn't change case and isn't tainted | |
959 | # (the \x{149} is one of these, but changes into 2 characters, the | |
960 | # first one of which doesn't cross the boundary. | |
961 | # the final one in each list is an above-Latin1 character whose case | |
962 | # does change, and shouldn't be tainted. The code below uses its | |
963 | # position in its list as a marker to indicate that it, unlike the | |
964 | # other code points above ASCII, has a successful case change | |
965 | if ($function =~ /^u/) { | |
966 | #@list = ("\xff", "\x{fb00}", "\x{149}", "\x{101}"); | |
967 | @list = ("", "a", "\xe0", "\xff", "\x{fb00}", "\x{149}", "\x{101}"); | |
968 | $ascii_case_change_delta = -32; | |
969 | $above_latin1_case_change_delta = -1; | |
970 | } | |
971 | else { | |
972 | @list = ("", "A", "\xC0", "\x{1E9E}", "\x{100}"); | |
973 | $ascii_case_change_delta = +32; | |
974 | $above_latin1_case_change_delta = +1; | |
975 | } | |
976 | $|=1; | |
977 | foreach my $j (0 .. $#list) { | |
978 | my $char = $list[$j]; | |
979 | #print STDERR __LINE__, ": $char\n"; | |
980 | #check_taint_not($i++, $char); | |
981 | utf8::upgrade($char); | |
982 | #check_taint_not($i++, $char); | |
983 | my $should_be = ($j == $#list) | |
984 | ? chr(ord($char) + $above_latin1_case_change_delta) | |
985 | : (length $char == 0 || ord($char) > 127) | |
986 | ? $char | |
987 | : chr(ord($char) + $ascii_case_change_delta); | |
988 | ||
989 | # This monstrosity is in order to avoid using an eval, which might | |
990 | # perturb the results | |
991 | my $changed = ($function eq "uc") | |
992 | ? uc($char) | |
993 | : ($function eq "ucfirst") | |
994 | ? ucfirst($char) | |
995 | : ($function eq "lc") | |
996 | ? lc($char) | |
997 | : ($function eq "lcfirst") | |
998 | ? lcfirst($char) | |
999 | : croak("Unexpected function \"$function\""); | |
c213d471 | 1000 | ok($changed eq $should_be, "$function(\"$char\") in C locale should be \"$should_be\", got \"$changed\""); |
094a2f8c KW |
1001 | |
1002 | # Tainting shouldn't happen for empty strings, or those characters | |
1003 | # above 255. | |
1004 | #print STDERR __LINE__, ": $char\n"; | |
1005 | (length($char) > 0 && ord($char) < 256) | |
36a42ae7 KW |
1006 | ? check_taint($changed) |
1007 | : check_taint_not($changed); | |
094a2f8c KW |
1008 | } |
1009 | } | |
1010 | } | |
1011 | ||
1012 | ||
fdf053ee | 1013 | print "1..$test_num\n"; |
906f284f | 1014 | |
90248788 | 1015 | # eof |