Re: BUG #12072: init script creates pid file with wrong owner

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Henrik Størner <henrik(at)hswn(dot)dk>
Cc: Sandeep Thakkar <sandeep(dot)thakkar(at)enterprisedb(dot)com>, henrik-postgres(at)hswn(dot)dk, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #12072: init script creates pid file with wrong owner
Date: 2014-12-01 15:41:15
Message-ID: 11031.1417448475@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?UTF-8?B?SGVucmlrIFN0w7hybmVy?= <henrik(at)hswn(dot)dk> writes:
> The problem is with the init script installed from the rpm package. From
> line 161 it performs the server start by doing

> echo -n "$PSQL_START"
> $SU -l postgres -c "$PGENGINE/postmaster -p '$PGPORT' -D
> '$PGDATA' ${PGOPTS} &" >> "$PGLOG" 2>&1 < /dev/null
> sleep 2
> pid=`head -n 1 "$PGDATA/postmaster.pid" 2>/dev/null`
> if [ "x$pid" != x ]
> then
> success "$PSQL_START"
> touch "$lockfile"
> * echo $pid > "$pidfile"*
> echo
> else
> failure "$PSQL_START"
> echo
> script_result=1
> fi

> Note the
> echo $pid > "$pidfile"

> This creates a pid-file owned by root.

Why is the init script creating such a file at all? Surely it should be
depending on the one created by the postmaster. However, if there is a
reason to create a separate pidfile, I don't see the problem particularly:
the postmaster will neither create nor remove it, so it hardly matters
what the ownership is.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Henrik Størner 2014-12-01 21:00:19 Re: BUG #12072: init script creates pid file with wrong owner
Previous Message Henrik Størner 2014-12-01 07:10:31 Re: BUG #12072: init script creates pid file with wrong owner