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

Proposed by Athos Ribeiro
Status: Merged
Approved by: git-ubuntu bot
Approved revision: not available
Merged at revision: 3d35c67d042aafca58fc481f31c61200fb668624
Proposed branch: ~athos-ribeiro/ubuntu/+source/postgresql-common:fix-set-conffile-regex
Merge into: ubuntu/+source/postgresql-common:ubuntu/devel
Diff against target: 121 lines (+28/-3)
4 files modified
PgCommon.pm (+2/-2)
debian/changelog (+6/-0)
debian/control (+2/-1)
t/005_PgCommon.t (+18/-0)
Reviewer Review Type Date Requested Status
git-ubuntu bot Approve
Sergio Durigan Junior (community) Approve
Canonical Server Reporter Pending
Review via email: mp+438630@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

Local autopkgtest results:

autopkgtest [14:40:00]: @@@@@@@@@@@@@@@@@@@@ summary
default-psql PASS
run-testsuite PASS

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks, Athos.

LGTM. I verified that the new package fixes the issue. Also, I'm happy that Myon accepted your fix into Debian already.

+1

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

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

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

Thanks, Sergio!

Uploaded

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/PgCommon.pm b/PgCommon.pm
index 783aa4c..e51d89e 100644
--- a/PgCommon.pm
+++ b/PgCommon.pm
@@ -340,8 +340,8 @@ sub set_conffile_value {
340 # of appending340 # of appending
341 if (!$found) {341 if (!$found) {
342 for (my $i=0; $i <= $#lines; ++$i) {342 for (my $i=0; $i <= $#lines; ++$i) {
343 if ($lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)\w+\b((?:\s*#.*)?)/i or343 if ($lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)\w+\b((?:\s*#.*)?)$/i or
344 $lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)'[^']*'((?:\s*#.*)?)/i) {344 $lines[$i] =~ /^\s*#\s*($key)(\s*(?:=|\s)\s*)'[^']*'((?:\s*#.*)?)$/i) {
345 $lines[$i] = "$1$2$value$3\n";345 $lines[$i] = "$1$2$value$3\n";
346 $found = 1;346 $found = 1;
347 last;347 last;
diff --git a/debian/changelog b/debian/changelog
index dbdbe2c..2e74f93 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
1postgresql-common (247ubuntu1) lunar; urgency=medium
2
3 * Fix set_conffile_value comment parsing regular expression. (LP: #2007794)
4
5 -- Athos Ribeiro <athos.ribeiro@canonical.com> Thu, 09 Mar 2023 11:44:03 -0300
6
1postgresql-common (247) unstable; urgency=medium7postgresql-common (247) unstable; urgency=medium
28
3 [ Christoph Berg ]9 [ Christoph Berg ]
diff --git a/debian/control b/debian/control
index 1497395..29cc456 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,8 @@
1Source: postgresql-common1Source: postgresql-common
2Section: database2Section: database
3Priority: optional3Priority: optional
4Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>
5Uploaders:6Uploaders:
6 Martin Pitt <mpitt@debian.org>,7 Martin Pitt <mpitt@debian.org>,
7 Christoph Berg <myon@debian.org>,8 Christoph Berg <myon@debian.org>,
diff --git a/t/005_PgCommon.t b/t/005_PgCommon.t
index 22dcca8..e1bc337 100644
--- a/t/005_PgCommon.t
+++ b/t/005_PgCommon.t
@@ -102,6 +102,9 @@ print F <<EOF;
102102
103# Commented_Int = 12103# Commented_Int = 12
104# commented_str='foobar'104# commented_str='foobar'
105# commented_bool off
106# commented_bool2 off # comment
107# commented_bool3 just a comment
105108
106#intval = 1109#intval = 1
107Intval = 42110Intval = 42
@@ -194,6 +197,9 @@ is_deeply (\%conf, {
194# test set_conf_value()197# test set_conf_value()
195PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_int', '24';198PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_int', '24';
196PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_str', 'new foo';199PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_str', 'new foo';
200PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_bool', 'on';
201PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_bool2', 'on';
202PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'commented_bool3', 'on';
197PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'intval', '39';203PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'intval', '39';
198PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'cintval', '5';204PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'cintval', '5';
199PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'strval', 'Howdy';205PgCommon::set_conf_value '8.4', 'test', 'foo.conf', 'strval', 'Howdy';
@@ -210,6 +216,9 @@ is ($conf, <<EOF, 'set_conf_value');
210216
211Commented_Int = 24217Commented_Int = 24
212commented_str='new foo'218commented_str='new foo'
219commented_bool on
220commented_bool2 on # comment
221# commented_bool3 just a comment
213222
214#intval = 1223#intval = 1
215Intval = 39224Intval = 39
@@ -223,6 +232,7 @@ cemptystr = '' # moo!
223#testpath = '/bin/bad'232#testpath = '/bin/bad'
224testpath = '/bin/new'233testpath = '/bin/new'
225QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''234QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''
235commented_bool3 = on
226newval = 'NEW!'236newval = 'NEW!'
227include_dir = 'conf.d'237include_dir = 'conf.d'
228EOF238EOF
@@ -241,6 +251,9 @@ is ($conf, <<EOF, 'disable_conf_value');
241251
242Commented_Int = 24252Commented_Int = 24
243commented_str='new foo'253commented_str='new foo'
254commented_bool on
255commented_bool2 on # comment
256# commented_bool3 just a comment
244257
245#intval = 1258#intval = 1
246#Intval = 39 #ints are out of fashion259#Intval = 39 #ints are out of fashion
@@ -254,6 +267,7 @@ cemptystr = '' # moo!
254#testpath = '/bin/bad'267#testpath = '/bin/bad'
255#testpath = '/bin/new' #now 2 comments268#testpath = '/bin/new' #now 2 comments
256QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''269QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''
270commented_bool3 = on
257newval = 'NEW!'271newval = 'NEW!'
258include_dir = 'conf.d'272include_dir = 'conf.d'
259EOF273EOF
@@ -272,6 +286,9 @@ is ($conf, <<EOF, 'replace_conf_value');
272286
273Commented_Int = 24287Commented_Int = 24
274commented_str='new foo'288commented_str='new foo'
289commented_bool on
290commented_bool2 on # comment
291# commented_bool3 just a comment
275292
276#intval = 1293#intval = 1
277#Intval = 39 #ints are out of fashion294#Intval = 39 #ints are out of fashion
@@ -286,6 +303,7 @@ cemptystr = '' # moo!
286#testpath = '/bin/bad'303#testpath = '/bin/bad'
287#testpath = '/bin/new' #now 2 comments304#testpath = '/bin/new' #now 2 comments
288QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''305QuoteStr = 'test ! -f \\'/tmp/%f\\' && echo \\'yes\\''
306commented_bool3 = on
289newval = 'NEW!'307newval = 'NEW!'
290include_dir = 'conf.d'308include_dir = 'conf.d'
291EOF309EOF

Subscribers

People subscribed via source and target branches