Fix vcregress plpython3 warning

Started by Juan José Santamaría Flechaabout 4 years ago10 messages
#1Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
1 attachment(s)

Hi,

When running the plcheck in Windows we get the following warning, it is
visible in the cfbots [1]http://commitfest.cputube.org/:

Use of uninitialized value $1 in concatenation (.) or string at
src/tools/msvc/vcregress.pl line 350.

This points to mangle_plpython3 subroutine. The attached patch addresses
the problem.

[1]: http://commitfest.cputube.org/

Regards,

Juan José Santamaría Flecha

Attachments:

0001-Fix-vcregress-plpython3-warning.patchapplication/octet-stream; name=0001-Fix-vcregress-plpython3-warning.patchDownload
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 29086ca..935ac5c 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -347,7 +347,7 @@ sub mangle_plpython3
 					s/([ [{])u'/$1'/g;
 					s/def next/def __next__/g;
 					s/LANGUAGE plpython2?u/LANGUAGE plpython3u/g;
-					s/EXTENSION ([^ ]*_)*plpython2?u/EXTENSION $1plpython3u/g;
+					s/EXTENSION ([^ ]*_*)plpython2?u/EXTENSION $1plpython3u/g;
 					s/installing required extension "plpython2u"/installing required extension "plpython3u"/g;
 				  }
 				  for ($contents);
#2Andrew Dunstan
andrew@dunslane.net
In reply to: Juan José Santamaría Flecha (#1)
Re: Fix vcregress plpython3 warning

On 1/7/22 07:20, Juan José Santamaría Flecha wrote:

Hi,

When running the plcheck in Windows we get the following warning, it
is visible in the cfbots [1]:

Use of uninitialized value $1 in concatenation (.) or string at
src/tools/msvc/vcregress.pl <http://vcregress.pl&gt; line 350.

This points to mangle_plpython3 subroutine. The attached patch
addresses the problem.

[1] http://commitfest.cputube.org/

Yeah, this code is not a model of clarity though. I had to think through
it and I write quite a bit of perl. I would probably write it something
like this:

s/EXTENSION (.*?)plpython2?u/EXTENSION $1plpython3u/g ;

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#3Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andrew Dunstan (#2)
Re: Fix vcregress plpython3 warning

On Fri, Jan 7, 2022 at 2:30 PM Andrew Dunstan <andrew@dunslane.net> wrote:

Yeah, this code is not a model of clarity though. I had to think through
it and I write quite a bit of perl. I would probably write it something
like this:

s/EXTENSION (.*?)plpython2?u/EXTENSION $1plpython3u/g ;

Yeah, I had to do some testing to figure it out. Based on what

regress-python3-mangle.mk does, I think it tries to ignore cases such as:

DROP EXTENSION IF EXISTS plpython2u CASCADE;

Which that expression would match. Maybe use a couple of lines as in the
make file?

s/EXTENSION plpython2?u/EXTENSION plpython3u/g
s/EXTENSION ([^ ]*)_plpython2?u/EXTENSION \$1_plpython3u/g

Regards,

Juan José Santamaría Flecha

#4Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Juan José Santamaría Flecha (#3)
Re: Fix vcregress plpython3 warning

On Fri, Jan 7, 2022 at 2:56 PM Juan José Santamaría Flecha <
juanjo.santamaria@gmail.com> wrote:
copy-paste

Show quoted text

s/EXTENSION plpython2?u/EXTENSION plpython3u/g
s/EXTENSION ([^ ]*)_plpython2?u/EXTENSION $1_plpython3u/g

#5Andrew Dunstan
andrew@dunslane.net
In reply to: Juan José Santamaría Flecha (#3)
Re: Fix vcregress plpython3 warning

On 1/7/22 08:56, Juan José Santamaría Flecha wrote:

On Fri, Jan 7, 2022 at 2:30 PM Andrew Dunstan <andrew@dunslane.net> wrote:

Yeah, this code is not a model of clarity though. I had to think
through
it and I write quite a bit of perl. I would probably write it
something
like this:

s/EXTENSION (.*?)plpython2?u/EXTENSION $1plpython3u/g ;

Yeah, I had to do some testing to figure it out. Based on
what regress-python3-mangle.mk <http://regress-python3-mangle.mk&gt;
does, I think it tries to ignore cases such as:

DROP EXTENSION IF EXISTS plpython2u CASCADE;

Which that expression would match. Maybe use a couple of lines as in
the make file?

s/EXTENSION plpython2?u/EXTENSION plpython3u/g
s/EXTENSION ([^ ]*)_plpython2?u/EXTENSION \$1_plpython3u/g

In that case, just this should work:

s/EXTENSION (\S*?)plpython2?u/EXTENSION $1plpython3u/g ;

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#6Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andrew Dunstan (#5)
Re: Fix vcregress plpython3 warning

On Fri, Jan 7, 2022 at 3:24 PM Andrew Dunstan <andrew@dunslane.net> wrote:

In that case, just this should work:

s/EXTENSION (\S*?)plpython2?u/EXTENSION $1plpython3u/g ;

LGTM.

Regards,

Juan José Santamaría Flecha

#7Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andrew Dunstan (#5)
Re: Fix vcregress plpython3 warning

On Fri, Jan 7, 2022 at 3:24 PM Andrew Dunstan <andrew@dunslane.net> wrote:

In that case, just this should work:

s/EXTENSION (\S*?)plpython2?u/EXTENSION $1plpython3u/g ;

Please find attached a patch for so. I have also open an item in the

commitfest:

https://commitfest.postgresql.org/37/3507/

Regards,

Juan José Santamaría Flecha

#8Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Juan José Santamaría Flecha (#7)
1 attachment(s)
Re: Fix vcregress plpython3 warning

On Mon, Jan 10, 2022 at 12:51 PM Juan José Santamaría Flecha <
juanjo.santamaria@gmail.com> wrote:

Please find attached a patch for so.

The patch.

Regards,

Show quoted text

Juan José Santamaría Flecha

Attachments:

v2-0001-Fix-vcregress-plpython3-warnings.patchapplication/octet-stream; name=v2-0001-Fix-vcregress-plpython3-warnings.patchDownload
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index 29086ca..88dff26 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -347,7 +347,7 @@ sub mangle_plpython3
 					s/([ [{])u'/$1'/g;
 					s/def next/def __next__/g;
 					s/LANGUAGE plpython2?u/LANGUAGE plpython3u/g;
-					s/EXTENSION ([^ ]*_)*plpython2?u/EXTENSION $1plpython3u/g;
+					s/EXTENSION (\S*?)plpython2?u/EXTENSION $1plpython3u/g;
 					s/installing required extension "plpython2u"/installing required extension "plpython3u"/g;
 				  }
 				  for ($contents);
#9Andrew Dunstan
andrew@dunslane.net
In reply to: Juan José Santamaría Flecha (#8)
Re: Fix vcregress plpython3 warning

On 1/10/22 06:53, Juan José Santamaría Flecha wrote:

On Mon, Jan 10, 2022 at 12:51 PM Juan José Santamaría Flecha
<juanjo.santamaria@gmail.com> wrote:

Please find attached a patch for so. 

The patch.

 

Pushed, and backpatched.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#10Juan José Santamaría Flecha
juanjo.santamaria@gmail.com
In reply to: Andrew Dunstan (#9)
Re: Fix vcregress plpython3 warning

On Mon, Jan 10, 2022 at 4:14 PM Andrew Dunstan <andrew@dunslane.net> wrote:

Pushed, and backpatched.

Great, thanks.

Regards,

Juan José Santamaría Flecha