| 1 |
#!/bin/sh |
| 2 |
# Exercise a DFA range bug that arises only with a unibyte encoding |
| 3 |
# for which the wide-char-to-single-byte mapping is nontrivial. |
| 4 |
# E.g., the regexp, [C] would fail to match C in a unibyte locale like |
| 5 |
# ru_RU.KOI8-R for any C whose wide-char representation differed from |
| 6 |
# its single-byte equivalent. |
| 7 |
|
| 8 |
# Copyright (C) 2011-2025 Free Software Foundation, Inc. |
| 9 |
|
| 10 |
# This program is free software: you can redistribute it and/or modify |
| 11 |
# it under the terms of the GNU General Public License as published by |
| 12 |
# the Free Software Foundation, either version 3 of the License, or |
| 13 |
# (at your option) any later version. |
| 14 |
|
| 15 |
# This program is distributed in the hope that it will be useful, |
| 16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 |
# GNU General Public License for more details. |
| 19 |
|
| 20 |
# You should have received a copy of the GNU General Public License |
| 21 |
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 22 |
|
| 23 |
. "${srcdir=.}/init.sh"; path_prepend_ ../src |
| 24 |
require_ru_RU_koi8_r |
| 25 |
LC_ALL=ru_RU.KOI8-R |
| 26 |
export LC_ALL |
| 27 |
|
| 28 |
fail=0 |
| 29 |
|
| 30 |
i=128 |
| 31 |
while :; do |
| 32 |
in=in-$i |
| 33 |
octal=$(printf '%03o' $i) |
| 34 |
b=$(printf "\\$octal") |
| 35 |
echo "$b" > $in || framework_failure_ |
| 36 |
grep "[$b]" $in > out || fail=1 |
| 37 |
compare out $in || fail=1 |
| 38 |
|
| 39 |
test $i = 255 && break |
| 40 |
i=$(expr $i + 1) |
| 41 |
done |
| 42 |
|
| 43 |
Exit $fail |