From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91474 invoked by alias); 9 Jan 2019 13:35:27 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 91458 invoked by uid 89); 9 Jan 2019 13:35:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-qt1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=b9Giq6PfHBh2W2YEfGpD4yL7gtWn4nAsY5K2P/MmW3A=; b=P2oUu+GKuY6unGQKJpWOIqyhWD3xJWc2T72M5GU9xFUdWvielpJzwU3U+cyrN5Is4h D5P52qi9EZyoVc1+bZhUu0zmsOO8M55fApeU44Z8jBUD/NeVk9yOkqJ3r9ppqcKTR0y8 8X2r1kI8JvEQUyh+/7Ko9/wBPSVR+Vf9u2ko8= Return-Path: Subject: Re: [PATCH] Fix handling of collating elements in fnmatch (bug 17396, bug 16976) To: libc-alpha@sourceware.org References: <87zhscfq0h.fsf@oldenburg2.str.redhat.com> From: Adhemerval Zanella Openpgp: preference=signencrypt Message-ID: Date: Wed, 09 Jan 2019 13:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-01/txt/msg00203.txt.bz2 On 09/01/2019 11:20, Andreas Schwab wrote: > diff --git a/sysdeps/s390/wmemcmp.c b/posix/tst-fnmatch4.c > similarity index 52% > copy from sysdeps/s390/wmemcmp.c > copy to posix/tst-fnmatch4.c > index ec0b4027f8..dc13f89288 100644 > --- a/sysdeps/s390/wmemcmp.c > +++ b/posix/tst-fnmatch4.c > @@ -1,5 +1,5 @@ > -/* Multiple versions of wmemcmp. > - Copyright (C) 2015-2019 Free Software Foundation, Inc. > +/* Test for fnmatch handling of collating elements > + Copyright (C) 2019 Free Software Foundation, Inc. > This file is part of the GNU C Library. > > The GNU C Library is free software; you can redistribute it and/or > @@ -16,23 +16,35 @@ > License along with the GNU C Library; if not, see > . */ > > -#include > - > -#if HAVE_WMEMCMP_IFUNC > -# include > -# include > - > -# if HAVE_WMEMCMP_C > -extern __typeof (wmemcmp) WMEMCMP_C attribute_hidden; > -# endif > - > -# if HAVE_WMEMCMP_Z13 > -extern __typeof (wmemcmp) WMEMCMP_Z13 attribute_hidden; > -# endif > - > -s390_libc_ifunc_expr (wmemcmp, wmemcmp, > - (HAVE_WMEMCMP_Z13 && (hwcap & HWCAP_S390_VX)) > - ? WMEMCMP_Z13 > - : WMEMCMP_DEFAULT > - ) > -#endif > +#include > +#include > +#include > + > +static int > +do_test_locale (const char *locale) > +{ > + const char *pattern = "[[.ch.]]"; > + > + if (setlocale (LC_ALL, locale) == NULL) > + { > + printf ("could not set locale %s\n", locale); > + return 1; > + } > + > + if (fnmatch (pattern, "ch", 0) != 0) > + { > + printf ("%s didn't match in locale %s\n", pattern, locale); > + return 1; > + } > + > + return 0; > +} Maybe TEST_COMPARE on both check? > + > +static int > +do_test (void) > +{ > + return (do_test_locale ("cs_CZ.ISO-8859-2") > + || do_test_locale ("cs_CZ.UTF-8")); > +} > + > +#include > diff --git a/posix/tst-fnmatch5.c b/posix/tst-fnmatch5.c > new file mode 100644 > index 0000000000..5ebff1f424 > --- /dev/null > +++ b/posix/tst-fnmatch5.c > @@ -0,0 +1,52 @@ > +/* Test for fnmatch handling of collating elements > + Copyright (C) 2019 Free Software Foundation, Inc. > + This file is part of the GNU C Library. > + > + The GNU C Library is free software; you can redistribute it and/or > + modify it under the terms of the GNU Lesser General Public > + License as published by the Free Software Foundation; either > + version 2.1 of the License, or (at your option) any later version. > + > + The GNU C Library is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + Lesser General Public License for more details. > + > + You should have received a copy of the GNU Lesser General Public > + License along with the GNU C Library; if not, see > + . */ > + > +#include > +#include > +#include > +#include > + > +#define LENGTH 20000000 > + > +static char pattern[LENGTH + 7]; > + > +static int > +do_test (void) > +{ > + if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) > + { > + puts ("could not set locale"); > + return 1; > + } > + pattern[0] = '['; > + pattern[1] = '['; > + pattern[2] = '.'; > + memset (pattern + 3, 'a', LENGTH); > + pattern[LENGTH + 3] = '.'; > + pattern[LENGTH + 4] = ']'; > + pattern[LENGTH + 5] = ']'; > + int ret = fnmatch (pattern, "a", 0); > + if (ret == 0) > + { > + puts ("fnmatch returned 0 for invalid pattern"); > + return 1; > + } > + return 0; > +} > + > +#include Same as before.