pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: petar@smokva.net
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)
Date: Sat, 17 Mar 2018 14:06:14 -0400
Message-ID: <7607.1521309974@sss.pgh.pa.us> (raw)
In-Reply-To: <87in9uhbco.fsf@news-spur.riddles.org.uk>
References: <152130268473.1317.3689189784729884454@wrigleys.postgresql.org>
	<18476.1521304133@sss.pgh.pa.us>
	<87in9uhbco.fsf@news-spur.riddles.org.uk>

Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.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




view thread (9+ messages)  latest in thread

Message-ID: <7607.1521309974@sss.pgh.pa.us>
Permalink:  ../7607.1521309974@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/7607.1521309974@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andrew@tao11.riddles.org.uk, petar@smokva.net
  Subject: Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)
  In-Reply-To: <7607.1521309974@sss.pgh.pa.us>
  References: <152130268473.1317.3689189784729884454@wrigleys.postgresql.org> <18476.1521304133@sss.pgh.pa.us> <87in9uhbco.fsf@news-spur.riddles.org.uk> <7607.1521309974@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox