| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
| Cc: | petar(at)smokva(dot)net, 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 18:06:14 |
| Message-ID: | 7607.1521309974@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Tom> ... I find that quite an unacceptable answer. We need to resolve
> Tom> the symlink correctly, or we risk malfunctioning later, for the
> Tom> reasons recited in the comment for find_my_exec().
> On systems with openat(), would it not be possible to resolve symlinks
> without ever needing chdir?
Um ... AFAICS, openat() just opens a file, it doesn't give back a
resolved path. Did you mean readlinkat()?
In any case, we'd still need to support logic that doesn't rely on
non-portable functions. The (vague) idea I had was to try a little harder
to build absolute paths for ourselves instead of letting the system do it.
I believe for instance that canonicalize_path() has more smarts now about
shortening paths like /foo/bar/baz/../../quux than it did when these
functions were written, so we might be able to rely on just concatenating
paths and then canonicalizing the result. (OTOH, I think there are
filesystems where this wouldn't necessarily yield a nice answer, due to
multiple mounts and suchlike.)
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Petar Bogdanovic | 2018-03-17 19:00:58 | Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) |
| Previous Message | Andrew Gierth | 2018-03-17 17:42:46 | Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) |