Fix
Looks like you generated the patch backwards, it's removing the lines you
propose to add.
diff --git a/configure.ac b/configure.ac
index d093fb88dd..3f0077696b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -749,6 +749,14 @@ PGAC_ARG_BOOL(enable, cassert, no, [enable assertion
checks (for debugging)],
[Define to 1 to build with assertion checks.
(--enable-cassert)])])
+#
+# Disable file permission checks
+#
+PGAC_ARG_BOOL(enable, check-permissions, yes, [disable file permission checks
(for Docker)],
+ [AC_DEFINE([ENABLE_CHECK_PERMISSIONS], 1,
+ [Define to 1 to build with permission checks.
(--disable-check-permissions)])])
+
+
#
# Include directories
#
diff --git a/src/backend/utils/init/miscinit.c
b/src/backend/utils/init/miscinit.c
index ec6a61594a..bcd56cc7cb 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -351,7 +351,7 @@ checkDataDir(void)
*
* XXX can we safely enable this check on Windows?
*/
-#if !defined(WIN32) && !defined(__CYGWIN__)
+#if defined(ENABLE_CHECK_PERMISSIONS) && !defined(WIN32) &&
!defined(__CYGWIN__)
if (stat_buf.st_uid != geteuid())
ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
@@ -371,7 +371,7 @@ checkDataDir(void)
* be proper support for Unix-y file permissions. Need to think of a
* reasonable check to apply on Windows.
*/
-#if !defined(WIN32) && !defined(__CYGWIN__)
+#if defined(ENABLE_CHECK_PERMISSIONS) && !defined(WIN32) &&
!defined(__CYGWIN__)
if (stat_buf.st_mode & PG_MODE_MASK_GROUP)
ereport(FATAL,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index cdd742cb55..df44393855 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -45,6 +45,10 @@
/* Define to the file name extension of dynamically-loadable modules. */
#undef DLSUFFIX
+/* Define to 1 to build with permission checks. (--disable-check-permissions)
+ */
+#undef ENABLE_CHECK_PERMISSIONS
+
/* Define to build with GSSAPI support. (--with-gssapi) */
#undef ENABLE_GSS