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.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19514 invoked from network); 1 Aug 2023 13:20:00 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 1 Aug 2023 13:20:00 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1690896000; b=mjgKJZJmM6OE8kpaS4t1y3WSOyvvtmk5zqmoujhhnxuLAZrFnuPLHmdhcP7raU0l9NsfnUVVhK F/o6mohzACRH0wcAdwqJouODcKi4EZDOoBuX8u1R0lfZDdnU6QpWZeNnpLepdJttWcg37qHQRY +5CCnCbm2iQMPSyvec6ysnT/ugsPDOiAi1AB+N8vwh8FXZgcqnmFKLYKOVJVIGw/zl22BUdfyv BbYm/Y539NljuTfF3K28Fq3Xfzrh9OXyDmPhrmFGt8LYpvc+eBDr9GcBCpDu4HRhXhibU7huMA FoaTh8e7z4WOVnZs1EKnOqMyxdDvA9HM01F0OKIbalOrAw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (redisdead.crans.org) smtp.remote-ip=185.230.79.39; dkim=pass header.d=crans.org header.s=mail header.a=rsa-sha256; dmarc=none header.from=crans.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1690896000; bh=tRR4v8Gta4ylQ/gPTK0XmbrkZURxEuCDImx9I3qZ7oU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:To:Subject:MIME-Version:Date:Message-ID:DKIM-Signature: DKIM-Signature; b=QZb3NX6k0LVHpNYDBgXpRbH5WSrxueBYPUwcDyECtVer7Me9gFtyf8GN92Ka4wRo2sdmNJjBk4 l3MwDVkwA5lJgCbq4FEb/ni+byWrHEAqEKoLrC+4CLa/sJ0SVqPkfz+3PWBH0kOytsTYnyVuHJ R0B5YL7MsdH+4CGFIt9eFXlCtqJbCO2UC8PnKSQaW01JdtLpxGN43o0w9EdOokqmR/RW9ITfq9 WsszFRTPdPFd1ZvtfNT5B5jy34XIghjbY6nHS72O55TUMMIewlR/Jt2EuPP+8+gHbBn2M9Z6MD 4yzooZaIzxEQgbw848vPBgjymLmmZL89sA4UcsTXYJLZ5w==; 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:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=RqVwD2hPawoFaq1/tlfxh1zT5hU72VBJ9Tny1Q5KpIo=; b=pFR1xW9fK4bDLXWavbeEAx8Dav GRMjY6LmQlREgdowwj2fFjPbhshVZnDBAtk53tT1HBeoMQVtQbKVSgwD7d7Qe1S5qPnRG0lVageim hvgaX7yUw68egJjMrHB0baHGJA9gbYcCGXsAMGX5/PzFGgDmzFFN3ju3gcmKhqnrcO3aDoHi79q4P VX2mFXX10zv3D1uZJfWLbC6xi0Jm8y/EZOoSMkhFKas5M0KxijgtOULfw7iLG0MRnDAST8Qzpy7FO PaaHN08G3DJVIpEqVp3lRCBcA5rFVuP90aMd4KB/8IKqO80JUxNDbn+3bqyrjFECbGeGqAMrtUqD0 +OTUO64Q==; Received: by zero.zsh.org with local id 1qQpI5-000JLS-EE; Tue, 01 Aug 2023 13:19:57 +0000 Authentication-Results: zsh.org; iprev=pass (redisdead.crans.org) smtp.remote-ip=185.230.79.39; dkim=pass header.d=crans.org header.s=mail header.a=rsa-sha256; dmarc=none header.from=crans.org; arc=none Received: from redisdead.crans.org ([185.230.79.39]:59406) (DNSSEC AD) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1qQpHN-000J1L-QI; Tue, 01 Aug 2023 13:19:15 +0000 Received: from [IPV6:2a01:e0a:1aa:1110:f148:d617:42f2:4e43] (unknown [IPv6:2a01:e0a:1aa:1110:f148:d617:42f2:4e43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by redisdead.crans.org (Postfix) with ESMTPSA id F39C2173F; Tue, 1 Aug 2023 15:19:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crans.org; s=mail; t=1690895954; bh=tRR4v8Gta4ylQ/gPTK0XmbrkZURxEuCDImx9I3qZ7oU=; h=Date:Subject:To:References:From:In-Reply-To:From; b=av0fzq9yLv9mNSe4cee71NGhVfS5J1kKACc+oFzY+snqTYZXRRxiX5xQ2SAvYcL7m Yau/el3Q8wZtjHNzUtOb3/EbkIhJ+yskpe1uKJcfHwjiZ5spfE+uYE0VxpOt/Cd0Vm ibIUUBVq7UmLcKWZC3ObY08bCbS1XDLArl3BKeGzcTxNkfufMeby6Fthjs+p99HU8/ ML7y8OmAFJq9X9wMLO8rZ7K35myc+l45FPVEvJ82vMI9ifMuPX4iUqaO4Qkc0mMkEj zBEUWdL+aE2KZ2A+sbFM40h9oapNimJXcJJfUQAM2IK+NUTFWJCn0W0jX6Wcqdne3p oryIIgte/3koBJBhMlFsi/slx3E6luz+Jj6si5a4o8pJaovjlLR9qulRMZlI+JGyug Gh2e4HWSyLnBUlEcjRB+gn7Z6tNJhgDA5sMhLOp+ltqoY4wLj4vMTderIZpu34HLxf EEU6NeUwsEiQByzcj2h1bzD6+yV5FI2/43QnjpF9YXwvlWaTE5Q+Ln41IJ2RiGi7sp 2MrlbJUeM4QQm1P+H/GTuYVBJ3/sICpZ2O4dHxd43XkiT8TeVDVCF3RMX/hSoZ7SJ9 X+X6j1mPmIbRIP/LMDc7C5A2RBPHUClSz4leoAMgmVlLYLsJQXhoTE7lzAQNR/HuxQ q6nUuVvklb1sdZnOVnHLrNnM= Message-ID: <16673694-5299-cf1c-8553-c3d703d942d0@crans.org> Date: Tue, 1 Aug 2023 15:19:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.1 Subject: Re: Pattern bug on (a*|)~^(*b) To: Bart Schaefer , zsh-workers@zsh.org References: <599e3c13-53a5-1823-6d0d-68dd722967d9@crans.org> <8c33aa3a-fde5-45ce-8f22-c817c6fa4a9a@crans.org> <20230728064106.ufcfaqondhn3wge7@chazelas.org> Content-Language: en-US, en-AU, fr From: Johan Grande In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Seq: 52009 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: Le 29/07/2023 à 03:35, Bart Schaefer a écrit : > On Thu, Jul 27, 2023 at 11:41 PM Stephane Chazelas > wrote: >> >> I have to say I'm with the OP and don't understand that explanation >> either. > > In the absence of a direct response from PWS, I'll just point you to > his comments in pattern.c, some of which date from before we had a > git repository: [...] > > By my reading, zero-length matches may be short-circuited to avoid > pathological behavior. Thank you for your answers, though the latter is rather obscure to me. If you can answer, or if PWS reads this: What globbing should do is one thing, but in the meantime I'm interested to know what I can safely put on the left-hand side of ~ with the current implementation. Does this behavior concern any case of backtracking, or only (...|...) patterns, or, which would be even better, only (|...) and (...|) patterns? In my project, I use globbing to find files with tags matching patterns provided by the user, because I noticed that it's much faster than anything else I tried, and I use ()~^() and (|) as AND and OR operators. As an example, here is the pattern generated for files with tags matching pat1: *[[](((* |)pat1( *|)))[]]* which I could easily replace with: *[[](((* )#pat1( *)#))[]]* Then this would be the pattern for files with pat1 and pat2 and neither pat3 nor pat4: *[[](((* )#pat1( *)#)~^((* )#pat2( *)#))[]]*~*[[](((* )#pat3( *)#|(* )#pat4( *)#))[]]* So I'm thinking I could filter for user-provided patterns that contain '|' and don't put them in the mega-pattern but filter for them post-globbing. Does that sound like a sound solution to you? -- Johan