0005-Remove-configure-probes-for-readlink-and-dead-code-a.patch
text/x-patch
Filename: 0005-Remove-configure-probes-for-readlink-and-dead-code-a.patch
Type: text/x-patch
Part: 4
Patch
Format: format-patch
Series: patch 0005
Subject: Remove configure probes for readlink, and dead code and docs.
| File | + | − |
|---|---|---|
| configure | 1 | 1 |
| configure.ac | 0 | 1 |
| doc/src/sgml/ref/create_tablespace.sgml | 0 | 4 |
| src/backend/access/transam/xlog.c | 0 | 12 |
| src/backend/replication/basebackup.c | 0 | 13 |
| src/backend/utils/adt/misc.c | 0 | 8 |
| src/bin/initdb/findtimezone.c | 1 | 1 |
| src/bin/pg_rewind/file_ops.c | 0 | 5 |
| src/common/exec.c | 2 | 2 |
| src/include/pg_config.h.in | 0 | 3 |
| src/tools/msvc/Solution.pm | 0 | 1 |
From 20df3fb6b0f2ab7f0391738a99958da91a22a114 Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sun, 24 Jul 2022 01:03:11 +1200
Subject: [PATCH 05/13] Remove configure probes for readlink, and dead code and
docs.
readlink() is in SUSv2 and all targeted Unix systems have it.
---
configure | 2 +-
configure.ac | 1 -
doc/src/sgml/ref/create_tablespace.sgml | 4 ----
src/backend/access/transam/xlog.c | 12 ------------
src/backend/replication/basebackup.c | 13 -------------
src/backend/utils/adt/misc.c | 8 --------
src/bin/initdb/findtimezone.c | 2 +-
src/bin/pg_rewind/file_ops.c | 5 -----
src/common/exec.c | 4 ++--
src/include/pg_config.h.in | 3 ---
src/tools/msvc/Solution.pm | 1 -
11 files changed, 4 insertions(+), 51 deletions(-)
diff --git a/configure b/configure
index 62ff8250d4..6e10773263 100755
--- a/configure
+++ b/configure
@@ -16039,7 +16039,7 @@ fi
LIBS_including_readline="$LIBS"
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
-for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pthread_is_threaded_np readlink readv setproctitle setproctitle_fast strchrnul strsignal symlink syncfs sync_file_range uselocale wcstombs_l writev
+for ac_func in backtrace_symbols clock_gettime copyfile fdatasync getifaddrs getpeerucred inet_pton kqueue mbstowcs_l memset_s poll posix_fallocate ppoll pthread_is_threaded_np readv setproctitle setproctitle_fast strchrnul strsignal symlink syncfs sync_file_range uselocale wcstombs_l writev
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.ac b/configure.ac
index eb29046398..b4015aebb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1805,7 +1805,6 @@ AC_CHECK_FUNCS(m4_normalize([
posix_fallocate
ppoll
pthread_is_threaded_np
- readlink
readv
setproctitle
setproctitle_fast
diff --git a/doc/src/sgml/ref/create_tablespace.sgml b/doc/src/sgml/ref/create_tablespace.sgml
index 84fa7ee5e2..9d5ab02526 100644
--- a/doc/src/sgml/ref/create_tablespace.sgml
+++ b/doc/src/sgml/ref/create_tablespace.sgml
@@ -127,10 +127,6 @@ CREATE TABLESPACE <replaceable class="parameter">tablespace_name</replaceable>
<refsect1>
<title>Notes</title>
- <para>
- Tablespaces are only supported on systems that support symbolic links.
- </para>
-
<para>
<command>CREATE TABLESPACE</command> cannot be executed inside a transaction
block.
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 15ab8d90d4..26fbed00a4 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8305,7 +8305,6 @@ do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p,
if (get_dirent_type(fullpath, de, false, ERROR) != PGFILETYPE_LNK)
continue;
-#if defined(HAVE_READLINK) || defined(WIN32)
rllen = readlink(fullpath, linkpath, sizeof(linkpath));
if (rllen < 0)
{
@@ -8358,17 +8357,6 @@ do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p,
ti->oid, escapedpath.data);
pfree(escapedpath.data);
-#else
-
- /*
- * If the platform does not have symbolic links, it should not be
- * possible to have tablespaces - clearly somebody else created
- * them. Warn about it and ignore.
- */
- ereport(WARNING,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("tablespaces are not supported on this platform")));
-#endif
}
FreeDir(tblspcdir);
diff --git a/src/backend/replication/basebackup.c b/src/backend/replication/basebackup.c
index 637c0ce459..1a569e2582 100644
--- a/src/backend/replication/basebackup.c
+++ b/src/backend/replication/basebackup.c
@@ -1328,7 +1328,6 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
#endif
)
{
-#if defined(HAVE_READLINK) || defined(WIN32)
char linkpath[MAXPGPATH];
int rllen;
@@ -1347,18 +1346,6 @@ sendDir(bbsink *sink, const char *path, int basepathlen, bool sizeonly,
size += _tarWriteHeader(sink, pathbuf + basepathlen + 1, linkpath,
&statbuf, sizeonly);
-#else
-
- /*
- * If the platform does not have symbolic links, it should not be
- * possible to have tablespaces - clearly somebody else created
- * them. Warn about it and ignore.
- */
- ereport(WARNING,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("tablespaces are not supported on this platform")));
- continue;
-#endif /* HAVE_READLINK */
}
else if (S_ISDIR(statbuf.st_mode))
{
diff --git a/src/backend/utils/adt/misc.c b/src/backend/utils/adt/misc.c
index 89690be2ed..af0d924459 100644
--- a/src/backend/utils/adt/misc.c
+++ b/src/backend/utils/adt/misc.c
@@ -302,8 +302,6 @@ pg_tablespace_location(PG_FUNCTION_ARGS)
tablespaceOid == GLOBALTABLESPACE_OID)
PG_RETURN_TEXT_P(cstring_to_text(""));
-#if defined(HAVE_READLINK) || defined(WIN32)
-
/*
* Find the location of the tablespace by reading the symbolic link that
* is in pg_tblspc/<oid>.
@@ -349,12 +347,6 @@ pg_tablespace_location(PG_FUNCTION_ARGS)
targetpath[rllen] = '\0';
PG_RETURN_TEXT_P(cstring_to_text(targetpath));
-#else
- ereport(ERROR,
- (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("tablespaces are not supported on this platform")));
- PG_RETURN_NULL();
-#endif
}
/*
diff --git a/src/bin/initdb/findtimezone.c b/src/bin/initdb/findtimezone.c
index ddb65e6489..dc1d4e9a49 100644
--- a/src/bin/initdb/findtimezone.c
+++ b/src/bin/initdb/findtimezone.c
@@ -544,7 +544,7 @@ static bool
check_system_link_file(const char *linkname, struct tztry *tt,
char *bestzonename)
{
-#ifdef HAVE_READLINK
+#ifndef WIN32
char link_target[MAXPGPATH];
int len;
const char *cur_name;
diff --git a/src/bin/pg_rewind/file_ops.c b/src/bin/pg_rewind/file_ops.c
index 6cb288f099..5e6d8b89c4 100644
--- a/src/bin/pg_rewind/file_ops.c
+++ b/src/bin/pg_rewind/file_ops.c
@@ -437,7 +437,6 @@ recurse_dir(const char *datadir, const char *parentpath,
else if (pgwin32_is_junction(fullpath))
#endif
{
-#if defined(HAVE_READLINK) || defined(WIN32)
char link_target[MAXPGPATH];
int len;
@@ -460,10 +459,6 @@ recurse_dir(const char *datadir, const char *parentpath,
if ((parentpath && strcmp(parentpath, "pg_tblspc") == 0) ||
strcmp(path, "pg_wal") == 0)
recurse_dir(datadir, path, callback);
-#else
- pg_fatal("\"%s\" is a symbolic link, but symbolic links are not supported on this platform",
- fullpath);
-#endif /* HAVE_READLINK */
}
}
diff --git a/src/common/exec.c b/src/common/exec.c
index f7d44b0956..2a398f1eb1 100644
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -254,7 +254,7 @@ find_my_exec(const char *argv0, char *retpath)
static int
resolve_symlinks(char *path)
{
-#ifdef HAVE_READLINK
+#ifndef WIN32
struct stat buf;
char orig_wd[MAXPGPATH],
link_buf[MAXPGPATH];
@@ -333,7 +333,7 @@ resolve_symlinks(char *path)
_("could not change directory to \"%s\": %m"), orig_wd);
return -1;
}
-#endif /* HAVE_READLINK */
+#endif /* !WIN32 */
return 0;
}
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 9a3372f7de..9fc0298f7d 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -435,9 +435,6 @@
/* Define to 1 if you have the <readline/readline.h> header file. */
#undef HAVE_READLINE_READLINE_H
-/* Define to 1 if you have the `readlink' function. */
-#undef HAVE_READLINK
-
/* Define to 1 if you have the `readv' function. */
#undef HAVE_READV
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index e3b60a773a..f9aec9494e 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -339,7 +339,6 @@ sub GenerateFiles
HAVE_READLINE_H => undef,
HAVE_READLINE_HISTORY_H => undef,
HAVE_READLINE_READLINE_H => undef,
- HAVE_READLINK => undef,
HAVE_READV => undef,
HAVE_RL_COMPLETION_MATCHES => undef,
HAVE_RL_COMPLETION_SUPPRESS_QUOTE => undef,
--
2.30.2