Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution(exec.c)
От | Petar Bogdanovic |
---|---|
Тема | Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution(exec.c) |
Дата | |
Msg-id | 20180317190058.GA2414@pintail.NGC068 обсуждение исходный текст |
Ответ на | Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
On Sat, Mar 17, 2018 at 12:28:53PM -0400, Tom Lane wrote: > PG Bug reporting form <noreply@postgresql.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.
В списке pgsql-bugs по дате отправления: