pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Remove trailing newlines from pg_upgrade's messages
Date: Tue, 12 Jul 2022 15:45:43 -0400
Message-ID: <1737540.1657655143@sss.pgh.pa.us> (raw)
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>

Kyotaro Horiguchi <horikyota.ntt@gmail.com> 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, bool check_version)
>  	ret = validate_exec(path);
 
>  	if (ret == -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 == -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





view thread (11+ messages)

Message-ID: <1737540.1657655143@sss.pgh.pa.us>
Permalink:  ../1737540.1657655143@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1737540.1657655143@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, horikyota.ntt@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Remove trailing newlines from pg_upgrade's messages
  In-Reply-To: <1737540.1657655143@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