Thread: BUG #1093: wrong handling of additional parameters in init script

BUG #1093: wrong handling of additional parameters in init script

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1093
Logged by:          Konstantin Pelepelin

Email address:      cat@dtf.ru

PostgreSQL version: 7.3.4

Operating system:   Linux

Description:        wrong handling of additional parameters in init script

Details:

I use RPMs for linux, which contain file
/etc/rc.d/init.d/postgresql

Version for PostgreSQL 7.3.x contains some logic based on the name of script
NAME=`basename $0`
I assume, it is for support of multiple postmasters using additional files
/etc/sysconfig/pgsql/${NAME}

But this variable is dependable of whether this script was called by hand
from its main location as postgresql (or using RedHat's 'service postgresql
start') or from /etc/rc.d/rc (through symlink as S85postgresql)

Re: BUG #1093: wrong handling of additional parameters in init

From
Bruce Momjian
Date:
We have nothing to do with that script.  Contact your RPM packager or
Linux distributor.

---------------------------------------------------------------------------

PostgreSQL Bugs List wrote:
>
> The following bug has been logged online:
>
> Bug reference:      1093
> Logged by:          Konstantin Pelepelin
>
> Email address:      cat@dtf.ru
>
> PostgreSQL version: 7.3.4
>
> Operating system:   Linux
>
> Description:        wrong handling of additional parameters in init script
>
> Details:
>
> I use RPMs for linux, which contain file
> /etc/rc.d/init.d/postgresql
>
> Version for PostgreSQL 7.3.x contains some logic based on the name of script
> NAME=`basename $0`
> I assume, it is for support of multiple postmasters using additional files
> /etc/sysconfig/pgsql/${NAME}
>
> But this variable is dependable of whether this script was called by hand
> from its main location as postgresql (or using RedHat's 'service postgresql
> start') or from /etc/rc.d/rc (through symlink as S85postgresql)
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: BUG #1093: wrong handling of additional parameters in init script

From
Tom Lane
Date:
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:
> Version for PostgreSQL 7.3.x contains some logic based on the name of script
> NAME=`basename $0`
> I assume, it is for support of multiple postmasters using additional files
> /etc/sysconfig/pgsql/${NAME}

> But this variable is dependable of whether this script was called by hand
> from its main location as postgresql (or using RedHat's 'service postgresql
> start') or from /etc/rc.d/rc (through symlink as S85postgresql)

The version I'm looking at (7.4) works around that as follows:

# Find the name of the script
NAME=`basename $0`
if [ ${NAME:0:1} = "S" -o ${NAME:0:1} = "K" ]
then
    NAME=${NAME:3}
fi

which is pretty darn ugly but seems like it will serve.

            regards, tom lane