Blame tests/false-match-mb-non-utf8
|
Packit |
709fb3 |
#! /bin/sh
|
|
Packit |
709fb3 |
# Test for false matches in grep 2.19..2.26 in multibyte, non-UTF8 locales
|
|
Packit |
709fb3 |
#
|
|
Packit |
709fb3 |
# Copyright (C) 2016-2017 Free Software Foundation, Inc.
|
|
Packit |
709fb3 |
#
|
|
Packit |
709fb3 |
# Copying and distribution of this file, with or without modification,
|
|
Packit |
709fb3 |
# are permitted in any medium without royalty provided the copyright
|
|
Packit |
709fb3 |
# notice and this notice are preserved.
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
. "${srcdir=.}/init.sh"; path_prepend_ ../src
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Add "." to PATH for the use of get-mb-cur-max.
|
|
Packit |
709fb3 |
path_prepend_ .
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
fail=0
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
loc=zh_CN.gb18030
|
|
Packit |
709fb3 |
test "$(get-mb-cur-max $loc)" = 4 || skip_ "no support for the $loc locale"
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# This must not match: the input is a single character, \uC9 followed
|
|
Packit |
709fb3 |
# by a newline. But it just so happens that that character is made up
|
|
Packit |
709fb3 |
# of four bytes, the last of which is the digit, 7, and grep's DFA
|
|
Packit |
709fb3 |
# matcher would mistakenly report that ".*7" matches that input line.
|
|
Packit |
709fb3 |
printf '\2010\2077\n' > in || framework_failure_
|
|
Packit |
709fb3 |
returns_ 1 env LC_ALL=$loc grep -E '.*7' in || fail=1
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
returns_ 1 env LC_ALL=$loc grep -E '.{0,1}7' in || fail=1
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
returns_ 1 env LC_ALL=$loc grep -E '.?7' in || fail=1
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
# Similar for the \ue9 code point, which ends in an "m" byte.
|
|
Packit |
709fb3 |
loc=zh_HK.big5hkscs
|
|
Packit |
709fb3 |
test "$(get-mb-cur-max $loc)" = 2 || skip_ "no support for the $loc locale"
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
printf '\210m\n' > in || framework_failure_
|
|
Packit |
709fb3 |
returns_ 1 env LC_ALL=$loc grep '.*m' in || fail=1
|
|
Packit |
709fb3 |
|
|
Packit |
709fb3 |
Exit $fail
|