From: | Petar Bogdanovic <petar(at)smokva(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) |
Date: | 2018-03-17 19:00:58 |
Message-ID: | 20180317190058.GA2414@pintail.NGC068 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, Mar 17, 2018 at 12:28:53PM -0400, Tom Lane wrote:
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > In the patch below, path resolution is skipped if getcwd returns EACCES.
>
> ... I find that quite an unacceptable answer.
The patch was just a POC, yes. I was out of better ideas and not really
qualified to rewrite find_my_exec/resolve_symlinks without breaking path
resolution for some other supported platform.
> The idea of pre-checking to see if the initial path is already absolute
> seems safe enough, but I'm not sure how much of the use-case it'd cover.
> I think your example of "sudo /usr/bin/pg_ctl" is pretty artificial;
> who'd bother spelling that out?
rc-scripts on some BSDs spell it out:
$ uname
NetBSD
$ egrep 'command=|doit=' /etc/rc.d/pgsql
command="/usr/pkg/bin/pg_ctl"
doit="/usr/bin/su -m ${pgsql_user} -c '${command} init ${command_args}'"
doit="/usr/bin/su -m ${pgsql_user} -c '${command} start ${command_args}'"
doit="/usr/bin/su -m ${pgsql_user} -c '${command} restart ${command_args}'"
doit="/usr/bin/su -m ${pgsql_user} -c '${command} stop ${command_args}'"
doit="/usr/bin/su -m ${pgsql_user} -c '${command} reload ${command_args}'"
But you are right, testing for an absolute path is not a complete
solution either. Running "sudo pg_ctl" will still fail.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2018-03-17 19:59:30 | Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) |
Previous Message | Tom Lane | 2018-03-17 18:06:14 | Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) |