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 1exIjf-0001NC-25 for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Mar 2018 20:47:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1exIjd-0002Xu-PY for pgsql-bugs@arkaria.postgresql.org; Sat, 17 Mar 2018 20:47:25 +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 1exIjd-0002Xh-Fz for pgsql-bugs@lists.postgresql.org; Sat, 17 Mar 2018 20:47:25 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1exIjb-00037F-1L for pgsql-bugs@lists.postgresql.org; Sat, 17 Mar 2018 20:47:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w2HKlGeN020794; Sat, 17 Mar 2018 16:47:16 -0400 From: Tom Lane To: Christoph Berg cc: Andrew Gierth , petar@smokva.net, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15120: use of getcwd(3)/chdir(2) during path resolution (exec.c) In-reply-to: <20180317204051.GG23570@msg.df7cb.de> 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> Comments: In-reply-to Christoph Berg message dated "Sat, 17 Mar 2018 21:40:51 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20792.1521319636.1@sss.pgh.pa.us> Date: Sat, 17 Mar 2018 16:47:16 -0400 Message-ID: <20793.1521319636@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Christoph Berg writes: > Re: Andrew Gierth 2018-03-17 <87in9uhbco.fsf@news-spur.riddles.org.uk> >> Tom> I think your example of "sudo /usr/bin/pg_ctl" is pretty >> Tom> artificial; who'd bother spelling that out? >> >> Not necessarily exactly like that, but we do occasionally get this issue >> coming up on the IRC channel. > It's absolutely not artificial. I can easily trigger the message from > my home directory: > $ chmod 700 . > $ sudo -u postgres psql > could not change directory to "/home/cbe": Permission denied No, I think you missed my point: I thought typing "sudo ... /usr/bin/pg_ctl" rather than just "sudo ... pg_ctl" seemed artificial. Your example doesn't exactly contradict that. It's relevant here because it affects whether or not argv[0] is already an absolute path. regards, tom lane