From owner-freebsd-hackers@freebsd.org Tue Jan 23 14:17:09 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0C6FED6101 for ; Tue, 23 Jan 2018 14:17:09 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-io0-f182.google.com (mail-io0-f182.google.com [209.85.223.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 707A07D69D for ; Tue, 23 Jan 2018 14:17:09 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-io0-f182.google.com with SMTP id l17so1070337ioc.3 for ; Tue, 23 Jan 2018 06:17:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=RnD9rOnAyVDlLQF4AxQznLbQtQswgXj4rDW9jEerqjU=; b=khMQIFIfUwB8YecPnPWZsmhtC91rU5io0pLKaaejIy1NBfXKAQ9CgN8MVWgXMQniGf gWiqUHpHtH/UKVQch6E3+d93EP1a6YeayoqTmfhIooPEfdHGOp7fWy+3rhEm4yZBp3GU FWq09+r8juQKMfliYZkYhv4aoYNrdoSFQkrf9df/Dh8QnKf54/TIZjOuIvcqZ03s+cjc Nk+jc8yl+0WXfruP/pMaslc6HnU+iw6lloBx2I/l1U1gDPUKVM8PFK77jAnLcOIj/PAh tAu8Et9sZ4dsy7FpPvaG+w6lQyZ5WbhlXGWRX9u/u0j67ydkVJJlmdR5wkWusp5WdRiP fo3A== X-Gm-Message-State: AKwxytdxt7IGUSLxURFurAqrKO03HwhLtfkBklAKrheF+6kpLvNl3scs dOs9g6z1Rnt02trcrUOfg//+UuXL X-Google-Smtp-Source: AH8x224BWyEWRG0TZYGb9cHpeAEykmhshF0ICYuJqP8to8DuYXr5nlHVoDGoZsgX00j6xCfwzipojg== X-Received: by 10.107.164.134 with SMTP id d6mr3752063ioj.176.1516716654405; Tue, 23 Jan 2018 06:10:54 -0800 (PST) Received: from mail-io0-f169.google.com (mail-io0-f169.google.com. [209.85.223.169]) by smtp.gmail.com with ESMTPSA id f139sm3890622iof.35.2018.01.23.06.10.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jan 2018 06:10:54 -0800 (PST) Received: by mail-io0-f169.google.com with SMTP id 25so1038962ioj.9 for ; Tue, 23 Jan 2018 06:10:53 -0800 (PST) X-Received: by 10.107.53.221 with SMTP id k90mr3713669ioo.6.1516716653378; Tue, 23 Jan 2018 06:10:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.157.12 with HTTP; Tue, 23 Jan 2018 06:10:32 -0800 (PST) In-Reply-To: References: From: Kyle Evans Date: Tue, 23 Jan 2018 08:10:32 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: libc/regex: r302824 added invalid check breaking collating ranges To: Yuri Pankov Cc: FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jan 2018 14:17:09 -0000 On Mon, Jan 22, 2018 at 11:36 PM, Yuri Pankov wrote: > On Tue, Jan 23, 2018 at 03:53:19AM +0300, Yuri Pankov wrote: >> >> (CCing Kyle as he's working on regex at the moment and not because he >> broke something) >> >> Hi, >> >> r302284 added an invalid check which breaks collating ranges: >> >> -if (table->__collate_load_error) { >> - (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE); >> +if (table->__collate_load_error || MB_CUR_MAX > 1) { >> + (void)REQUIRE(start <= finish, REG_ERANGE); >> >> The "MB_CUR_MAX > 1" is wrong, we should be doing proper comparison >> according to current locale's collation and not simply comparing the >> wchar_t values. > > > After re-reading the specification I now see that what looked like a bug is > actually an implementation choice, though the one that needs to be > documentated. I'll update the man page if anyone is willing to review (and > commit) the changes. Can you point to the section of specification that indicates this is OK behavior? It doesn't seem desirable, but I see that GNU systems will operate in the same manner that we do now.