Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBLpN-0003Wt-Qp for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2022 19:45:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oBLpM-0000Lx-6p for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2022 19:45:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBLpL-0000KC-Tm for pgsql-hackers@lists.postgresql.org; Tue, 12 Jul 2022 19:45:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBLpJ-0004Oe-U1 for pgsql-hackers@lists.postgresql.org; Tue, 12 Jul 2022 19:45:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26CJjhjK1737541; Tue, 12 Jul 2022 15:45:43 -0400 From: Tom Lane To: Kyotaro Horiguchi cc: pgsql-hackers@lists.postgresql.org Subject: Re: Remove trailing newlines from pg_upgrade's messages In-reply-to: <20220615.131403.1791191615590453058.horikyota.ntt@gmail.com> References: <113191.1655233060@sss.pgh.pa.us> <20220615.125619.2218810959637596955.horikyota.ntt@gmail.com> <20220615.130552.1711221193542446593.horikyota.ntt@gmail.com> <20220615.131403.1791191615590453058.horikyota.ntt@gmail.com> Comments: In-reply-to Kyotaro Horiguchi message dated "Wed, 15 Jun 2022 13:14:03 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1737539.1657655143.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 12 Jul 2022 15:45:43 -0400 Message-ID: <1737540.1657655143@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Kyotaro Horiguchi writes: > FWIW, the following change makes sense to me according to the spec of > validate_exec()... > diff --git a/src/bin/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c > index fadeea12ca..3cff186213 100644 > --- a/src/bin/pg_upgrade/exec.c > +++ b/src/bin/pg_upgrade/exec.c > @@ -430,10 +430,10 @@ check_exec(const char *dir, const char *program, b= ool check_version) > ret =3D validate_exec(path); = > if (ret =3D=3D -1) > - pg_fatal("check for \"%s\" failed: not a regular file\n", > + pg_fatal("check for \"%s\" failed: does not exist or inexecutable\n", > path); > else if (ret =3D=3D -2) > - pg_fatal("check for \"%s\" failed: cannot execute (permission denied)= \n", > + pg_fatal("check for \"%s\" failed: cannot read (permission denied)\n"= , > path); = > snprintf(cmd, sizeof(cmd), "\"%s\" -V", path); I initially did this, but then I wondered why validate_exec() was making it so hard: why can't we just report the failure with %m? It turns out to take only a couple extra lines of code to ensure that something more-or-less appropriate is returned, so we don't need to guess about it here. Pushed that way. regards, tom lane