From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 51CA31F5A0 for ; Fri, 3 Feb 2023 16:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233089AbjBCQza (ORCPT ); Fri, 3 Feb 2023 11:55:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231766AbjBCQz3 (ORCPT ); Fri, 3 Feb 2023 11:55:29 -0500 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D1446D4A for ; Fri, 3 Feb 2023 08:55:28 -0800 (PST) Received: (qmail 26330 invoked by uid 109); 3 Feb 2023 16:55:28 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Fri, 03 Feb 2023 16:55:28 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 10114 invoked by uid 111); 3 Feb 2023 16:55:27 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Fri, 03 Feb 2023 11:55:27 -0500 Authentication-Results: peff.net; auth=none Date: Fri, 3 Feb 2023 11:55:27 -0500 From: Jeff King To: "D. Ben Knoble" Cc: demerphq , git@vger.kernel.org Subject: Re: grep: fix multibyte regex handling under macOS (1819ad327b7a1f19540a819813b70a0e8a7f798f) Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Thu, Feb 02, 2023 at 03:47:28PM -0500, D. Ben Knoble wrote: > Further, the following C program compiles without warnings (except for > the unused main parameters): > ``` > #include > #include > #include > #include > > int main(int argc, char **argv) { > regex_t re; > int ret = regcomp(&re, "[\xc0-\xff][\x80-\xbf]+", REG_EXTENDED | > REG_NEWLINE); > /* assert(ret != 0); */ > size_t errbuf_size = regerror(ret, &re, NULL, 0); > char errbuf[errbuf_size]; > regerror(ret, &re, errbuf, errbuf_size); > printf("%s\n", errbuf); > } > ``` Just a guess, but does calling: setlocale(LC_CTYPE, ""); at the start of the program change things (you'll probably need to also include locale.h)? I don't have a macos system to test on. -Peff