Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)

From: Petar Bogdanovic <petar(at)smokva(dot)net>
To: Christoph Berg <myon(at)debian(dot)org>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 20:55:44
Message-ID: 20180317205544.GA3507@pintail.NGC068
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, Mar 17, 2018 at 09:40:51PM +0100, Christoph Berg wrote:
> $ chmod 700 .
> $ sudo -u postgres psql
> could not change directory to "/home/cbe": Permission denied
>
> I never observed any negative side effects of it, though. (Except for
> the obvious fact that "\i somethinginmyhome.sql" won't work.)

At least on NetBSD, shutting down the system with sudo while being in a
0700 directory will make the pgsql rc-script fail (because it relies on
pg_ctl), i.e. pull the plug on a running pgsql instance.

One could argue that the NetBSD /etc/rc script should, in general, chdir
before doing anything but relying on getcwd/chdir still seems suboptimal.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2018-03-17 23:02:41 Re: BUG #15116: pg_recvlogical always fails
Previous Message Tom Lane 2018-03-17 20:47:16 Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c)