Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#27541 - PostgreSQL init script does not pass the "-m fast" option correctly

Attached to Project: Arch Linux
Opened by Paul Gideon Dann (giddie) - Monday, 12 December 2011, 12:04 GMT
Last edited by Dan McGee (toofishes) - Monday, 13 February 2012, 04:49 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Paul Mattal (paul)
Dan McGee (toofishes)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
When stopping or restarting postgresql using /etc/rc.d/postgresql, the do_postgres function does not pass the "-m fast" option to pg_ctl.

Additional info:
* 9.1.2-1

If you make the line look like this:

su - postgres -c "echo '$PGCTL_BIN' $(printf '%q ' "${PGCTL_ARGS[@]}") $@"

You will see that "echo" sees the "stop" command, but not "-m fast". I'm not entirely sure why; I'm hoping the maintainer has more bash-fu than I do. This really bit me when I wanted to do a quick upgrade to 9.1.2 from 9.1.1, which turned into something somewhat longer as I tried to figure out why Postgres wasn't shutting down properly despite seeing "-m fast" in the init script :s
This task depends upon

Closed by  Dan McGee (toofishes)
Monday, 13 February 2012, 04:49 GMT
Reason for closing:  Implemented
Comment by Dan McGee (toofishes) - Wednesday, 21 December 2011, 13:13 GMT
$ ./postgresql stop
:: Stopping PostgreSQL
su - postgres -c '/usr/bin/pg_ctl' -D /var/lib/postgres/data -l /var/log/postgresql.log -s -w stop -m fast

I'm seeing it get passed along just fine, not sure what is happening in your case...
Comment by Paul Gideon Dann (giddie) - Wednesday, 21 December 2011, 13:17 GMT
It's important that you place the "echo" *inside* the command passed to su. Somehow, the "-m fast" gets dropped by su and pg_ctl never sees it. It's a sneaky bug :)
Comment by Dan McGee (toofishes) - Wednesday, 21 December 2011, 14:12 GMT
do_postgres() {
local args="$@"
su - postgres -c "'$PGCTL_BIN' $(printf '%q ' "${PGCTL_ARGS[@]}") $args"
}

This incantation seems to fix the problem- can you confirm, and if so, it will be in the next version of the package.
Comment by Paul Gideon Dann (giddie) - Wednesday, 21 December 2011, 15:08 GMT
Awesome; that does the trick for me too. Thanks :)

Loading...