Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkFrN-00BV2O-Rk for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Mar 2024 04:04:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rkFrL-009abR-Gu for pgsql-hackers@arkaria.postgresql.org; Wed, 13 Mar 2024 04:04:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rkFrK-009abI-Tf for pgsql-hackers@lists.postgresql.org; Wed, 13 Mar 2024 04:04:55 +0000 Received: from mail-oi1-x22b.google.com ([2607:f8b0:4864:20::22b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rkFrH-004E6n-27 for pgsql-hackers@postgresql.org; Wed, 13 Mar 2024 04:04:53 +0000 Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3c213690558so2239651b6e.0 for ; Tue, 12 Mar 2024 21:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dunslane-net.20230601.gappssmtp.com; s=20230601; t=1710302691; x=1710907491; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=yydl25rFlUlpou7Fj4AXZ/7YoAkDbPkghq/Q9jQzbjk=; b=iQaPxyGt5jF8/mcMe0LMfdpx5K7LT38OphLJaqyDpgXP7sBPcz6I6eDeTw0ooRutJ/ AXMzAdEamT1XqJm/9syA/mIXR3wrIinQrRmfMBzJIUOmy/CyQTaxd96SLAMvT2j7z0FX PsQ7OYQ2D7XO3QdLg/V5oCyfsxQbozIZmSD1nmFxRS3vyg4DG3vdQL35KNKL8FonH+n8 qG4nMimxJ1OhTIy3x/uISNPyTXqII1myT9ghI+xEk2RIJrrYyEAbOLKRzkSEL+rUgl+W BYnaa52xHFrRL8JzNxfrN7cZ0OeAZIRNHqZPRKsQmCYYEL41NrQmS95/CyZFGfhVlZwB Asnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710302691; x=1710907491; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yydl25rFlUlpou7Fj4AXZ/7YoAkDbPkghq/Q9jQzbjk=; b=Q5jzEu+eMr0DdK5H6jk188STPKitHzd7BmiyL/k9SsrTrhAAg51FFXlesQEKulPef9 rmprSDDORXl61sIccJbgrOE+C5jT8+Y8un5j3hy6z41x6W88j9Fm2RMeWufbAmb8VAhH SyPdmDKLScc1uAcPX5+ib0dHkIY60Ngkb/iZNN6v4SO5BCXXVb7RXeuiZRdxm/LGPhTH tOQPBNMstuVohynm7z8Mykk3bVM/AdMERW7KhmUbMYXQQ+bjaabsDk+CS392h3ennths 5d86yPTGaDlKVc973HAbibaN1EoGw8h2dgloBsTNTRQkEBFQP43p1/x9ecn1iUq1o1Nr 8EFA== X-Forwarded-Encrypted: i=1; AJvYcCVNhNmjZxlHbKjodW7HS/rUI6tpPdE+ySuMWR03FtVMQMRl7XXmhd2HuafXO78AJBOW0jbz5oDu5OFiwgPww9a5Ru8n+n4dg68VeZvE X-Gm-Message-State: AOJu0YxWz1vVzHgMKOcPmVXkmhy2b43sstwUv+TN9nHmv3NNvAWCIL3R 3OQgVbglVYVwSgAwvAVwifwdHsY2BmMamWRId4N8c+IA5PHwHXP+fra/++Qo6606euzr0hwZ5/o g X-Google-Smtp-Source: AGHT+IGrU4PEPgS6SlkEa2EZ5drTV3mHsRH3JYgeQpeBp1BHjyFQBSOd9pRI3m4rgXPm7UNM0toZgQ== X-Received: by 2002:a05:6808:11c6:b0:3c2:36df:c6d5 with SMTP id p6-20020a05680811c600b003c236dfc6d5mr2069499oiv.33.1710302690804; Tue, 12 Mar 2024 21:04:50 -0700 (PDT) Received: from ?IPV6:2605:a601:91f3:1900::2bb? ([2605:a601:91f3:1900::2bb]) by smtp.googlemail.com with ESMTPSA id t29-20020a05620a035d00b00788402160besm4309894qkm.128.2024.03.12.21.04.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Mar 2024 21:04:50 -0700 (PDT) Message-ID: Date: Wed, 13 Mar 2024 00:04:49 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: perl: unsafe empty pattern behavior Content-Language: en-US To: Tom Lane , Jeff Davis Cc: Alvaro Herrera , pgsql-hackers@postgresql.org References: <202403121753.lw7u5b5fjsjw@alvherre.pgsql> <2385813054ce4e4b3e5998600da2ce95b9509dc7.camel@j-davis.com> <1941562.1710284344@sss.pgh.pa.us> From: Andrew Dunstan In-Reply-To: <1941562.1710284344@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-03-12 Tu 18:59, Tom Lane wrote: > Jeff Davis writes: >> On Tue, 2024-03-12 at 18:53 +0100, Alvaro Herrera wrote: >>> I also tried grepping (for things >>> like qr{}, qr[], qr||, qr!!) and didn't find anything beyond what you >>> have ... but I only looked for the "qr" literal, not other ways to >>> get regexes. >> I think that's fine. qr// seems the most dangerous, because it seems to >> behave differently in different versions of perl. > I wonder whether perlcritic has sufficiently deep understanding of > Perl code that it could find these hazards. I already checked, > and found that there's no built-in filter for this (at least not > in the perlcritic version I have), but maybe we could write one? > The rules seem to be plug-in modules, so you can make your own > in principle. Yeah, that was my thought too. I'd start with ProhibitComplexRegexes.pm as a template. If nobody else does it I'll have a go, but it might take a while. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com