[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Please accept postgresql-common 94 into lenny



Hello release team,

I fixed two more bugs in postgresql-common. No deal breakers, but they
are properly test-case'd and have straightforward patches. Please
consider allowing them into lenny.

Thank you!

Martin


postgresql-common (94) unstable; urgency=low

  * t/070_non_postgres_clusters.t: Test that all cluster configuration files
    are owned by the cluster superuser. Reproduces #481349.
  * pg_createcluster: Make the cluster configuration directory, "start.conf",
    and "environment" owned by the cluster superuser instead of root.
    (Closes: #481349)
  * t/030_errors.t: Check behaviour of starting of clusters with colliding
    ports. Reproduces #472627.
  * pg_ctlcluster: Error out with a port collision message if another cluster
    is already running on the port. (Closes: #472627)
  * t/090_multicluster.t: Don't reconfigure cluster on conflicting port, since
    that now fails with above fix.

 -- Martin Pitt <mpitt@debian.org>  Mon, 24 Nov 2008 09:47:14 +0100

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
=== modified file 'debian/changelog'
--- debian/changelog	2008-11-16 18:46:07 +0000
+++ debian/changelog	2008-12-06 18:43:45 +0000
@@ -1,3 +1,19 @@
+postgresql-common (94) unstable; urgency=low
+
+  * t/070_non_postgres_clusters.t: Test that all cluster configuration files
+    are owned by the cluster superuser. Reproduces #481349.
+  * pg_createcluster: Make the cluster configuration directory, "start.conf",
+    and "environment" owned by the cluster superuser instead of root.
+    (Closes: #481349)
+  * t/030_errors.t: Check behaviour of starting of clusters with colliding
+    ports. Reproduces #472627.
+  * pg_ctlcluster: Error out with a port collision message if another cluster
+    is already running on the port. (Closes: #472627)
+  * t/090_multicluster.t: Don't reconfigure cluster on conflicting port, since
+    that now fails with above fix.
+
+ -- Martin Pitt <mpitt@debian.org>  Mon, 24 Nov 2008 09:47:14 +0100
+
 postgresql-common (93) unstable; urgency=low
 
   * t/060_obsolete_confparams.t: Test a direct upgrade from oldest to newest

=== modified file 'pg_createcluster'
--- pg_createcluster	2008-07-21 08:56:11 +0000
+++ pg_createcluster	2008-12-01 10:46:45 +0000
@@ -328,8 +328,6 @@
     $newcluster = 1;
 }
 
-chown $owneruid, $ownergid, $datadir;
-
 # create default "start" file
 set_cluster_start_conf $version, $cluster, $startconf;
 
@@ -337,6 +335,7 @@
 move_conffile "$datadir/postgresql.conf", $confdir, $owneruid, $ownergid, '644';
 move_conffile "$datadir/pg_hba.conf", $confdir, $owneruid, $ownergid, '640', 'hba_file';
 move_conffile "$datadir/pg_ident.conf", $confdir, $owneruid, $ownergid, '640', 'ident_file';
+chown $owneruid, $ownergid, $datadir, $confdir, "$confdir/start.conf" or die "chown: $!";
 
 if ($version ge '8.0') {
     PgCommon::set_conf_value $version, $cluster, 'postgresql.conf', 'data_directory', $datadir;
@@ -451,6 +450,7 @@
 ";
 close ENV;
 chmod 0644, "$confdir/environment";
+chown $owneruid, $ownergid, "$confdir/environment";
 
 $createsuccess = 1;
 

=== modified file 'pg_ctlcluster'
--- pg_ctlcluster	2008-07-21 08:56:11 +0000
+++ pg_ctlcluster	2008-12-01 10:46:45 +0000
@@ -243,6 +243,14 @@
 
     start_check_pid_file;
 
+    # check conflicting port
+    foreach my $v (get_versions) {
+        foreach my $c (get_version_clusters $v) {
+            error("Port conflict: cluster $v/$c is already running on port " .
+                $info{'port'}) if cluster_port_running $v, $c, $info{'port'};
+        }
+    }
+
     # get locale used by initdb
     my ($lc_ctype, $lc_collate) = get_cluster_locales $version, $cluster;
     $lc_ctype or error ('Could not parse locale out of pg_controldata output');

=== modified file 't/030_errors.t'
--- t/030_errors.t	2008-04-23 15:56:57 +0000
+++ t/030_errors.t	2008-12-01 10:46:45 +0000
@@ -6,7 +6,7 @@
 
 use lib 't';
 use TestLib;
-use Test::More tests => 154;
+use Test::More tests => 162;
 
 use lib '/usr/share/postgresql-common';
 use PgCommon;
@@ -237,6 +237,22 @@
     'pg_ctlcluster start succeeds again with reappeared /var/lib/postgresql';
 is_program_out 'postgres', "pg_ctlcluster $version main stop", 0, '', 'stopping cluster';
 
+# pg_ctlcluster checks colliding ports
+ok ((system "pg_createcluster $version other >/dev/null") == 0,
+    "pg_createcluster other");
+set_cluster_port $version, 'other', '5432';
+is ((exec_as 'postgres', "pg_ctlcluster $version main start"), 0,
+    'pg_ctlcluster: main cluster on conflicting port starts');
+like_program_out 'postgres', "pg_ctlcluster $version other start", 1,
+    qr/conflict.*8.3\/main/, 
+    'pg_ctlcluster other cluster on conflicting port fails';
+is_program_out 'postgres', "pg_ctlcluster $version main stop", 0, '', 
+    'stopping main cluster';
+is ((exec_as 'postgres', "pg_ctlcluster $version other start"), 0,
+    'pg_ctlcluster: other cluster on conflicting port starts after main is down');
+ok ((system "pg_dropcluster $version other --stop") == 0, 
+    'pg_dropcluster other');
+
 # clean up
 ok ((system "pg_dropcluster $version main") == 0, 
     'pg_dropcluster');

=== modified file 't/070_non_postgres_clusters.t'
--- t/070_non_postgres_clusters.t	2008-07-21 08:56:11 +0000
+++ t/070_non_postgres_clusters.t	2008-12-01 10:46:45 +0000
@@ -6,7 +6,7 @@
 use lib 't';
 use TestLib;
 
-use Test::More tests => 24;
+use Test::More tests => 40;
 
 my $owner = 'nobody';
 my $v = $MAJORS[0];
@@ -28,11 +28,26 @@
 
 ok_dir '/var/run/postgresql', [], '/var/run/postgresql is empty';
 
+# verify owner of configuration files
+my @st;
+my $confdir = "/etc/postgresql/$v/main";
+my ($owneruid, $ownergid) = (getpwnam $owner)[2,3];
+@st = stat $confdir;
+is $st[4], $owneruid, 'conf dir is owned by user';
+is $st[5], $ownergid, 'conf dir is owned by user\'s primary group';
+opendir D, $confdir or die "opendir: $!";
+for my $f (readdir D) {
+    next if $f eq '.' or $f eq '..';
+    @st = stat "$confdir/$f" or die "stat: $!";
+    is $st[4], $owneruid, "$f is owned by user";
+    is $st[5], $ownergid, "$f is owned by user\'s primary group";
+}
+
 # verify log file properties
-my @logstat = stat "/var/log/postgresql/postgresql-$v-main.log";
-is $logstat[2], 0100640, 'log file has 0640 permissions';
-is $logstat[4], (getpwnam $owner)[2], 'log file is owned by user';
-is $logstat[5], (getpwnam $owner)[3], 'log file is owned by user\'s primary group';
+@st = stat "/var/log/postgresql/postgresql-$v-main.log";
+is $st[2], 0100640, 'log file has 0640 permissions';
+is $st[4], $owneruid, 'log file is owned by user';
+is $st[5], $ownergid, 'log file is owned by user\'s primary group';
 
 # Check proper cleanup
 is ((system "pg_dropcluster $v main --stop"), 0, 'pg_dropcluster');

=== modified file 't/090_multicluster.t'
--- t/090_multicluster.t	2008-02-03 17:18:04 +0000
+++ t/090_multicluster.t	2008-12-01 10:46:45 +0000
@@ -9,7 +9,7 @@
 use lib '/usr/share/postgresql-common';
 use PgCommon;
 
-use Test::More tests => 116;
+use Test::More tests => 117;
 
 # Replace all md5 and password authentication methods with 'trust' in given
 # pg_hba.conf file.
@@ -266,10 +266,10 @@
 
 # check proper error message if no cluster could be determined as default for
 # pg_wrapper
-PgCommon::set_conf_value $MAJORS[0], 'old', 'postgresql.conf',
-    'port', '5440';
-is ((system "pg_ctlcluster $MAJORS[0] old restart >/dev/null"), 0, "restarting cluster $old");
-like_program_out 'postgres', 'pg_lsclusters -h | sort -k3', 0, qr/.*5434.*5440.*5440.*/s,
+is ((system "pg_ctlcluster $MAJORS[0] old stop >/dev/null"), 0, "stopping cluster $old");
+PgCommon::set_conf_value $MAJORS[0], 'old', 'postgresql.conf', 'port', '5435';
+is ((system "pg_ctlcluster $MAJORS[0] old start >/dev/null"), 0, "restarting cluster $old");
+like_program_out 'postgres', 'pg_lsclusters -h | sort -k3', 0, qr/.*5434.*5435.*5440.*/s,
     'port of first cluster was successfully changed';
 like_program_out 'postgres', "psql -l", 1, 
     qr/no.*default.*man pg_wrapper/i,

Attachment: signature.asc
Description: Digital signature


Reply to: