Hi,

I just noted a behaviour change with the latest change on rc.subr:

        date: 2018/10/16 07:07:05;  author: ajacoutot;  state: Exp;  lines: +2 
-2;  commitid: y1bnk7UTLXqW0ZFW;
        Change the way we call su(1) in rcexec:
        - drop `-'l' to prevent simulating a full login and running 
/root/.profile
        (prodded by a mail from J Greely)
        - use `-m' to preserve the environment because we now set HOME to "/" 
like
        /etc/rc does; note that we now also clear the environment using `env 
-i' before
        running su(1) which leaves us with only HOME, PATH and SHELL

        Committing early to catch regressions fast, if any.
        ok halex@

with `su -l', the current directory is changed, whereas with `su -m' it
is unaffected.

from su man page, about -l:
        and su will change directory to the target login's home directory.


I found it because pg_ctl will fail if started in a directory it can't
read.

# pwd
/root
# rcctl start postgresql
postgresql(failed)
# rcctl -d start postgresql
doing _rc_parse_conf
doing _rc_quirks
postgresql_flags empty, using default >-w -l /var/postgresql/logfile<
doing _rc_parse_conf /var/run/rc.d/postgresql
doing _rc_quirks
doing rc_check
could not identify current directory: Permission denied
pg_ctl: no server running
postgresql
doing rc_start
doing _rc_wait start
doing rc_check
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by pg_ctl but was not found in the
same directory as "pg_ctl".
Check your installation.
could not identify current directory: Permission denied
pg_ctl: no server running
doing _rc_rm_runfile
(failed)

# cd / && rcctl start postgresql
postgresql(ok)


I am unsure about the correct solution. Maybe just having a `cd /' in
rcexec ? it isn't the exact same behaviour (chdir to home directory),
but at least / is expected to be readable.

thanks.
-- 
Sebastien Marie

Reply via email to