From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7765 invoked by alias); 16 May 2018 13:15:59 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42786 Received: (qmail 27500 invoked by uid 1010); 16 May 2018 13:15:59 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f43.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.43):SA:0(0.1/5.0):. Processed in 5.037119 secs); 16 May 2018 13:15:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, LONGWORDS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: stephane.chazelas@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=HOYf3mvHc9Dl1CsEYIbrypMFaaqaTN+7uyhdCQXWVJQ=; b=S10Ceb0VnE6hVPRNf5uBJHPnLIV4cCDt61H4xlDLurUNY9QWfYCR++1EUm7756DVcy jo56DWD9pCTCz4e69BuFCZbNDqOgVMheMfS4nPO4McChUUfYxqLwECfgVpRH5TJcZU8a NmPsLNT8juC+9xv5xGorlf7Eua7E9ZoU8CxyENke7A8Cal9uSyaPACeQi2FFsddzmW26 hIwUOQdxVGxgUUvGkbb5+82RoFkrH6bMaL5B9sciN6HKKGeLJV29eAZp8rHeVEehjEtH UIkfdyBpy6Ul5H2VVHc7B9Yl66sOCoIpMyqwCDzGBPOlyQ7qMoZXHUakOuH+lC8RA7hJ Nf4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=HOYf3mvHc9Dl1CsEYIbrypMFaaqaTN+7uyhdCQXWVJQ=; b=LK2FN+nlsGaOfM0xVO5HJxMuelj+/XWQ9xArLN7MuTzNuh2TvkCxNNpyXWpYMaavaI HZlt/Y0tINwntCb5R52EMz1NND1AoeIeWAsdeGU10vpMHh4Ih+ieOBug/XBcQzhVqabu y2odCgJSNqHe7khfCDQ2NNAJpMlQvqbfE/A8r7ji9VpB1Req3U2k6LBY+fliamsMRIEJ lHI8eX87UDjOjlAAFpT8MKRsiwj38pSW8XXzA8sohEkDljVG9OfGfX3IOoWmZhYhaqq+ kFLKMZ2BAoX/QtS9c8ER5+T3H5w9HjbVi+8Tmka52cKq76vnf1vHJAQ2P+G2LXIriQ70 ZZ/g== X-Gm-Message-State: ALKqPwciyrZ+N7ox8aYzjkJTJ+aEUmmm0+AjOA1TiiZud9g106rzianR mOJ8WwfDAxX2Dsb92t76B2o= X-Google-Smtp-Source: AB8JxZowOweNXu4y/qrwqFXBaAwPdiee+APPtRplE7hOQQXRVPyQHW82G02EEzVECm1Q/GZ1APvukw== X-Received: by 2002:a1c:af4b:: with SMTP id y72-v6mr603855wme.148.1526476550274; Wed, 16 May 2018 06:15:50 -0700 (PDT) Date: Wed, 16 May 2018 14:15:47 +0100 From: Stephane Chazelas To: Oliver Kiddle Cc: Zsh hackers list Subject: Re: [PATCH] [[:blank:]] only matches on SPC and TAB Message-ID: <20180516131547.GA1433@chaz.gmail.com> Mail-Followup-To: Oliver Kiddle , Zsh hackers list References: <20180513212553.GA29028@chaz.gmail.com> <20180514063611.GA7263@chaz.gmail.com> <20180514064431.GB7263@chaz.gmail.com> <20180514094733.308bff1a@camnpupstephen.cam.scsc.local> <20180514123425.GA19631@chaz.gmail.com> <20180514145056.3eedaea9@camnpupstephen.cam.scsc.local> <20180514155131.GC7263@chaz.gmail.com> <18720.1526411161@thecus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18720.1526411161@thecus> User-Agent: Mutt/1.5.24 (2015-08-30) 2018-05-15 21:06:01 +0200, Oliver Kiddle: [...] > For consistency with the other character classes, I think the best is to > follow POSIX and the other shells and have [:blank:] call iswblank(). > That is apply the patch plus whatever change the documentation needs to > reflect it. [...] 3rd version of the patch with doc update and check for isblank(). diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index 8b447e2..c791097 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -2004,7 +2004,7 @@ The character is 7-bit, i.e. is a single-byte character without the top bit set. ) item(tt([:blank:]))( -The character is either space or tab +The character is a blank character ) item(tt([:cntrl:]))( The character is a control character diff --git a/NEWS b/NEWS index 1db9da6..1786897 100644 --- a/NEWS +++ b/NEWS @@ -4,7 +4,14 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH Note also the list of incompatibilities in the README file. -Changes from %.5 to 5.5.1 +Changes from 5.5.1 to FIXME +--------------------------- + +In shell patterns, [[:blank:]] now honours the locale instead of +matching exclusively on space and tab, like for the other POSIX +character classes or in extended regular expressions. + +Changes from 5.5 to 5.5.1 ------------------------- Apart from a fix for a configuration problem finding singal names from diff --git a/Src/pattern.c b/Src/pattern.c index fc7c737..97a6d9c 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -3605,7 +3605,7 @@ mb_patmatchrange(char *range, wchar_t ch, int zmb_ind, wint_t *indptr, int *mtp) return 1; break; case PP_BLANK: - if (ch == L' ' || ch == L'\t') + if (iswblank(ch)) return 1; break; case PP_CNTRL: @@ -3840,7 +3840,14 @@ patmatchrange(char *range, int ch, int *indptr, int *mtp) return 1; break; case PP_BLANK: - if (ch == ' ' || ch == '\t') +#if !defined(HAVE_ISBLANK) && !defined(isblank) +/* + * isblank() is GNU and C99. There's a remote chance that some + * systems still don't support it. + */ +#define isblank(c) (c == ' ' || c == '\t') +#endif + if (isblank(ch)) return 1; break; case PP_CNTRL: diff --git a/configure.ac b/configure.ac index 4329afb..c2efda5 100644 --- a/configure.ac +++ b/configure.ac @@ -1304,6 +1304,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \ memcpy memmove strstr strerror strtoul \ getrlimit getrusage \ setlocale \ + isblank \ uname \ signgam tgamma \ scalbn \ @@ -2564,10 +2565,10 @@ AC_HELP_STRING([--enable-multibyte], [support multibyte characters]), [AC_CACHE_VAL(zsh_cv_c_unicode_support, AC_MSG_NOTICE([checking for functions supporting multibyte characters]) [zfuncs_absent= - for zfunc in iswalnum iswcntrl iswdigit iswgraph iswlower iswprint \ -iswpunct iswspace iswupper iswxdigit mbrlen mbrtowc towupper towlower \ -wcschr wcscpy wcslen wcsncmp wcsncpy wcrtomb wcwidth wmemchr wmemcmp \ -wmemcpy wmemmove wmemset; do + for zfunc in iswalnum iswblank iswcntrl iswdigit iswgraph iswlower \ + iswprint iswpunct iswspace iswupper iswxdigit mbrlen mbrtowc \ + towupper towlower wcschr wcscpy wcslen wcsncmp wcsncpy wcrtomb \ + wcwidth wmemchr wmemcmp wmemcpy wmemmove wmemset; do AC_CHECK_FUNC($zfunc, [:], [zfuncs_absent="$zfuncs_absent $zfunc"]) done -- Stephane