0003-Default-new-bindir-to-CWD.patch
application/octet-stream
Filename: 0003-Default-new-bindir-to-CWD.patch
Type: application/octet-stream
Part: 1
Patch
Format: format-patch
Series: patch 0003
Subject: Default new bindir to CWD
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/pgupgrade.sgml | 1 | 0 |
| src/bin/pg_upgrade/option.c | 2 | 2 |
| src/bin/pg_upgrade/pg_upgrade.c | 0 | 11 |
| src/bin/pg_upgrade/pg_upgrade.h | 0 | 1 |
From 0c44439fff2c43d678b29814fe134e60371a672c Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <daniel@yesql.se>
Date: Mon, 25 Mar 2019 23:57:25 +0100
Subject: [PATCH 3/3] Default new bindir to CWD
Make the current working directory the default for new bindir, and
remove the codepath for finding the exec_path as the result is no
longer used.
---
doc/src/sgml/ref/pgupgrade.sgml | 1 +
src/bin/pg_upgrade/option.c | 4 ++--
src/bin/pg_upgrade/pg_upgrade.c | 11 -----------
src/bin/pg_upgrade/pg_upgrade.h | 1 -
4 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index c896882dd1..cd2e351464 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -89,6 +89,7 @@
<term><option>-B</option> <replaceable>bindir</replaceable></term>
<term><option>--new-bindir=</option><replaceable>bindir</replaceable></term>
<listitem><para>the new PostgreSQL executable directory;
+ default is current working directory;
environment variable <envar>PGBINNEW</envar></para></listitem>
</varlistentry>
diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c
index ab5e2d6a30..d49b148531 100644
--- a/src/bin/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -250,7 +250,7 @@ parseCommandLine(int argc, char *argv[])
/* Get values from env if not already set */
check_required_directory(&old_cluster.bindir, "PGBINOLD", false,
"-b", _("old cluster binaries reside"));
- check_required_directory(&new_cluster.bindir, "PGBINNEW", false,
+ check_required_directory(&new_cluster.bindir, "PGBINNEW", true,
"-B", _("new cluster binaries reside"));
check_required_directory(&old_cluster.pgdata, "PGDATAOLD", false,
"-d", _("old cluster data resides"));
@@ -291,7 +291,7 @@ usage(void)
printf(_(" pg_upgrade [OPTION]...\n\n"));
printf(_("Options:\n"));
printf(_(" -b, --old-bindir=BINDIR old cluster executable directory\n"));
- printf(_(" -B, --new-bindir=BINDIR new cluster executable directory\n"));
+ printf(_(" -B, --new-bindir=BINDIR new cluster executable directory (default CWD)\n"));
printf(_(" -c, --check check clusters only, don't change any data\n"));
printf(_(" -d, --old-datadir=DATADIR old cluster data directory\n"));
printf(_(" -D, --new-datadir=DATADIR new cluster data directory\n"));
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 92d8940a9f..ed444996ee 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -202,8 +202,6 @@ main(int argc, char **argv)
static void
setup(char *argv0, bool *live_check)
{
- char exec_path[MAXPGPATH]; /* full path to my executable */
-
/*
* make sure the user has a clean environment, otherwise, we may confuse
* libpq when we connect to one (or both) of the servers.
@@ -245,15 +243,6 @@ setup(char *argv0, bool *live_check)
pg_fatal("There seems to be a postmaster servicing the new cluster.\n"
"Please shutdown that postmaster and try again.\n");
}
-
- /* get path to pg_upgrade executable */
- if (find_my_exec(argv0, exec_path) < 0)
- pg_fatal("%s: could not find own program executable\n", argv0);
-
- /* Trim off program name and keep just path */
- *last_dir_separator(exec_path) = '\0';
- canonicalize_path(exec_path);
- os_info.exec_path = pg_strdup(exec_path);
}
diff --git a/src/bin/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h
index baeb8ff0f8..04b537a8cd 100644
--- a/src/bin/pg_upgrade/pg_upgrade.h
+++ b/src/bin/pg_upgrade/pg_upgrade.h
@@ -320,7 +320,6 @@ typedef struct
typedef struct
{
const char *progname; /* complete pathname for this program */
- char *exec_path; /* full path to my executable */
char *user; /* username for clusters */
bool user_specified; /* user specified on command-line */
char **old_tablespaces; /* tablespaces */
--
2.14.1.145.gb3622a4ee