At Wed, 15 Jun 2022 13:05:52 +0900 (JST), Kyotaro Horiguchi 
<horikyota....@gmail.com> wrote in 
> By the way, I noticed that pg_upgrade complains wrong way when the
> specified binary path doesn't contain "postgres" file.
> 
> $ pg_upgrade -b /tmp -B /tmp -d /tmp -D /tmp
> 
> check for "/tmp/postgres" failed: not a regular file
> Failure, exiting
> 
> I think it should be a quite common mistake to specify the parent
> directory of the binary directory..

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);

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center


Reply via email to