VirtualBox

source: kBuild/trunk/src/grep/tests/false-match-mb-non-utf8@ 3532

Last change on this file since 3532 was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#! /bin/sh
2# Test for false matches in grep 2.19..2.26 in multibyte, non-UTF8 locales
3#
4# Copyright (C) 2016-2021 Free Software Foundation, Inc.
5#
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9
10. "${srcdir=.}/init.sh"; path_prepend_ ../src
11
12# Add "." to PATH for the use of get-mb-cur-max.
13path_prepend_ .
14
15fail=0
16
17loc=zh_CN.gb18030
18test "$(get-mb-cur-max $loc)" = 4 || skip_ "no support for the $loc locale"
19
20# This must not match: the input is a single character, \uC9 followed
21# by a newline. But it just so happens that that character is made up
22# of four bytes, the last of which is the digit, 7, and grep's DFA
23# matcher would mistakenly report that ".*7" matches that input line.
24printf '\2010\2077\n' > in || framework_failure_
25returns_ 1 env LC_ALL=$loc grep -E '.*7' in || fail=1
26
27returns_ 1 env LC_ALL=$loc grep -E '.{0,1}7' in || fail=1
28
29returns_ 1 env LC_ALL=$loc grep -E '.?7' in || fail=1
30
31# Similar for the \ue9 code point, which ends in an "m" byte.
32loc=zh_HK.big5hkscs
33test "$(get-mb-cur-max $loc)" = 2 || skip_ "no support for the $loc locale"
34
35printf '\210m\n' > in || framework_failure_
36returns_ 1 env LC_ALL=$loc grep '.*m' in || fail=1
37
38Exit $fail
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette