[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.2-13-gb8b2614fe
git at osgeo.org
git at osgeo.org
Fri Aug 12 00:54:08 PDT 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, stable-3.2 has been updated
via b8b2614feb9a3529803f5d2b6d725dcf5e2c889e (commit)
from 89d8463bb64694f939586b05e4f2be0f4cc192d4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit b8b2614feb9a3529803f5d2b6d725dcf5e2c889e
Author: Sandro Santilli <strk at kbt.io>
Date: Tue Jul 12 07:30:57 2022 +0200
Package objects before upgrading (only those which exist)
We don't need to upgrade before packaging because objects
created during extension upgrade are automatically packaged.
Packaging upfront fixes creating PostGIS extension from
unpackaged on PostgreSQL versions 10.22, 11.17+, 12.12+, 13.8+
and 14.5+ addressing CVE-2022-2625, see:
https://www.postgresql.org/support/security/CVE-2022-2625/
References #5209 in 3.2 branch (3.2.3dev)
This is a backport of cb65cd8973 which landed in master branch
on July 12 2022.
diff --git a/extensions/postgis/Makefile.in b/extensions/postgis/Makefile.in
index 9f3331cb4..353f97b18 100644
--- a/extensions/postgis/Makefile.in
+++ b/extensions/postgis/Makefile.in
@@ -55,6 +55,7 @@ EXTENSION_UPGRADE_SCRIPTS = \
# Scripts making up the extension upgrade-from-unpackaged file
# NOTE: order matters
+# TODO: DROPME
EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS = \
sql/$(EXTENSION)--$(EXTVERSION).sql
@@ -96,12 +97,10 @@ sql/$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION_SCRIPTS) | sql
printf '\\echo Use "CREATE EXTENSION $(EXTENSION)" to load this file. \\quit\n' > $@
cat $^ >> $@
-sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) sql/$(EXTENSION)--ANY--$(EXTVERSION).sql ../../utils/create_unpackaged.pl Makefile | sql
- # Ensure version is correct
- cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql > $@
- cat $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) \
- | $(PERL) ../../utils/create_unpackaged.pl postgis \
- >> $@
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: sql/$(EXTENSION)--ANY--$(EXTVERSION).sql ../../utils/create_unpackaged.pl Makefile | sql
+ cat sql/$(EXTENSION)--$(EXTVERSION).sql | $(PERL) @top_srcdir@/utils/create_unpackaged.pl postgis > $@
+ # Upgrade after packaging
+ cat $< >> $@
sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
echo "-- Nothing to do here" > $@
diff --git a/extensions/postgis_raster/Makefile.in b/extensions/postgis_raster/Makefile.in
index f61fbee7d..b7ede0af3 100644
--- a/extensions/postgis_raster/Makefile.in
+++ b/extensions/postgis_raster/Makefile.in
@@ -78,10 +78,10 @@ sql/$(EXTENSION)--$(EXTVERSION).sql: $(EXTENSION_SCRIPTS) | sql
sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
echo "-- Nothing to do here" > $@
-sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) ../../utils/create_unpackaged.pl sql/$(EXTENSION)--ANY--$(EXTVERSION).sql Makefile | sql
- # Ensure version is correct
- cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql > $@
- cat $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) | $(PERL) ../../utils/create_unpackaged.pl postgis_raster >> $@
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) | ../../utils/create_unpackaged.pl sql/$(EXTENSION)--ANY--$(EXTVERSION).sql Makefile sql
+ cat $^ | $(PERL) @top_srcdir@/utils/create_unpackaged.pl postgis_raster > $@
+ # Upgrade after packaging
+ cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql >> $@
unpackaged_check.sql: unpackaged_check.sql.in Makefile
cat $< \
diff --git a/extensions/postgis_sfcgal/Makefile.in b/extensions/postgis_sfcgal/Makefile.in
index b3c001957..a6d35bf4b 100644
--- a/extensions/postgis_sfcgal/Makefile.in
+++ b/extensions/postgis_sfcgal/Makefile.in
@@ -80,12 +80,12 @@ sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
#grep all lines that start with CREATE OR REPLACE FUNCTION, TRIGGER...
#then replace CREATE OR REPLACE .. with ALTER EXTENSION..;
#then remove default values and extra junk
-sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) sql/$(EXTENSION)--ANY--$(EXTVERSION).sql ../../utils/create_unpackaged.pl Makefile | sql
- # Ensure version is correct
- cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql > $@
- cat $(EXTENSION_UNPACKAGED_UPGRADE_SCRIPTS) \
- | $(PERL) ../../utils/create_unpackaged.pl ${EXTENSION} \
- >> $@
+sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: sql_bits/sfcgal.sql sql/$(EXTENSION)--ANY--$(EXTVERSION).sql ../../utils/create_unpackaged.pl Makefile | sql
+ cat $< \
+ | $(PERL) @top_srcdir@/utils/create_unpackaged.pl ${EXTENSION} \
+ > $@
+ # Upgrade after packaging
+ cat sql/$(EXTENSION)--ANY--$(EXTVERSION).sql >> $@
sql_bits/sfcgal_upgrade.sql : ../../sfcgal/sfcgal_upgrade.sql
mkdir -p sql_bits
diff --git a/extensions/postgis_topology/Makefile.in b/extensions/postgis_topology/Makefile.in
index cad83f060..c10595ce0 100644
--- a/extensions/postgis_topology/Makefile.in
+++ b/extensions/postgis_topology/Makefile.in
@@ -82,9 +82,9 @@ sql/$(EXTENSION)--unpackaged.sql: Makefile | sql
echo "-- Nothing to do here" > $@
sql/$(EXTENSION)--unpackaged--$(EXTVERSION).sql: ../../topology/topology.sql ../../utils/create_unpackaged.pl sql/topology_upgrade.sql Makefile | sql
- # Ugprade before packaging
- cat sql/topology_upgrade.sql > $@
- cat $< | $(PERL) ../../utils/create_unpackaged.pl postgis_topology >> $@
+ cat $< | $(PERL) @top_srcdir@/utils/create_unpackaged.pl postgis_topology > $@
+ # Ugprade after packaging (TODO: use ANY--TARGET path?)
+ cat sql/topology_upgrade.sql >> $@
#upgrade script should have everything but table, schema, type creation/alter
#NOTE: we assume all object definitions end in ;
diff --git a/utils/create_unpackaged.pl b/utils/create_unpackaged.pl
index 8e4e0649a..60e5ea171 100755
--- a/utils/create_unpackaged.pl
+++ b/utils/create_unpackaged.pl
@@ -4,7 +4,7 @@
# PostGIS - Spatial Types for PostgreSQL
# http://postgis.net
#
-# Copyright (C) 2013 Sandro Santilli <strk at kbt.io>
+# Copyright (C) 2013-2022 Sandro Santilli <strk at kbt.io>
#
# This is free software; you can redistribute and/or modify it under
# the terms of the GNU General Public Licence. See the COPYING file.
@@ -144,15 +144,29 @@ sub add_if_not_exists
print <<"EOF"
DO \$\$
BEGIN
- ALTER EXTENSION $extname ADD $obj;
- RAISE NOTICE 'newly registered $obj';
-EXCEPTION WHEN object_not_in_prerequisite_state THEN
+
+ -- TODO: check if ownership of the object
+ -- matches ownership of the extension
+ -- the object to the extension
+
+ ALTER EXTENSION $extname ADD $obj;
+ RAISE NOTICE 'newly registered $obj';
+
+EXCEPTION
+WHEN object_not_in_prerequisite_state THEN
IF SQLERRM ~ '\\m$extname\\M'
THEN
RAISE NOTICE 'already registered $obj';
ELSE
RAISE EXCEPTION '%', SQLERRM;
END IF;
+WHEN
+ undefined_function
+ -- TODO: handle more exceptions ?
+THEN
+ RAISE NOTICE 'undefined function $obj';
+WHEN OTHERS THEN
+ RAISE EXCEPTION 'Trying to add $obj to $extname, got % (%)', SQLERRM, SQLSTATE;
END;
\$\$ LANGUAGE 'plpgsql';
EOF
-----------------------------------------------------------------------
Summary of changes:
extensions/postgis/Makefile.in | 11 +++++------
extensions/postgis_raster/Makefile.in | 8 ++++----
extensions/postgis_sfcgal/Makefile.in | 12 ++++++------
extensions/postgis_topology/Makefile.in | 6 +++---
utils/create_unpackaged.pl | 22 ++++++++++++++++++----
5 files changed, 36 insertions(+), 23 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list