Re: Remove trailing newlines from pg_upgrade's messages

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Remove trailing newlines from pg_upgrade's messages
Date: 2022-07-12 19:45:43
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-12 19:49:11 Re: automatically generating node support functions
Previous Message Tom Lane 2022-07-12 19:41:43 Re: Remove trailing newlines from pg_upgrade's messages