Merge ~athos-ribeiro/ubuntu/+source/postgresql-common:fix-set-conffile-regex-bionic into ubuntu/+source/postgresql-common:ubuntu/bionic-devel

Proposed by Athos Ribeiro
Status: Rejected
Rejected by: Andreas Hasenack
Proposed branch: ~athos-ribeiro/ubuntu/+source/postgresql-common:fix-set-conffile-regex-bionic
Merge into: ubuntu/+source/postgresql-common:ubuntu/bionic-devel
Diff against target: 107 lines (+26/-2)
3 files modified
PgCommon.pm (+2/-2)
debian/changelog (+6/-0)
t/005_PgCommon.t (+18/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Bryce Harrington (community) Approve
Canonical Server Reporter Pending
Review via email: mp+440668@code.launchpad.net

Description of the change

pg_conftool mistakes regular comments starting with a configuration option for actual commented configuration options.

While the issue does not impact any software features or its usability, it may lead to the deletion of useful comments or documentation in configuration files.

See LP: #2007794 for further reference.

PPA: https://launchpad.net/~athos-ribeiro/+archive/ubuntu/pg-fix-config-regex/+packages

DEP8 test results:

* Results:
  - postgresql-common/190ubuntu0.2
    + ✅ postgresql-common on bionic for amd64 @ 11.04.23 12:31:58 Log️ 🗒️
    + ✅ postgresql-common on bionic for arm64 @ 11.04.23 00:12:07 Log️ 🗒️
    + ✅ postgresql-common on bionic for armhf @ 11.04.23 00:11:26 Log️ 🗒️
    + ✅ postgresql-common on bionic for i386 @ 11.04.23 00:14:50 Log️ 🗒️
    + ✅ postgresql-common on bionic for ppc64el @ 11.04.23 00:15:22 Log️ 🗒️
    + ✅ postgresql-common on bionic for s390x @ 11.04.23 00:31:51 Log️ 🗒️

There was an amd64 failure on the first run, which seemed to be unrelated to the change (flakiness).

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

I had a bug in the implementation for --release in ppa-dev-tools that was preventing me from seeing the results, but after fixing it

* Triggers:
  - Source postgresql-common/190ubuntu0.2: Published
    + Trigger basic @amd64♻️ Trigger all-proposed @amd64💍
    + Trigger basic @arm64♻️ Trigger all-proposed @arm64💍
    + Trigger basic @armhf♻️ Trigger all-proposed @armhf💍
    + Trigger basic @i386♻️ Trigger all-proposed @i386💍
    + Trigger basic @ppc64el♻️ Trigger all-proposed @ppc64el💍
    + Trigger basic @s390x♻️ Trigger all-proposed @s390x💍
* Results:
  - postgresql-common/190ubuntu0.2
    + ❌ postgresql-common on bionic for amd64 @ 11.04.23 00:16:07 Log️ 🗒️
      • default-psql FAIL 🟥
    + ✅ postgresql-common on bionic for amd64 @ 11.04.23 12:31:58 Log️ 🗒️
    + ✅ postgresql-common on bionic for arm64 @ 11.04.23 00:12:07 Log️ 🗒️
    + ✅ postgresql-common on bionic for armhf @ 11.04.23 00:11:26 Log️ 🗒️
    + ✅ postgresql-common on bionic for i386 @ 11.04.23 00:14:50 Log️ 🗒️
    + ✅ postgresql-common on bionic for ppc64el @ 11.04.23 00:15:22 Log️ 🗒️
    + ✅ postgresql-common on bionic for s390x @ 11.04.23 00:31:51 Log️ 🗒️
* Running: (none)
* Waiting: (none)

Looks like the first amd64 test ran and it passed on retrigger.

Otherwise, same changes as the kinetic branch, so see its MP for details.

review: Approve
Revision history for this message
git-ubuntu bot (git-ubuntu-bot) wrote :

Approvers: athos-ribeiro, bryce
Uploaders: athos-ribeiro, bryce
MP auto-approved

review: Approve
Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks Bryce!

Uploaded:

Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading postgresql-common_190ubuntu0.2.dsc: done.
  Uploading postgresql-common_190ubuntu0.2.tar.xz: done.
  Uploading postgresql-common_190ubuntu0.2_source.buildinfo: done.
  Uploading postgresql-common_190ubuntu0.2_source.changes: done.
Successfully uploaded packages.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

This was rejected[1] on 2023-05-03:

Rejected on 2023-05-30 by Łukasz Zemczak
18.04 is going EOL (ESM), please re-submit to ESM if needed

As a consequence, it's also not imported into git-ubuntu. Let's mark this MP as rejected then to reflect the current status, and to get it off our pending reviews list.

1. https://launchpad.net/ubuntu/bionic/+queue?queue_state=4&queue_text=postgresql-common

Unmerged commits

acb4ced... by Athos Ribeiro

Update changelog

c698e67... by Athos Ribeiro

    - Fix set_conffile_value comment parsing regular expression. (LP: #2007794)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/PgCommon.pm b/PgCommon.pm
2index 7082c4a..dbe5b15 100644
3--- a/PgCommon.pm
4+++ b/PgCommon.pm
5@@ -236,8 +236,8 @@ sub set_conffile_value {
6 # of appending
7 if (!$found) {
8 for (my $i=0; $i <= $#lines; ++$i) {
9- if ($lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)\w+\b((?:\s*#.*)?)/i or
10- $lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)'[^']*'((?:\s*#.*)?)/i) {
11+ if ($lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)\w+\b((?:\s*#.*)?)$/i or
12+ $lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)'[^']*'((?:\s*#.*)?)$/i) {
13 $lines[$i] = "$1$2$value$3\n";
14 $found = 1;
15 last;
16diff --git a/debian/changelog b/debian/changelog
17index ca920b1..3cbe6b2 100644
18--- a/debian/changelog
19+++ b/debian/changelog
20@@ -1,3 +1,9 @@
21+postgresql-common (190ubuntu0.2) bionic; urgency=medium
22+
23+ * Fix set_conffile_value comment parsing regular expression. (LP: #2007794)
24+
25+ -- Athos Ribeiro <athos.ribeiro@canonical.com> Mon, 10 Apr 2023 18:37:06 -0300
26+
27 postgresql-common (190ubuntu0.1) bionic-security; urgency=medium
28
29 * SECURITY UPDATE: Privilege Escalation via Arbitrary Directory Creation
30diff --git a/t/005_PgCommon.t b/t/005_PgCommon.t
31index fef5330..8bb09e8 100644
32--- a/t/005_PgCommon.t
33+++ b/t/005_PgCommon.t
34@@ -102,6 +102,9 @@ print F <<EOF;
35
36 # Commented_Int = 12
37 # commented_str='foobar'
38+# commented_bool off
39+# commented_bool2 off # comment
40+# commented_bool3 just a comment
41
42 #intval = 1
43 Intval = 42
44@@ -191,6 +194,9 @@ is_deeply (\%conf, {
45 # test set_conf_value()
46 PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_int', '24';
47 PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_str', 'new foo';
48+PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_bool', 'on';
49+PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_bool2', 'on';
50+PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_bool3', 'on';
51 PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'intval', '39';
52 PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'cintval', '5';
53 PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'strval', 'Howdy';
54@@ -207,6 +213,9 @@ is ($conf, <<EOF, 'set_conf_value');
55
56 Commented_Int = 24
57 commented_str='new foo'
58+commented_bool on
59+commented_bool2 on # comment
60+# commented_bool3 just a comment
61
62 #intval = 1
63 Intval = 39
64@@ -219,6 +228,7 @@ cemptystr = '' # moo!
65 #testpath = '/bin/bad'
66 testpath = '/bin/new'
67 QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''
68+commented_bool3 = on
69 newval = 'NEW!'
70 include_dir = 'conf.d'
71 EOF
72@@ -237,6 +247,9 @@ is ($conf, <<EOF, 'disable_conf_value');
73
74 Commented_Int = 24
75 commented_str='new foo'
76+commented_bool on
77+commented_bool2 on # comment
78+# commented_bool3 just a comment
79
80 #intval = 1
81 #Intval = 39 #ints are out of fashion
82@@ -249,6 +262,7 @@ cemptystr = '' # moo!
83 #testpath = '/bin/bad'
84 #testpath = '/bin/new' #now 2 comments
85 QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''
86+commented_bool3 = on
87 newval = 'NEW!'
88 include_dir = 'conf.d'
89 EOF
90@@ -267,6 +281,9 @@ is ($conf, <<EOF, 'replace_conf_value');
91
92 Commented_Int = 24
93 commented_str='new foo'
94+commented_bool on
95+commented_bool2 on # comment
96+# commented_bool3 just a comment
97
98 #intval = 1
99 #Intval = 39 #ints are out of fashion
100@@ -280,6 +297,7 @@ cemptystr = '' # moo!
101 #testpath = '/bin/bad'
102 #testpath = '/bin/new' #now 2 comments
103 QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''
104+commented_bool3 = on
105 newval = 'NEW!'
106 include_dir = 'conf.d'
107 EOF

Subscribers

People subscribed via source and target branches