From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12861 invoked from network); 25 Jul 2023 18:36:12 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Jul 2023 18:36:12 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1690310172; b=kQD5GBSafK9J04lBsCEvdrUC1MOw3daP52wA9Ah+51lBIjCSGBk32+JQom3Awcl0RbNKoDYNG4 VSeYmo1c4ajZxn6x/iOUUr1BSoobUkcRBi/XZ1xEHb2Bxj2tmKRDyUASKqjZbeoquga7IK7rr4 isKwem6DdFyH8WVH2ttzn28ifohOhE2mIC6ZVTJtHq6++UyjTLgCyUtWQKgNZBUis91gieCBk+ PdMgYr1rvNpWVe+fL3eha59HwAIf7BJl6YgPvjVGmEbId5j336ycQYYoV0rTVEvMPtOBjfDgFf AIcxURuhStq4gLbRyidVpVGIy99Zwc+Hd9qhLutqDenhKA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f54.google.com) smtp.remote-ip=209.85.167.54; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1690310172; bh=NDv/JC+XQBAUF/8PsrOzw9tNh5iIz9xg7Crn6IZNhgQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature: DKIM-Signature; b=cVUIT5BakS8gq0s8EAzC5dIMJZh4WKqSwVQu8KJZMVt5GYqYyqkfEGRCgJYLjQ7PFyUnVCFzzh S5vpm8hC/DpzzwwdjNc2faoBG8y+evpYBWwUWqrQH3Fdu9ljHSwJdko4VX6ZSqA/6PodsHuSxy YZFQNXPvBucvOhYY+ajzRKabc6yD9u++IrZhuZdK58hgaEG28FmXsMW3jxI74+xIsNvufDARPG g/f2wOrogM7OZaN9ThAmfwJvroya7mxaKtrYvc88QzVh5NNfmLEGoAgef0VkLy/JSjt/zDjLyB 4rkZ02Q5G3lqXOlqxr5SNtjXBUbqdLArPVvqV1Crx1wnDw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=U8GZ4x2qyN7PjuStmgQ7L+rhqs5ssY+am12i1oay/iY=; b=bY19ilyjqkpfEL6+tFSKyoyk27 C5AyvDxDmEYrbU6cyAeC0LqemOKiYIPlxB79Vaf9rXmScxIyu1MEKEevSPp1j+0PG34tsykwOnyo4 EoagQu4igJYpZQhaaA9CwkfN5NWtaC0IsvPNGz5pIu5sUtBzuvOf9CPFjxH7YNr2Owvep8rIMGTot kT0U9PjUxBOt9u78EbU9hqCsnfOsffdH+0RF5SBLPM9iXAzp1qKZOSaF1KY3GWlFTKt3NoVX4NiCa ZPUyE8aC5Y/YM2waS0PfclqlP7BtotRQfrs4c+YuS3DgoaV7waWJe2CR+aVCn/I1F6WzSZ+gE+l+p ajomvj9A==; Received: by zero.zsh.org with local id 1qOMtH-000Gtu-Dx; Tue, 25 Jul 2023 18:36:11 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f54.google.com) smtp.remote-ip=209.85.167.54; dkim=pass header.d=brasslantern-com.20221208.gappssmtp.com header.s=20221208 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-lf1-f54.google.com ([209.85.167.54]:51341) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1qOMsx-000GaW-7e; Tue, 25 Jul 2023 18:35:53 +0000 Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-4fe0d5f719dso344823e87.2 for ; Tue, 25 Jul 2023 11:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20221208.gappssmtp.com; s=20221208; t=1690310150; x=1690914950; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=U8GZ4x2qyN7PjuStmgQ7L+rhqs5ssY+am12i1oay/iY=; b=AZ0AUP1NILGSFdbYvg1yniFFnTlKI6cPMux+CKn/DgtDAq+lI5n9BvL0C3zOdj/L7j 9nfTPfb6XAy5whk0iY6H8mQ5YiD3yxKogEJVxaUv2RjpeU3lJDhudtUYhAri1E8mmsvk qlYViXLLMO3zyVncSqyyfUsdjLiwTnQh072GCNHPCtAjzElxGELFSWGw2FHDSMDc7q9X BFqFTlEy2dCB5aMMrL4exzGYSrTTuA//Tmh2NbXUtOHuej63WccLG0WbIGC75II7Pl6m HNB7h6DA7nKkNxjedgvt84fNHj7PDLitnB9VLy4L7UQsHniZJoSClukTY8qr32jcbSob Qykg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690310150; x=1690914950; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U8GZ4x2qyN7PjuStmgQ7L+rhqs5ssY+am12i1oay/iY=; b=dyuvXBCbpaVclQ0+9xDONI/42TqY4BG1U+iri7THdf6o8ExZVbSLTQ0LsKEpbKbY6k JjQKFEMxvvvllVpBllUPLmIWgVL1lGHzaT8cwyqIIQ+IqbWYO241GtMh0stcaaGGWIBe mINIxfh/QZm4BWKKWgsZVN8RD2cyZIfkRIPQnZTcZeYeDSvKCypbDfmnDjSu9K/a18dJ bCwRNcbbKsYz2GCky69T0xAmP9ueyEK79Wdk7JZxtldEq7LeaTTguktfmvuxPKe6U84o 0JN6SHS8Q5hs2QR+a0+Y2hJOdpJDLqizTbTRxanuxe3rjePjCR18DT/ylNNFtTgRe/hL MoOQ== X-Gm-Message-State: ABy/qLbb9ag3IKQLT1b5TdlUNOvujuiceBoGCn3bVJajPWwdW4KimNVL I7uaFcU6s74r9ao6r/kPpOnJiKMg2ReHtG9RofPP1A== X-Google-Smtp-Source: APBJJlFoBwwF2lFC4MdwOaiN2D9ZdExdpuCJpqmO7iL4MGIwrSDTVXBuf7h7MBXzzebqvUD+Y5IZ01swQhLRBMs+s+U= X-Received: by 2002:a2e:98d3:0:b0:2b6:e6cc:9057 with SMTP id s19-20020a2e98d3000000b002b6e6cc9057mr8892249ljj.51.1690310149812; Tue, 25 Jul 2023 11:35:49 -0700 (PDT) MIME-Version: 1.0 References: <599e3c13-53a5-1823-6d0d-68dd722967d9@crans.org> In-Reply-To: <599e3c13-53a5-1823-6d0d-68dd722967d9@crans.org> From: Bart Schaefer Date: Tue, 25 Jul 2023 11:35:38 -0700 Message-ID: Subject: Re: Pattern bug on (a*|)~^(*b) To: Johan Grande Cc: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 51990 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Tue, Jul 25, 2023 at 6:19=E2=80=AFAM Johan Grande wrot= e: > > In zsh 5.8.1 (x86_64-ubuntu-linux-gnu) with extended_glob, > > [[ "ab" =3D (|a*)~^(*b) ]] > > incorrectly (unless I'm mistaken) returns 1. This is not precisely a bug, it's expected behavior. Alternation with (x|y) tries the patterns in left-to-right order and has lower precedence than p~q (despite the parens). The upshot is that (|a*)~^(*b) matches like (|)~^(*b) whereas (a*|)~^(*b) is like (a*)~^(*b) and the final bit of the puzzle is that the double negative in ~^(b*) cannot match the empty result from (|). The same thing happens with globbing, touch a file named "ab" and then try those patterns for filename generation. PWS may be able to explain some more about the precedence of (x|y) vs. (p~q). To resolve this, you have to put the p~q inside the x|y, like [[ "ab" =3D (|a*~^(*b)) ]]