Re: perl: unsafe empty pattern behavior

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: perl: unsafe empty pattern behavior
Дата
Msg-id 2385813054ce4e4b3e5998600da2ce95b9509dc7.camel@j-davis.com
обсуждение исходный текст
Ответ на Re: perl: unsafe empty pattern behavior  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: perl: unsafe empty pattern behavior  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Tue, 2024-03-12 at 18:53 +0100, Alvaro Herrera wrote:
> I suggest that pg_dump/t/002_pg_dump.pl could use a verification that
> the ->{regexp} thing is not empty.

I'm not sure how exactly to test for an empty pattern. The problem is,
we don't really want to test for an empty pattern, because /(?^:)/ is
fine. The problem is //, which gets turned into an actual pattern
(perhaps empty or perhaps not), and by the time it's in the %tests
hash, I think it's too late to distinguish.

Again, I'm not a perl expert, so suggestions welcome.

>   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.

Grepping for regexes in perl code is an "interesting" exercise.

Regards,
    Jeff Davis




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jelte Fennema-Nio
Дата:
Сообщение: Re: [EXTERNAL] Re: Add non-blocking version of PQcancel
Следующее
От: Tom Lane
Дата:
Сообщение: Re: perl: unsafe empty pattern behavior