ports/90884: [patch] PostgreSQL startup script doesn't understand faststart and faststop commands

Victor Snezhko snezhko at indorsoft.ru
Sat Dec 24 19:10:07 UTC 2005


>Number:         90884
>Category:       ports
>Synopsis:       [patch] PostgreSQL startup script doesn't understand faststart and faststop commands
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 24 19:10:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Victor Snezhko
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
IndorSoft
>Environment:
System: FreeBSD freebsd.indorsoft.ru 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Fri Dec 23 00:23:34 NOVT 2005 root at freebsd.indorsoft.ru:/home/vvs/obj/usr/src/sys/VVS i386

>Description:
PostgreSQL startup script is using it's argument incorrectly.
It assumes that argument will be one of "start", "stop", "reload" and others,
and passes this argument to pg_ctl.
But the argument can be prefixed. "fast" is the prefix that is used on startup
(there are others), and when system is booting, it runs pgsql.sh with 
"faststart" argument, which is happily passed to pg_ctl, and pg_ctl
complains about it, and postgresql isn't started at all, at least on -current

>How-To-Repeat:
install databases/postgresql81-server
add postgresql_enable="YES" to /etc/rc.conf
reboot - at startup and shutdown you will see that pg_ctl complains about 
unknown faststart and faststop commands

>Fix:
rc.subr(5) contains code that cleans argument from prefixes, and provides $rc_arg variable as the result.
I suggest changing "$1" to $rc_arg and pass it to pg_ctl
There is a patch against databases/postgresql81-server's script:

=======================================================
--- /usr/ports/databases/postgresql81-server/files/pgsql.sh.tmpl        Wed Dec 14 01:17:13 2005
+++ /usr/local/etc/rc.d/010.pgsql.sh    Sun Dec 25 00:19:45 2005
@@ -35,7 +35,7 @@
 name=postgresql
 rcvar=`set_rcvar`
 command=${prefix}/bin/pg_ctl
-command_args="-D ${postgresql_data} ${postgresql_flags} $1"
+command_args="-D ${postgresql_data} ${postgresql_flags}"
 extra_commands="reload initdb"
 
 start_cmd="postgresql_command start"
@@ -48,7 +48,7 @@
 
 postgresql_command()
 {
-    su -l ${postgresql_user} -c "exec ${command} ${command_args}"
+    su -l ${postgresql_user} -c "exec ${command} ${command_args} ${rc_arg}"
 }
     
 postgresql_initdb()
=======================================================

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list