Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exIrq-0001po-4B for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Mar 2018 20:55:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1exIro-0004gn-Gw for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Mar 2018 20:55:52 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exIro-0004ge-7l for pgsql-bugs@lists.postgresql.org; Sat, 17 Mar 2018 20:55:52 +0000 Received: from crane.smokva.net ([85.10.196.166]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exIrl-0003K7-3W for pgsql-bugs@lists.postgresql.org; Sat, 17 Mar 2018 20:55:50 +0000 Received: from pintail.NGC068 (212-51-138-61.fiber7.init7.net [212.51.138.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by crane.smokva.net (Postfix) with ESMTPSA id D1D5B1CAEE56; Sat, 17 Mar 2018 21:55:45 +0100 (CET) Date: Sat, 17 Mar 2018 21:55:44 +0100 From: Petar Bogdanovic To: Christoph Berg Cc: Andrew Gierth , Tom Lane , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) Message-ID: <20180317205544.GA3507@pintail.NGC068> References: <152130268473.1317.3689189784729884454@wrigleys.postgresql.org> <18476.1521304133@sss.pgh.pa.us> <87in9uhbco.fsf@news-spur.riddles.org.uk> <20180317204051.GG23570@msg.df7cb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180317204051.GG23570@msg.df7cb.de> User-Agent: Mutt/1.9.3 (2018-01-21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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.