diff -Nru postgresql-common-193ubuntu2/cleanpg postgresql-common-194ubuntu1/cleanpg --- postgresql-common-193ubuntu2/cleanpg 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/cleanpg 2018-11-10 03:48:09.000000000 +0000 @@ -5,6 +5,7 @@ # packages.) # # (C) 2008-2009 Martin Pitt +# (C) 2018 Christoph Berg # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +17,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -[ `id -u` = 0 ] || SUDO=sudo -$SUDO /etc/init.d/postgresql stop -$SUDO killall pg_autovacuum postgres -$SUDO rm -rf /etc/postgresql /var/lib/postgresql/ /var/log/postgresql/* /tmp/postgresql-testsuite/ /var/run/postgresql/* +set -ux + +/etc/init.d/postgresql stop +killall postgres +rm -rf /etc/postgresql/* /var/lib/postgresql/* /var/log/postgresql/* /tmp/postgresql-testsuite/ /var/run/postgresql/* diff -Nru postgresql-common-193ubuntu2/debian/changelog postgresql-common-194ubuntu1/debian/changelog --- postgresql-common-193ubuntu2/debian/changelog 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/debian/changelog 2018-11-10 03:48:09.000000000 +0000 @@ -1,14 +1,34 @@ -postgresql-common (193ubuntu2) disco; urgency=medium +postgresql-common (194ubuntu1) disco; urgency=medium - * supported-versions: Follow Debian and default Ubuntu 19.04 to 11 + * Sync with Debian. Remaining change: + - supported version: Set Ubuntu 19.04 default version to 11 - -- Jeremy Bicha Fri, 09 Nov 2018 09:04:55 -0500 + -- Jeremy Bicha Fri, 09 Nov 2018 22:48:09 -0500 -postgresql-common (193ubuntu1) disco; urgency=medium +postgresql-common (194) unstable; urgency=medium - * supported-versions: Add Ubuntu 19.04 defaulting to 10 for now. + * Remove iproute2 | net-tools dependency from postgresql-server-dev-all, + obsolete in pg_buildext since 178. + * Also save pg_controldata on catversion changes, pg_upgrade needs it. + Spotted by Dagfinn Ilmari Mannsåker, thanks! + * Chown /etc/postgresql to user postgres. + * pg_ctlcluster: Use "fast" shutdown by default, and remove code to kill -9 + the server if it doesn't react to a --force stop. (Closes: #756008) + * pg_upgradecluster: Start upgraded cluster only if it was running before, + override with new --[no-]start option. (Closes: #876281) + * pg_upgradecluster: With pg_upgrade, set wal_level early so standby servers + can be upgraded via the instructions from pg_upgrade(1). (Closes: #876293) + * pg_upgradecluster: Notify systemd about disabling the old cluster. + * pg_upgradecluster: Drop sleep(4) that had been there since the first + version. + * pg_createcluster: Create stats_temp_directory, so pg_upgrade(cluster) can + use it even without invoking pg_ctlcluster before. (Closes: #827469) + * pg_upgradecluster: Drop check for pg_restore --no-data-for-failed-tables, + switch was introduced in 8.2; use it always and not only when upgrade + scripts are present. (Closes: #876282) + * Debian: Default PostgreSQL version in buster is 11. - -- Adam Conrad Thu, 01 Nov 2018 06:50:30 -0600 + -- Christoph Berg Thu, 11 Oct 2018 17:29:41 +0200 postgresql-common (193) unstable; urgency=medium @@ -30,7 +50,7 @@ so trying to operate on non-existing clusters fails loudly. (Closes: #891836) * postgresql@.service: Add "RequiresMountsFor /etc/postgresql/%I - /var/lib/postgresql/%I" to depend on mounts. + /var/lib/postgresql/%I" to depend on mounts. (Closes: #855762) * pg_createcluster: Fix error on importing existing clusters, spotted by Mark Eichin, thanks! (Closes: #886871) * postinst_check_catversion: Ignore errors while determining PGDATA. diff -Nru postgresql-common-193ubuntu2/debian/control postgresql-common-194ubuntu1/debian/control --- postgresql-common-193ubuntu2/debian/control 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/debian/control 2018-11-10 03:48:09.000000000 +0000 @@ -84,7 +84,6 @@ Architecture: all Depends: dctrl-tools, - iproute2 | net-tools, lsb-release, make, postgresql-common (>= 117~), diff -Nru postgresql-common-193ubuntu2/debian/maintscripts-functions postgresql-common-194ubuntu1/debian/maintscripts-functions --- postgresql-common-193ubuntu2/debian/maintscripts-functions 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/debian/maintscripts-functions 2018-11-10 03:48:09.000000000 +0000 @@ -191,7 +191,7 @@ ( cd "$VARTMPDIR" mkdir bin lib # lib needs to exists, but we do not copy files there - for f in pg_ctl pg_dump pg_resetwal postgres; do + for f in pg_ctl pg_controldata pg_dump pg_resetwal postgres; do cp -a /usr/lib/postgresql/$MAJOR_VER/bin/$f bin done ) diff -Nru postgresql-common-193ubuntu2/debian/postgresql-common.postinst postgresql-common-194ubuntu1/debian/postgresql-common.postinst --- postgresql-common-193ubuntu2/debian/postgresql-common.postinst 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/debian/postgresql-common.postinst 2018-11-10 03:48:09.000000000 +0000 @@ -60,6 +60,9 @@ test -G /var/lib/postgresql" || \ chown postgres:postgres /var/lib/postgresql + # config directory permissions + chown postgres:postgres /etc/postgresql + # nicer log directory permissions mkdir -p /var/log/postgresql chmod 1775 /var/log/postgresql diff -Nru postgresql-common-193ubuntu2/debian/supported-versions postgresql-common-194ubuntu1/debian/supported-versions --- postgresql-common-193ubuntu2/debian/supported-versions 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/debian/supported-versions 2018-11-10 03:48:09.000000000 +0000 @@ -37,7 +37,7 @@ # X: consider this version supported # # (C) 2005-2016 Martin Pitt -# (C) 2012-2017 Christoph Berg +# (C) 2012-2018 Christoph Berg set -eu @@ -49,7 +49,7 @@ . /usr/share/postgresql-common/pgcommon.sh fi -DEFAULT="10" +DEFAULT="11" # functions @@ -98,7 +98,7 @@ 7|7.*) /bin/echo -e "9.1" ;; # Wheezy 8|8.*) /bin/echo -e "9.4" ;; # Jessie 9|9.*) /bin/echo -e "9.6" ;; # Stretch - 10|10.*) /bin/echo -e "10" ;; # Buster + 10|10.*) /bin/echo -e "11" ;; # Buster testing | unstable) /bin/echo -e "$DEFAULT" ;; *) diff -Nru postgresql-common-193ubuntu2/.gitlab-ci.yml postgresql-common-194ubuntu1/.gitlab-ci.yml --- postgresql-common-193ubuntu2/.gitlab-ci.yml 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/.gitlab-ci.yml 2018-11-10 03:48:09.000000000 +0000 @@ -7,9 +7,8 @@ - dpkg-buildpackage -uc -us -rfakeroot - ( set -x; for deb in ../*.deb; do dpkg-deb --info $deb; dpkg-deb --contents $deb; done ) - ( set -x; dpkg --force-confmiss --force-confnew -i ../*.deb || { apt-get install -fy; dpkg --force-confmiss --force-confnew -i ../*.deb; } ) - - ./cleanpg - dpkg -l postgresql\* | cat - - pg_lsclusters + - ./cleanpg - SKIP_IPV6=1 ./testsuite -v "$(debian/supported-versions)" -i -M jessie: @@ -22,7 +21,7 @@ - ( set -x; for deb in ../*.deb; do dpkg-deb --info $deb; dpkg-deb --contents $deb; done ) - ( set -x; sudo dpkg --force-confmiss --force-confnew -i ../*.deb || { sudo apt-get install -fy; sudo dpkg --force-confmiss --force-confnew -i ../*.deb; } ) - dpkg -l postgresql\* | cat - - pg_lsclusters + - sudo ./cleanpg - sudo ./testsuite -v "$(debian/supported-versions)" -i centos7: @@ -35,5 +34,5 @@ - make rpmbuild - rpm -ql pgdg-centos10 > /dev/null || sudo yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm - make rpminstall - - pg_lsclusters + - sudo ./cleanpg - sudo ./testsuite -v "$(debian/supported-versions)" -i diff -Nru postgresql-common-193ubuntu2/pg_createcluster postgresql-common-194ubuntu1/pg_createcluster --- postgresql-common-193ubuntu2/pg_createcluster 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/pg_createcluster 2018-11-10 03:48:09.000000000 +0000 @@ -471,6 +471,12 @@ setting in postgresql.conf.\n"; delete $defaultconf{stats_temp_directory}; } + # create the stats directory now. pg_ctlcluster would create it anyway, but + # when using pg_upgradecluster -m upgrade, it is not run before the cluster + # is started for the first time + if ($defaultconf{stats_temp_directory}) { + system 'install', '-d', '-m', '750', '-o', $owneruid, '-g', $ownergid, $stats_temp_directory; + } } $> = $euid; diff -Nru postgresql-common-193ubuntu2/pg_ctlcluster postgresql-common-194ubuntu1/pg_ctlcluster --- postgresql-common-193ubuntu2/pg_ctlcluster 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/pg_ctlcluster 2018-11-10 03:48:09.000000000 +0000 @@ -29,7 +29,7 @@ my ($version, $cluster, $pg_ctl, $force); my (@postgres_auxoptions, @pg_ctl_opts_from_cli); my (%postgresql_conf, %info); -my $mode = 'smart'; # default shutdown mode +my $mode = 'fast'; # default shutdown mode my $foreground = 0; # don't daemonize, use postgres instead of pg_ctl my $stdlog = 0; # when run in foreground, still log to the default logfile @@ -261,36 +261,18 @@ push @options, split(' ', $pg_ctl_opts_from_file{'pg_ctl_options'}) if defined $pg_ctl_opts_from_file{'pg_ctl_options'} and $pg_ctl_opts_from_file{'pg_ctl_options'} ne ''; - if ($force) { - if (!fork()) { - close STDOUT; - exec $pg_ctl, @options, '-m', 'fast'; - } else { - wait; - $result = $? >> 8; - } - - # try harder if "fast" mode does not work - if (-f $info{'pgdata'}.'/postmaster.pid') { - print "(does not shutdown gracefully, now stopping immediately)\n"; - $result = system $pg_ctl, @options, '-m', 'immediate'; - } - - # if that still not helps, use the big hammer - if (-f $info{'pgdata'}.'/postmaster.pid') { - print "(does not shutdown, killing the process)"; - my $pid = read_pidfile ($info{'pgdata'}.'/postmaster.pid'); - kill (9, $pid) if $pid; - $result = 0; - } + if (!fork()) { + close STDOUT; + exec $pg_ctl, @options, '-m', ($force ? 'fast' : $mode); } else { - if (!fork()) { - close STDOUT; - exec $pg_ctl, @options, '-m', $mode; - } else { - wait; - $result = $? >> 8; - } + wait; + $result = $? >> 8; + } + + # try harder if forced and server hasn't stopped yet + if ($force and -f $info{'pgdata'}.'/postmaster.pid') { + print "(does not shutdown gracefully, now stopping immediately)\n"; + $result = system $pg_ctl, @options, '-m', 'immediate'; } # external_pid_file files are currently not removed by postgres itself @@ -539,8 +521,8 @@ =item B -Stops the L server of the given cluster. By default, "smart" -shutdown mode is used, which waits until all clients disconnected. +Stops the L server of the given cluster. By default, "fast" +shutdown mode is used. =item B @@ -580,7 +562,7 @@ =item B<-m>|B<--mode> [B|B|B] -Shutdown mode to use for B and B actions, default is B. +Shutdown mode to use for B and B actions, default is B. See pg_ctl(1) for documentation. =item B<--foreground> diff -Nru postgresql-common-193ubuntu2/pg_upgradecluster postgresql-common-194ubuntu1/pg_upgradecluster --- postgresql-common-193ubuntu2/pg_upgradecluster 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/pg_upgradecluster 2018-11-10 03:48:09.000000000 +0000 @@ -4,7 +4,7 @@ # # (C) 2005-2009 Martin Pitt # (C) 2013 Peter Eisentraut -# (C) 2013-2017 Christoph Berg +# (C) 2013-2018 Christoph Berg # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -265,6 +265,7 @@ my $method = 'dump'; my $link = 0; +my $start = -1; # -1 = auto my ($locale, $lc_collate, $lc_ctype, $lc_messages, $lc_monetary, $lc_numeric, $lc_time, $logfile, $old_bindir); @@ -282,6 +283,7 @@ 'rename=s' => \$newcluster, 'old-bindir=s' => \$old_bindir, 'maintenance-db=s' => \$maintenance_db, + 'start!' => \$start, ) or exit 1; $method eq 'dump' or $method eq 'upgrade' or error 'method must be "dump" or "upgrade"'; @@ -332,8 +334,7 @@ error 'could not get name of cluster owner' unless $owner; my $old_hba_modified; -# stopping old cluster, so that we notice early when there are still -# connections +# stop old cluster if ($info{'running'}) { get_encoding $version, $cluster; print "Stopping old cluster...\n"; @@ -387,6 +388,13 @@ error "Could not create target cluster" if system @argv; print "\n"; +# if pg_upgrade is used, wal_level needs to be set early so standby servers can +# be upgraded with the instructions outlined in pg_upgrade(1) +if ($method eq 'upgrade' and $info{config}->{wal_level}) { + PgCommon::set_conf_value $newversion, $newcluster, 'postgresql.conf', + 'wal_level', $info{config}->{wal_level}; +} + %newinfo = cluster_info($newversion, $newcluster); if ($method eq 'dump') { @@ -397,22 +405,13 @@ error "Could not start target cluster" if system @argv; } -sleep(4); - my $pg_restore = get_program_path 'pg_restore', $newversion; -# check whether upgrade scripts exist; if so, verify that pg_restore supports -# -X no-data-for-failed-tables. +# check whether upgrade scripts exist my $upgrade_scripts = (-d "$PgCommon::common_confdir/pg_upgradecluster.d" && ($PgCommon::rpm ? `ls $PgCommon::common_confdir/pg_upgradecluster.d` : `run-parts --test $PgCommon::common_confdir/pg_upgradecluster.d`)); -if ($upgrade_scripts) { - if (`$pg_restore --help` !~ qr/no-data-for-failed-tables/) { - error "$PgCommon::common_confdir/pg_upgradecluster.d has upgrade scripts, but $pg_restore does not support the \"-X no-data-for-failed-tables\" option." - } -} - # Run upgrade scripts in init phase if ($upgrade_scripts) { print "Running phase upgrade hook scripts...\n"; @@ -536,15 +535,8 @@ # start pg_restore and copy over everything my @restore_argv = ($pg_restore, '-h', $newsocket, '-p', - $newinfo{'port'}, '--data-only', '-d', $db); - - if ($newversion >= '8.3') { - push @restore_argv, '--disable-triggers'; - } - - if ($upgrade_scripts) { - push @restore_argv, '--no-data-for-failed-tables'; - } + $newinfo{'port'}, '--data-only', '-d', $db, + '--disable-triggers', '--no-data-for-failed-tables'); open SINK, '|-', @restore_argv or error 'Could not execute pg_restore for new cluster'; @@ -702,9 +694,18 @@ print "Configuring old cluster to use a different port ($oldport)...\n"; set_cluster_port $version, $cluster, $oldport; -print "Starting target cluster on the original port...\n"; -@argv = ('pg_ctlcluster', $newversion, $newcluster, 'start'); -error "Could not start target cluster; please check configuration and log files" if system @argv; +# notify systemd that we modified the old start.conf +if (not exists $ENV{'PG_CLUSTER_CONF_ROOT'} and -d '/run/systemd/system' and $> == 0) { + system 'systemctl daemon-reload'; +} + +# start cluster if it was running before, or upgrade scripts are present +$start = ($info{running} or $upgrade_scripts) if ($start == -1); +if ($start) { + print "Starting target cluster on the original port...\n"; + @argv = ('pg_ctlcluster', $newversion, $newcluster, 'start'); + error "Could not start target cluster; please check configuration and log files" if system @argv; +} # Run upgrade scripts in finish phase if ($upgrade_scripts) { @@ -823,6 +824,11 @@ Database to connect to for maintenance queries. The default is B. +=item B<--[no-]start> + +Start the new database cluster after upgrading. The default is to start the new +cluster if the old cluster was running, or if upgrade hook scripts are present. + =back =head1 HOOK SCRIPTS @@ -860,9 +866,6 @@ Failing scripts will abort the upgrade. The scripts are called as the user who owns the database. -When B<--mode=dump> and upgrade hook scripts are used, pg_restore is invoked -with B<--no-data-for-failed-tables>. - =head1 SEE ALSO L, L, L, L diff -Nru postgresql-common-193ubuntu2/t/020_create_sql_remove.t postgresql-common-194ubuntu1/t/020_create_sql_remove.t --- postgresql-common-193ubuntu2/t/020_create_sql_remove.t 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/t/020_create_sql_remove.t 2018-11-10 03:48:09.000000000 +0000 @@ -11,7 +11,7 @@ use TestLib; use PgCommon; -use Test::More tests => 131 * @MAJORS; +use Test::More tests => 132 * @MAJORS; $ENV{_SYSTEMCTL_SKIP_REDIRECT} = 1; # FIXME: testsuite is hanging otherwise @@ -106,6 +106,8 @@ # verify configuration file permissions my $postgres_uid = (getpwnam 'postgres')[2]; + my @st = stat "/etc/postgresql"; + is $st[4], $postgres_uid, '/etc/postgresql is owned by user "postgres"'; my @st = stat "/etc/postgresql/$v"; is $st[4], $postgres_uid, 'version configuration directory file is owned by user "postgres"'; my @st = stat "/etc/postgresql/$v/main"; diff -Nru postgresql-common-193ubuntu2/t/041_upgrade_custompaths.t postgresql-common-194ubuntu1/t/041_upgrade_custompaths.t --- postgresql-common-193ubuntu2/t/041_upgrade_custompaths.t 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/t/041_upgrade_custompaths.t 2018-11-10 03:48:09.000000000 +0000 @@ -12,7 +12,7 @@ exit 0; } -ok ((system "pg_createcluster --datadir /tmp/postgresql-test -l /tmp/postgresql-test.log $MAJORS[0] upgr >/dev/null") == 0); +ok ((system "pg_createcluster --start --datadir /tmp/postgresql-test -l /tmp/postgresql-test.log $MAJORS[0] upgr >/dev/null") == 0); # Upgrade to latest version my $outref; diff -Nru postgresql-common-193ubuntu2/t/043_upgrade_ssl_cert.t postgresql-common-194ubuntu1/t/043_upgrade_ssl_cert.t --- postgresql-common-193ubuntu2/t/043_upgrade_ssl_cert.t 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/t/043_upgrade_ssl_cert.t 2018-11-10 03:48:09.000000000 +0000 @@ -35,7 +35,7 @@ # Upgrade to latest version my $outref; -is ((exec_as 0, "pg_upgradecluster -v $MAJORS[-1] $MAJORS[0] upgr", $outref, 0), 0, 'pg_upgradecluster succeeds'); +is ((exec_as 0, "pg_upgradecluster --start -v $MAJORS[-1] $MAJORS[0] upgr", $outref, 0), 0, 'pg_upgradecluster succeeds'); like $$outref, qr/Starting target cluster/, 'pg_upgradecluster reported cluster startup'; like $$outref, qr/Success. Please check/, 'pg_upgradecluster reported successful operation'; @@ -58,7 +58,7 @@ # Upgrade to latest version my $outref; -is ((exec_as 0, "pg_upgradecluster -v $MAJORS[-1] $MAJORS[0] upgr", $outref, 0), 0, 'pg_upgradecluster succeeds'); +is ((exec_as 0, "pg_upgradecluster --start -v $MAJORS[-1] $MAJORS[0] upgr", $outref, 0), 0, 'pg_upgradecluster succeeds'); like $$outref, qr/Starting target cluster/, 'pg_upgradecluster reported cluster startup'; like $$outref, qr/Success. Please check/, 'pg_upgradecluster reported successful operation'; diff -Nru postgresql-common-193ubuntu2/t/130_nonroot_admin.t postgresql-common-194ubuntu1/t/130_nonroot_admin.t --- postgresql-common-193ubuntu2/t/130_nonroot_admin.t 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/t/130_nonroot_admin.t 2018-11-10 03:48:09.000000000 +0000 @@ -6,68 +6,46 @@ use lib 't'; use TestLib; -my $ownver = $MAJORS[-1]; -my $grpver = $MAJORS[0]; +my $version = $MAJORS[-1]; +my $oldversion = $MAJORS[0]; -use Test::More tests => 32; +use Test::More tests => 22; use PgCommon; my $testuser = 'postgres'; my ($uid, $gid) = (getpwnam $testuser)[2,3]; -# fails by default due to access restrictions -like_program_out $testuser, "pg_createcluster $ownver fail --start", 1, - qr/root privileges/, "pg_createcluster fails as user $testuser by default"; -# and does not leave any garbage behind -check_clean; - -# prepare directories to that we can access it as owner/group -die "could not mkdir: $!" if system "mkdir -p /etc/postgresql/$ownver /etc/postgresql/$grpver /var/log/postgresql /var/lib/postgresql/$ownver /var/lib/postgresql/$grpver"; -chown $uid, 0, "/etc/postgresql/$ownver", "/var/lib/postgresql/$ownver"; -chown 0, $gid, "/etc/postgresql/$grpver", "/var/log/postgresql", "/var/lib/postgresql/$grpver"; -chmod 0775, "/etc/postgresql/$grpver", "/var/log/postgresql", "/var/lib/postgresql/$grpver"; - # pg_createcluster and pg_ctlcluster -is ((exec_as $testuser, "pg_createcluster $ownver own --start"), 0, +is ((exec_as $testuser, "pg_createcluster $version main --start"), 0, "pg_createcluster succeeds as user $testuser with appropriate owner permissions"); -is ((exec_as $testuser, "pg_createcluster $grpver grp --start"), 0, - "pg_createcluster succeeds as user $testuser with appropriate group permissions"); -like_program_out $testuser, 'pg_lsclusters -h', 0, - qr/^$grpver\s+grp.*online.*\n^$ownver\s+own.*online/m; +like_program_out $testuser, 'pg_lsclusters -h', 0, qr/^$version\s+main.*online/m; like_program_out 'postgres', 'psql -Atl', 0, qr/template1.*UTF8/; # pg_dropcluster -is ((exec_as $testuser, "pg_dropcluster $ownver own --stop"), 0, +is ((exec_as $testuser, "pg_dropcluster $version main --stop"), 0, "pg_dropcluster succeeds as user $testuser with appropriate directory owner permissions"); # pg_upgradecluster -if ($grpver ne $ownver) { +SKIP: { + skip 'Only one major version installed, skipping pg_upgradecluster tests', 8 if ($oldversion eq $version); + + is ((exec_as $testuser, "pg_createcluster $oldversion main --start"), 0, + "pg_createcluster succeeds as user $testuser with appropriate group permissions"); my $outref; - is ((exec_as $testuser, "pg_upgradecluster -v $ownver $grpver grp", $outref, 0), 0, + is ((exec_as $testuser, "pg_upgradecluster -v $version $oldversion main", $outref, 0), 0, "pg_upgradecluster succeeds as user $testuser"); like $$outref, qr/Starting target cluster/, 'pg_upgradecluster reported cluster startup'; like $$outref, qr/Success. Please check/, 'pg_upgradecluster reported successful operation'; like_program_out $testuser, 'pg_lsclusters -h', 0, - qr/^$grpver\s+grp.*down.*\n^$ownver\s+grp.*online/m; + qr/^$oldversion\s+main.*down.*\n^$version\s+main.*online/m; # clean up - is ((exec_as $testuser, "pg_dropcluster $grpver grp"), 0); - is ((exec_as $testuser, "pg_dropcluster $ownver grp --stop"), 0); -} else { - pass 'Only one major version installed, skipping pg_upgradecluster tests'; - for (my $i = 0; $i < 5; ++$i) { pass '...'; } - - is ((exec_as $testuser, "pg_dropcluster $grpver grp --stop"), 0); + is ((exec_as $testuser, "pg_dropcluster $oldversion main"), 0); + is ((exec_as $testuser, "pg_dropcluster $version main --stop"), 0); } -# we cannot expect full cleanliness of /{etc,var/lib}/postgresql since that -# requires root permissions; thus help a bit -rmdir "/etc/postgresql/$ownver"; -rmdir "/etc/postgresql/$grpver"; -rmdir "/var/lib/postgresql/$ownver"; -rmdir "/var/lib/postgresql/$grpver"; check_clean; # vim: filetype=perl diff -Nru postgresql-common-193ubuntu2/t/140_pg_config.t postgresql-common-194ubuntu1/t/140_pg_config.t --- postgresql-common-193ubuntu2/t/140_pg_config.t 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/t/140_pg_config.t 2018-11-10 03:48:09.000000000 +0000 @@ -35,7 +35,7 @@ # mkdir should be in /bin on Debian. If /bin was linked to /usr/bin at build time, usrmerge was installed SKIP: { skip 'MKDIR_P not present before 9.0', 2 if ($version < 9.0); - my $mkdir_path = $PgCommon::rpm ? '/usr/bin' : '/bin'; + my $mkdir_path = ($PgCommon::rpm and $version <= 10) ? '/usr/bin' : '/bin'; is_program_out 'postgres', "grep ^MKDIR_P $PgCommon::binroot$version/lib/pgxs/src/Makefile.global", 0, "MKDIR_P = $mkdir_path/mkdir -p\n"; } diff -Nru postgresql-common-193ubuntu2/testsuite postgresql-common-194ubuntu1/testsuite --- postgresql-common-193ubuntu2/testsuite 2018-11-09 14:04:55.000000000 +0000 +++ postgresql-common-194ubuntu1/testsuite 2018-11-10 03:48:09.000000000 +0000 @@ -139,7 +139,7 @@ mount -t tmpfs tmpfs $d done - chown root:root /etc/postgresql ; chmod 755 /etc/postgresql + chown postgres:postgres /etc/postgresql ; chmod 755 /etc/postgresql chown postgres:postgres /var/lib/postgresql ; chmod 755 /var/lib/postgresql chown root:postgres /var/log/postgresql ; chmod 1775 /var/log/postgresql chown postgres:postgres /var/run/postgresql ; chmod 2775 /var/run/postgresql