Merge ~paelzer/ubuntu/+source/mediawiki:fix-pg12 into ~paelzer/ubuntu/+source/mediawiki:master

Proposed by Christian Ehrhardt 
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: d7dcb38024a809b6b8ecc3ca4015660c1f5149ff
Merge reported by: Christian Ehrhardt 
Merged at revision: d7dcb38024a809b6b8ecc3ca4015660c1f5149ff
Proposed branch: ~paelzer/ubuntu/+source/mediawiki:fix-pg12
Merge into: ~paelzer/ubuntu/+source/mediawiki:master
Diff against target: 159 lines (+121/-1)
5 files modified
debian/changelog (+6/-0)
debian/control (+2/-1)
debian/patches/rdbms-Remove-references-to-pg_attrdef.adsrc-in-Postg.patch (+73/-0)
debian/patches/rdbms-Use-correct-value-for-sslmode-in-DatabasePostg.patch (+38/-0)
debian/patches/series (+2/-0)
Reviewer Review Type Date Requested Status
Andreas Hasenack (community) Approve
Canonical Server Pending
Review via email: mp+375477@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This isn't in git ubuntu, therefore I pushed master as it is and this branch to merge on top.
Allows for our usual workflow without too much extra hazzle.

PPA: https://launchpad.net/~paelzer/+archive/ubuntu/bug-1852408-mediawiki-pg12/+packages

I have run the tests against the PPA locally and with the fix it works.
Test log: http://paste.ubuntu.com/p/Q4nkfxbTNB/

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Add Bug-Debian perhaps to the dep3 section of the patches?

I confirmed mediawiki tests pass with postgresql 12 from focal-proposed

+1

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I added the Debian bug to the headers - thanks.
No tagging since not in git-ubuntu, uploaded

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 6d00cba..68c8396 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+mediawiki (1:1.31.5-1ubuntu1) focal; urgency=medium
7+
8+ * d/p/rdbms-*Postg: fix issues with postgresql12 (LP: #1852408)
9+
10+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Wed, 13 Nov 2019 10:54:11 +0100
11+
12 mediawiki (1:1.31.5-1) unstable; urgency=medium
13
14 * New upstream version 1.31.5
15diff --git a/debian/control b/debian/control
16index bda472b..8ab319e 100644
17--- a/debian/control
18+++ b/debian/control
19@@ -1,7 +1,8 @@
20 Source: mediawiki
21 Section: web
22 Priority: optional
23-Maintainer: Kunal Mehta <legoktm@debian.org>
24+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
25+XSBC-Original-Maintainer: Kunal Mehta <legoktm@debian.org>
26 Build-Depends: debhelper (>= 10),
27 dh-buildinfo,
28 apache2-dev
29diff --git a/debian/patches/rdbms-Remove-references-to-pg_attrdef.adsrc-in-Postg.patch b/debian/patches/rdbms-Remove-references-to-pg_attrdef.adsrc-in-Postg.patch
30new file mode 100644
31index 0000000..c20a18c
32--- /dev/null
33+++ b/debian/patches/rdbms-Remove-references-to-pg_attrdef.adsrc-in-Postg.patch
34@@ -0,0 +1,73 @@
35+From 27d342ef4bd31da48b0e10655daf1320e3d00b50 Mon Sep 17 00:00:00 2001
36+From: Jeff Janes <jeff.janes@gmail.com>
37+Date: Thu, 17 Jan 2019 18:41:51 -0500
38+Subject: [PATCH] rdbms: Remove references to pg_attrdef.adsrc in Postgres code
39+
40+PostgreSQL v12 will remove the long-deprecated column
41+pg_attrdef.adsrc. The supported way to introspect into column
42+default values is pg_get_expr(adbin, adrelid), which works
43+back through all versions of PostgreSQL supported by wikimedia.
44+
45+Changing to the supported method will allow the upcoming v12 of the
46+database to be used while maintaining compatibility with older
47+versions, without needing to write version-specific code.
48+
49+This patch has been tested with maintenance/update.php and
50+with phpunit in PostgreSQL versions 9.2, 11, and 12dev. It does
51+not harm the first two, and fixes errors that would otherwise
52+arise in the dev version. All unit tests which pass under version
53+11 now pass under 12dev as well.
54+
55+Change-Id: I874d347fd286b26773113d4f0c6c30d9a4055ad3
56+
57+Origin: upstream, https://github.com/wikimedia/mediawiki/commit/27d342ef4bd31da48b0e10655daf1320e3d00b50
58+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1852408
59+Applied-Upstream: 1.33
60+Last-Update: 2019-11-13
61+---
62+ includes/libs/rdbms/database/DatabasePostgres.php | 6 +++---
63+ includes/libs/rdbms/field/PostgresField.php | 2 +-
64+ 2 files changed, 4 insertions(+), 4 deletions(-)
65+
66+diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php
67+index 5f04e39718..0935d5a135 100644
68+--- a/includes/libs/rdbms/database/DatabasePostgres.php
69++++ b/includes/libs/rdbms/database/DatabasePostgres.php
70+@@ -816,7 +816,7 @@ __INDEXATTR__;
71+ . ' WHERE relkind = \'r\''
72+ . ' AND nspname = ' . $this->addQuotes( $this->getCoreSchema() )
73+ . ' AND relname = ' . $this->addQuotes( $oldName )
74+- . ' AND adsrc LIKE \'nextval(%\'',
75++ . ' AND pg_get_expr(adbin, adrelid) LIKE \'nextval(%\'',
76+ $fname
77+ );
78+ $row = $this->fetchObject( $res );
79+@@ -851,10 +851,10 @@ __INDEXATTR__;
80+ }
81+
82+ $oid = $this->fetchObject( $res )->oid;
83+- $res = $this->query( 'SELECT adsrc FROM pg_attribute a'
84++ $res = $this->query( 'SELECT pg_get_expr(adbin, adrelid) AS adsrc FROM pg_attribute a'
85+ . ' JOIN pg_attrdef d ON (a.attrelid=d.adrelid and a.attnum=d.adnum)'
86+ . " WHERE a.attrelid = $oid"
87+- . ' AND adsrc LIKE \'nextval(%\'',
88++ . ' AND pg_get_expr(adbin, adrelid) LIKE \'nextval(%\'',
89+ $fname
90+ );
91+ $row = $this->fetchObject( $res );
92+diff --git a/includes/libs/rdbms/field/PostgresField.php b/includes/libs/rdbms/field/PostgresField.php
93+index 53c3d335b1..7596a3ba0a 100644
94+--- a/includes/libs/rdbms/field/PostgresField.php
95++++ b/includes/libs/rdbms/field/PostgresField.php
96+@@ -17,7 +17,7 @@ class PostgresField implements Field {
97+ SELECT
98+ attnotnull, attlen, conname AS conname,
99+ atthasdef,
100+- adsrc,
101++ pg_get_expr(adbin, adrelid) AS adsrc,
102+ COALESCE(condeferred, 'f') AS deferred,
103+ COALESCE(condeferrable, 'f') AS deferrable,
104+ CASE WHEN typname = 'int2' THEN 'smallint'
105+--
106+2.24.0
107+
108diff --git a/debian/patches/rdbms-Use-correct-value-for-sslmode-in-DatabasePostg.patch b/debian/patches/rdbms-Use-correct-value-for-sslmode-in-DatabasePostg.patch
109new file mode 100644
110index 0000000..4215ec1
111--- /dev/null
112+++ b/debian/patches/rdbms-Use-correct-value-for-sslmode-in-DatabasePostg.patch
113@@ -0,0 +1,38 @@
114+From 2e5d114a99cf162074f92fc390590da44084362d Mon Sep 17 00:00:00 2001
115+From: "Mark A. Hershberger" <mah@nichework.com>
116+Date: Thu, 9 Aug 2018 16:18:34 -0400
117+Subject: [PATCH] rdbms: Use correct value for 'sslmode' in DatabasePostgres
118+MIME-Version: 1.0
119+Content-Type: text/plain; charset=UTF-8
120+Content-Transfer-Encoding: 8bit
121+
122+Fix Postgres support by using ‘sslmode=require' instead of ‘sslmode=1'.
123+
124+See https://www.postgresql.org/docs/current/static/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS
125+
126+Change-Id: I424b0e3e144bbe9f0a2bde9a3b4a674dde10c729
127+
128+Origin: upstream, https://github.com/wikimedia/mediawiki/commit/2e5d114a99cf162074f92fc390590da44084362d
129+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1852408
130+Applied-Upstream: 1.33
131+Last-Update: 2019-11-13
132+---
133+ includes/libs/rdbms/database/DatabasePostgres.php | 2 +-
134+ 1 file changed, 1 insertion(+), 1 deletion(-)
135+
136+diff --git a/includes/libs/rdbms/database/DatabasePostgres.php b/includes/libs/rdbms/database/DatabasePostgres.php
137+index a043cd6a89..e7057dd102 100644
138+--- a/includes/libs/rdbms/database/DatabasePostgres.php
139++++ b/includes/libs/rdbms/database/DatabasePostgres.php
140+@@ -117,7 +117,7 @@ class DatabasePostgres extends Database {
141+ $connectVars['port'] = (int)$this->port;
142+ }
143+ if ( $this->flags & self::DBO_SSL ) {
144+- $connectVars['sslmode'] = 1;
145++ $connectVars['sslmode'] = 'require';
146+ }
147+
148+ $this->connectString = $this->makeConnectionString( $connectVars );
149+--
150+2.24.0
151+
152diff --git a/debian/patches/series b/debian/patches/series
153index 3105687..22d270a 100644
154--- a/debian/patches/series
155+++ b/debian/patches/series
156@@ -1 +1,3 @@
157 pear-phail-fail-shebang.diff
158+rdbms-Remove-references-to-pg_attrdef.adsrc-in-Postg.patch
159+rdbms-Use-correct-value-for-sslmode-in-DatabasePostg.patch

Subscribers

People subscribed via source and target branches

to all changes: