about summary refs log tree commit diff
path: root/posix/tst-regexloc.c
diff options
context:
space:
mode:
authorMike FABIAN <mfabian@redhat.com>2018-01-23 17:29:36 +0100
committerMike FABIAN <mfabian@redhat.com>2018-02-27 17:00:21 +0100
commitac3a3b4b0d561d776b60317d6a926050c8541655 (patch)
tree7e70a988722d787f4056db70e74df57be458eb55 /posix/tst-regexloc.c
parent770cbe147cf33580e05ba6de78993c3070c5c2f8 (diff)
downloadglibc-ac3a3b4b0d561d776b60317d6a926050c8541655.tar.gz
glibc-ac3a3b4b0d561d776b60317d6a926050c8541655.tar.xz
glibc-ac3a3b4b0d561d776b60317d6a926050c8541655.zip
Fix test cases tst-fnmatch and tst-regexloc for the new iso14651_t1_common file.
See:

http://pubs.opengroup.org/onlinepubs/7908799/xbd/re.html

> A range expression represents the set of collating elements that fall
> between two elements in the current collation sequence,
> inclusively. It is expressed as the starting point and the ending
> point separated by a hyphen (-).
>
> Range expressions must not be used in portable applications because
> their behaviour is dependent on the collating sequence. Ranges will be
> treated according to the current collating sequence, and include such
> characters that fall within the range based on that collating
> sequence, regardless of character values. This, however, means that
> the interpretation will differ depending on collating sequence. If,
> for instance, one collating sequence defines ä as a variant of a,
> while another defines it as a letter following z, then the expression
> [ä-z] is valid in the first language and invalid in the second.

Therefore, using [a-z] does not make much sense except in the C/POSIX locale.
The new iso14651_t1_common lists upper case and  lower case Latin characters
in a different order than the old one which causes surprising results
for example in the de_DE locale: [a-z] now includes A because A comes
after a in iso14651_t1_common but does not include Z because that comes
after z in iso14651_t1_common.

	* posix/tst-fnmatch.input: Fix results for range expressions
        for non C locales.
	* posix/tst-regexloc.c: Do not use a range expression for
        de_DE.ISO-8859-1 locale.
Diffstat (limited to 'posix/tst-regexloc.c')
-rw-r--r--posix/tst-regexloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/posix/tst-regexloc.c b/posix/tst-regexloc.c
index 60235b4d3b..7fbc496d0c 100644
--- a/posix/tst-regexloc.c
+++ b/posix/tst-regexloc.c
@@ -29,8 +29,8 @@ do_test (void)
 
   if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
     puts ("cannot set locale");
-  else if (regcomp (&re, "[a-f]*", 0) != REG_NOERROR)
-    puts ("cannot compile expression \"[a-f]*\"");
+  else if (regcomp (&re, "[abcdef]*", 0) != REG_NOERROR)
+    puts ("cannot compile expression \"[abcdef]*\"");
   else if (regexec (&re, "abcdefCDEF", 1, mat, 0) == REG_NOMATCH)
     puts ("no match");
   else