Browse Source

initial package creation

Signed-off-by: Toshaan Bharvani <toshaan@powerel.org>
master
Toshaan Bharvani 2 years ago
commit
15bd2719b4
  1. 69
      SOURCES/Makefile.regress
  2. 58
      SOURCES/generate-pdf.sh
  3. BIN
      SOURCES/postgresql-15.0-US.pdf
  4. 191
      SOURCES/postgresql-15.0-llvm_pointer.patch
  5. 4
      SOURCES/postgresql-bashprofile
  6. 99
      SOURCES/postgresql-datalayout-mismatch-on-s390.patch
  7. 43
      SOURCES/postgresql-external-libpq.patch
  8. 32
      SOURCES/postgresql-logging.patch
  9. 12
      SOURCES/postgresql-no-libecpg.patch
  10. 90
      SOURCES/postgresql-pgcrypto-openssl3-tests.patch
  11. 58
      SOURCES/postgresql-server-pg_config.patch
  12. 53
      SOURCES/postgresql-var-run-socket.patch
  13. 3
      SOURCES/postgresql.pam
  14. 1
      SOURCES/postgresql.tmpfiles.d
  15. 72
      SOURCES/rpm-pgsql.patch
  16. 2670
      SPECS/postgresql.spec

69
SOURCES/Makefile.regress

@ -0,0 +1,69 @@
#
# Simplified makefile for running the PostgreSQL regression tests
# in an RPM installation
#

# maximum simultaneous connections for parallel tests
MAXCONNOPT =
ifdef MAX_CONNECTIONS
MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
endif

# locale
NOLOCALE =
ifdef NO_LOCALE
NOLOCALE += --no-locale
endif

srcdir := .

REGRESS_OPTS += --dlpath=.

pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)

pg_regress_installcheck = ./pg_regress --inputdir=$(srcdir) --bindir=@bindir@ $(pg_regress_locale_flags)

# Test input and expected files. These are created by pg_regress itself, so we
# don't have a rule to create them. We do need rules to clean them however.
ifile_list := $(subst .source,, $(notdir $(wildcard $(srcdir)/input/*.source)))
input_files := $(foreach file, $(ifile_list), sql/$(file).sql)
ofile_list := $(subst .source,, $(notdir $(wildcard $(srcdir)/output/*.source)))
output_files := $(foreach file, $(ofile_list), expected/$(file).out)

abs_srcdir := $(shell pwd)
abs_builddir := $(shell pwd)

check: installcheck-parallel

installcheck: cleandirs
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/serial_schedule $(EXTRA_TESTS)

installcheck-parallel: cleandirs
$(pg_regress_installcheck) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)

# The tests command the server to write into testtablespace and results.
# On a SELinux-enabled system this will fail unless we mark those directories
# as writable by the server.
cleandirs:
-rm -rf testtablespace results
mkdir testtablespace results
if test -x /usr/bin/chcon && ! test -f /.dockerenv; then \
/usr/bin/chcon -u system_u -r object_r -t postgresql_db_t testtablespace results ; \
fi

# old interfaces follow...

runcheck: check
runtest: installcheck
runtest-parallel: installcheck-parallel


##
## Clean up
##

clean distclean maintainer-clean:
rm -f $(output_files) $(input_files)
rm -rf testtablespace
rm -rf results tmp_check log
rm -f regression.diffs regression.out regress.out run_check.out

58
SOURCES/generate-pdf.sh

@ -0,0 +1,58 @@
#! /bin/sh

# This script builds the PDF version of the PostgreSQL documentation.
#
# In principle we could do this as part of the RPM build, but there are
# good reasons not to:
# 1. The build would take longer and have a larger BuildRequires footprint.
# 2. The generated PDF has timestamps in it, which would inevitably result
# in multilib conflicts due to slightly different timestamps.
# So instead, we run this manually when rebasing to a new upstream release,
# and treat the resulting PDF as a separate Source file.
#
# You will need to have the docbook packages installed to run this.
# Expect it to take about 20 minutes and use about 160MB of disk.

set -e

# Pass package version (e.g., 9.1.2) as argument
VERSION=$1

test -z "$VERSION" && VERSION=`awk '/^Version:/ { print $2; }' postgresql.spec`

TARGETFILE=postgresql-$VERSION-US.pdf
test -f "$TARGETFILE" && echo "$TARGETFILE exists" && exit 1

echo Building $TARGETFILE ...

# Unpack postgresql

rm -rf postgresql-$VERSION

tar xfj postgresql-$VERSION.tar.bz2

cd postgresql-$VERSION

# Apply any patches that affect the PDF documentation

# patch -p1 < ../xxx.patch

# Configure ...

./configure >/dev/null

# Build the PDF docs

cd doc/src/sgml

make postgres-US.pdf >make.log

mv -f postgres-US.pdf ../../../../$TARGETFILE

# Clean up

cd ../../../..

rm -rf postgresql-$VERSION

exit 0

BIN
SOURCES/postgresql-15.0-US.pdf

Binary file not shown.

191
SOURCES/postgresql-15.0-llvm_pointer.patch

@ -0,0 +1,191 @@
# From 0fed706031df781bb5889a859c47379e3c37f4f4 Mon Sep 17 00:00:00 2001
# From: Thomas Munro <thomas.munro@gmail.com>
# Date: Thu, 22 Sep 2022 23:38:56 +1200
# Subject: [PATCH v2] WIP: jit: LLVM 15: Minimal changes.

# Per https://llvm.org/docs/OpaquePointers.html, support for non-opaque
# pointers still exists and we can request that on our context. We have
# until LLVM 16 to move to opaque pointers.
# ---
# src/backend/jit/llvm/llvmjit.c | 18 +++++++
# src/backend/jit/llvm/meson.build | 3 ++
# configure | 89 ++++++++++++++++++++++++++++++++
# configure.ac | 3 ++
# 4 files changed, 113 insertions(+)

diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index fd3eecf27d3..bccfcfa9698 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -798,6 +798,16 @@ llvm_session_initialize(void)
LLVMInitializeNativeAsmPrinter();
LLVMInitializeNativeAsmParser();
+ /*
+ * When targetting an llvm version with opaque pointers enabled by
+ * default, turn them off for the context we build our code in. Don't need
+ * to do so for other contexts (e.g. llvm_ts_context) - once the IR is
+ * generated, it carries the necessary information.
+ */
+#if LLVM_VERSION_MAJOR > 14
+ LLVMContextSetOpaquePointers(LLVMGetGlobalContext(), false);
+#endif
+
/*
* Synchronize types early, as that also includes inferring the target
* triple.
@@ -1112,7 +1122,11 @@ llvm_resolve_symbols(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx,
LLVMOrcJITDylibRef JD, LLVMOrcJITDylibLookupFlags JDLookupFlags,
LLVMOrcCLookupSet LookupSet, size_t LookupSetSize)
{
+#if LLVM_VERSION_MAJOR > 14
+ LLVMOrcCSymbolMapPairs symbols = palloc0(sizeof(LLVMOrcCSymbolMapPair) * LookupSetSize);
+#else
LLVMOrcCSymbolMapPairs symbols = palloc0(sizeof(LLVMJITCSymbolMapPair) * LookupSetSize);
+#endif
LLVMErrorRef error;
LLVMOrcMaterializationUnitRef mu;
@@ -1230,7 +1244,11 @@ llvm_create_jit_instance(LLVMTargetMachineRef tm)
* Symbol resolution support for "special" functions, e.g. a call into an
* SQL callable function.
*/
+#if LLVM_VERSION_MAJOR > 14
+ ref_gen = LLVMOrcCreateCustomCAPIDefinitionGenerator(llvm_resolve_symbols, NULL, NULL);
+#else
ref_gen = LLVMOrcCreateCustomCAPIDefinitionGenerator(llvm_resolve_symbols, NULL);
+#endif
LLVMOrcJITDylibAddGenerator(LLVMOrcLLJITGetMainJITDylib(lljit), ref_gen);
return lljit;
# diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build
# index de2e624ab58..e5a702163b7 100644
# --- a/src/backend/jit/llvm/meson.build
# +++ b/src/backend/jit/llvm/meson.build
# @@ -51,6 +51,9 @@ endif
# # XXX: Need to determine proper version of the function cflags for clang
# bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv']
# +if llvm.version().version_compare('>=15.0')
# + bitcode_cflags += ['-Xclang', '-no-opaque-pointers']
# +endif
# bitcode_cflags += cppflags
# XXX: Worth improving on the logic to find directories here
diff --git a/configure b/configure
index 1caca21b625..cf457a0ed4a 100755
--- a/configure
+++ b/configure
@@ -7391,6 +7391,95 @@ if test x"$pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard" = x"yes";
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Xclang -no-opaque-pointers, for BITCODE_CFLAGS" >&5
+$as_echo_n "checking whether ${CLANG} supports -Xclang -no-opaque-pointers, for BITCODE_CFLAGS... " >&6; }
+if ${pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_save_CFLAGS=$CFLAGS
+pgac_save_CC=$CC
+CC=${CLANG}
+CFLAGS="${BITCODE_CFLAGS} -Xclang -no-opaque-pointers"
+ac_save_c_werror_flag=$ac_c_werror_flag
+ac_c_werror_flag=yes
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers=yes
+else
+ pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_c_werror_flag=$ac_save_c_werror_flag
+CFLAGS="$pgac_save_CFLAGS"
+CC="$pgac_save_CC"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers" >&5
+$as_echo "$pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers" >&6; }
+if test x"$pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers" = x"yes"; then
+ BITCODE_CFLAGS="${BITCODE_CFLAGS} -Xclang -no-opaque-pointers"
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANGXX} supports -Xclang -no-opaque-pointers, for BITCODE_CXXFLAGS" >&5
+$as_echo_n "checking whether ${CLANGXX} supports -Xclang -no-opaque-pointers, for BITCODE_CXXFLAGS... " >&6; }
+if ${pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ pgac_save_CXXFLAGS=$CXXFLAGS
+pgac_save_CXX=$CXX
+CXX=${CLANGXX}
+CXXFLAGS="${BITCODE_CXXFLAGS} -Xclang -no-opaque-pointers"
+ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ac_cxx_werror_flag=yes
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers=yes
+else
+ pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+CXXFLAGS="$pgac_save_CXXFLAGS"
+CXX="$pgac_save_CXX"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers" >&5
+$as_echo "$pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers" >&6; }
+if test x"$pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers" = x"yes"; then
+ BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -Xclang -no-opaque-pointers"
+fi
+
+
NOT_THE_CFLAGS=""
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5
$as_echo_n "checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; }
diff --git a/configure.ac b/configure.ac
index 10fa55dd154..ecc6c495db9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -625,6 +625,9 @@ if test "$with_llvm" = yes ; then
PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, BITCODE_CFLAGS, [-fexcess-precision=standard])
PGAC_PROG_VARCXX_VARFLAGS_OPT(CLANGXX, BITCODE_CXXFLAGS, [-fexcess-precision=standard])
+ PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, BITCODE_CFLAGS, [-Xclang -no-opaque-pointers])
+ PGAC_PROG_VARCXX_VARFLAGS_OPT(CLANGXX, BITCODE_CXXFLAGS, [-Xclang -no-opaque-pointers])
+
NOT_THE_CFLAGS=""
PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, NOT_THE_CFLAGS, [-Wunused-command-line-argument])
if test -n "$NOT_THE_CFLAGS"; then
--
2.37.3.542.gdd3f6c4cae

4
SOURCES/postgresql-bashprofile

@ -0,0 +1,4 @@
[ -f /etc/profile ] && source /etc/profile

PGDATA=/var/lib/pgsql/data
export PGDATA

99
SOURCES/postgresql-datalayout-mismatch-on-s390.patch

@ -0,0 +1,99 @@
From 0edaa982336823d4d7af8f10b91579fe0099ef3d Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Tue, 20 Apr 2021 20:14:21 -0700
Subject: [PATCH] jit: Workaround potential datalayout mismatch on s390x

LLVM's s390x target uses a different datalayout for z13 and newer processors.
If llvmjit_types.bc is compiled to target a processor older than z13, and
then the JIT runs on a z13 or newer processor, then there will be a mismatch
in datalayouts between llvmjit_types.bc and the JIT engine. This mismatch
causes the JIT to fail at runtime.
---
src/backend/jit/llvm/llvmjit.c | 46 ++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index 98a27f08bf..05b6438ba8 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -776,6 +776,35 @@ llvm_compile_module(LLVMJitContext *context)
errhidecontext(true)));
}
+/*
+ * For the systemz target, LLVM uses a different datalayout for z13 and newer
+ * CPUs than it does for older CPUs. This can cause a mismatch in datalayouts
+ * in the case where the llvm_types_module is compiled with a pre-z13 CPU
+ * and the JIT is running on z13 or newer.
+ * See computeDataLayout() function in
+ * llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp for information on the
+ * datalayout differences.
+ */
+static bool
+needs_systemz_workaround(void)
+{
+ bool ret = false;
+ LLVMContextRef llvm_context;
+ LLVMTypeRef vec_type;
+ LLVMTargetDataRef llvm_layoutref;
+ if (strncmp(LLVMGetTargetName(llvm_targetref), "systemz", strlen("systemz")))
+ {
+ return false;
+ }
+
+ llvm_context = LLVMGetModuleContext(llvm_types_module);
+ vec_type = LLVMVectorType(LLVMIntTypeInContext(llvm_context, 32), 4);
+ llvm_layoutref = LLVMCreateTargetData(llvm_layout);
+ ret = (LLVMABIAlignmentOfType(llvm_layoutref, vec_type) == 16);
+ LLVMDisposeTargetData(llvm_layoutref);
+ return ret;
+}
+
/*
* Per session initialization.
*/
@@ -785,6 +814,7 @@ llvm_session_initialize(void)
MemoryContext oldcontext;
char *error = NULL;
char *cpu = NULL;
+ char *host_features = NULL;
char *features = NULL;
LLVMTargetMachineRef opt0_tm;
LLVMTargetMachineRef opt3_tm;
@@ -816,10 +846,17 @@ llvm_session_initialize(void)
* features not all CPUs have (weird, huh).
*/
cpu = LLVMGetHostCPUName();
- features = LLVMGetHostCPUFeatures();
+ features = host_features = LLVMGetHostCPUFeatures();
elog(DEBUG2, "LLVMJIT detected CPU \"%s\", with features \"%s\"",
cpu, features);
+ if (needs_systemz_workaround())
+ {
+ const char *no_vector =",-vector";
+ features = malloc(sizeof(char) * (strlen(host_features) + strlen(no_vector) + 1));
+ sprintf(features, "%s%s", host_features, no_vector);
+ }
+
opt0_tm =
LLVMCreateTargetMachine(llvm_targetref, llvm_triple, cpu, features,
LLVMCodeGenLevelNone,
@@ -833,8 +870,13 @@ llvm_session_initialize(void)
LLVMDisposeMessage(cpu);
cpu = NULL;
- LLVMDisposeMessage(features);
+ if (features != host_features)
+ {
+ free(features);
+ }
features = NULL;
+ LLVMDisposeMessage(host_features);
+ host_features = NULL;
/* force symbols in main binary to be loaded */
LLVMLoadLibraryPermanently(NULL);
--
2.27.0

43
SOURCES/postgresql-external-libpq.patch

@ -0,0 +1,43 @@
We don't build/install interfaces by upstream's implicit rules.

This patch is used on two places; postgresql.spec and libecpg.spec -- keep those
in sync!

Related: rhbz#1618698

diff --git a/src/Makefile b/src/Makefile
index bcdbd95..4bea236 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,7 +20,6 @@ SUBDIRS = \
backend/utils/mb/conversion_procs \
backend/snowball \
include \
- interfaces \
backend/replication/libpqwalreceiver \
backend/replication/pgoutput \
fe_utils \
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index b9d86ac..29df69f 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -549,7 +549,7 @@ endif
# How to link to libpq. (This macro may be used as-is by backend extensions.
# Client-side code should go through libpq_pgport or libpq_pgport_shlib,
# instead.)
-libpq = -L$(libpq_builddir) -lpq
+libpq = -lpq
# libpq_pgport is for use by client executables (not libraries) that use libpq.
# We force clients to pull symbols from the non-shared libraries libpgport
@@ -579,7 +579,6 @@ endif
# Commonly used submake targets
submake-libpq: | submake-generated-headers
- $(MAKE) -C $(libpq_builddir) all
submake-libpgport: | submake-generated-headers
$(MAKE) -C $(top_builddir)/src/port all
--
2.21.0

32
SOURCES/postgresql-logging.patch

@ -0,0 +1,32 @@
diff -up postgresql-15.0_original/src/backend/utils/misc/postgresql.conf.sample postgresql-15.0/src/backend/utils/misc/postgresql.conf.sample
--- postgresql-15.0_original/src/backend/utils/misc/postgresql.conf.sample 2022-09-27 16:57:00.652909198 +0200
+++ postgresql-15.0/src/backend/utils/misc/postgresql.conf.sample 2022-09-27 17:01:56.073606108 +0200
@@ -449,7 +449,7 @@
# logging_collector to be on.
# This is used when logging to stderr:
-#logging_collector = off # Enable capturing of stderr, jsonlog,
+logging_collector = on # Enable capturing of stderr, jsonlog,
# and csvlog into log files. Required
# to be on for csvlogs and jsonlogs.
# (change requires restart)
@@ -457,16 +457,16 @@
# These are only used if logging_collector is on:
#log_directory = 'log' # directory where log files are written,
# can be absolute or relative to PGDATA
-#log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
+log_filename = 'postgresql-%a.log' # log file name pattern,
# can include strftime() escapes
#log_file_mode = 0600 # creation mode for log files,
# begin with 0 to use octal notation
-#log_rotation_age = 1d # Automatic rotation of logfiles will
+log_rotation_age = 1d # Automatic rotation of logfiles will
# happen after that time. 0 disables.
#log_rotation_size = 10MB # Automatic rotation of logfiles will
# happen after that much log output.
# 0 disables.
-#log_truncate_on_rotation = off # If on, an existing log file with the
+log_truncate_on_rotation = on # If on, an existing log file with the
# same name as the new log file will be
# truncated rather than appended to.
# But such truncation only occurs on

12
SOURCES/postgresql-no-libecpg.patch

@ -0,0 +1,12 @@
diff -up postgresql-13.1/src/interfaces/Makefile.patch10 postgresql-13.1/src/interfaces/Makefile
--- postgresql-13.1/src/interfaces/Makefile.patch10 2021-02-02 21:33:23.235292305 +0100
+++ postgresql-13.1/src/interfaces/Makefile 2021-02-02 21:33:30.281365440 +0100
@@ -12,7 +12,7 @@ subdir = src/interfaces
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
-SUBDIRS = libpq ecpg
+SUBDIRS = libpq
$(recurse)

90
SOURCES/postgresql-pgcrypto-openssl3-tests.patch

@ -0,0 +1,90 @@
diff -ur postgresql-13.4/contrib/pgcrypto/expected/pgp-decrypt.out postgresql-13.4.patched/contrib/pgcrypto/expected/pgp-decrypt.out
--- postgresql-13.4/contrib/pgcrypto/expected/pgp-decrypt.out 2021-08-09 16:49:05.000000000 -0400
+++ postgresql-13.4.patched/contrib/pgcrypto/expected/pgp-decrypt.out 2021-09-01 08:16:48.138600886 -0400
@@ -4,20 +4,6 @@
-- Checking ciphers
select pgp_sym_decrypt(dearmor('
-----BEGIN PGP MESSAGE-----
-Comment: dat1.blowfish.sha1.mdc.s2k3.z0
-
-jA0EBAMCfFNwxnvodX9g0jwB4n4s26/g5VmKzVab1bX1SmwY7gvgvlWdF3jKisvS
-yA6Ce1QTMK3KdL2MPfamsTUSAML8huCJMwYQFfE=
-=JcP+
------END PGP MESSAGE-----
-'), 'foobar');
- pgp_sym_decrypt
------------------
- Secret message.
-(1 row)
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
Comment: dat1.aes.sha1.mdc.s2k3.z0
jA0EBwMCci97v0Q6Z0Zg0kQBsVf5Oe3iC+FBzUmuMV9KxmAyOMyjCc/5i8f1Eest
diff -ur postgresql-13.4/contrib/pgcrypto/expected/pgp-pubkey-decrypt.out postgresql-13.4.patched/contrib/pgcrypto/expected/pgp-pubkey-decrypt.out
--- postgresql-13.4/contrib/pgcrypto/expected/pgp-pubkey-decrypt.out 2021-08-09 16:49:05.000000000 -0400
+++ postgresql-13.4.patched/contrib/pgcrypto/expected/pgp-pubkey-decrypt.out 2021-09-01 08:05:27.750172653 -0400
@@ -594,13 +594,6 @@
(1 row)
select pgp_pub_decrypt(dearmor(data), dearmor(seckey))
-from keytbl, encdata where keytbl.id=2 and encdata.id=2;
- pgp_pub_decrypt
------------------
- Secret msg
-(1 row)
-
-select pgp_pub_decrypt(dearmor(data), dearmor(seckey))
from keytbl, encdata where keytbl.id=3 and encdata.id=3;
pgp_pub_decrypt
-----------------
diff -ur postgresql-15.0_original/contrib/pgcrypto/Makefile postgresql-15.0/contrib/pgcrypto/Makefile
--- postgresql-15.0_original/contrib/pgcrypto/Makefile 2022-09-05 23:12:45.000000000 +0200
+++ postgresql-15.0/contrib/pgcrypto/Makefile 2022-09-27 17:12:54.463159362 +0200
@@ -39,9 +39,9 @@
pgcrypto--1.0--1.1.sql
PGFILEDESC = "pgcrypto - cryptographic functions"
-REGRESS = init md5 sha1 hmac-md5 hmac-sha1 blowfish rijndael \
- sha2 des 3des cast5 \
- crypt-des crypt-md5 crypt-blowfish crypt-xdes \
+REGRESS = init md5 sha1 hmac-md5 hmac-sha1 rijndael \
+ sha2 \
+ crypt-md5 \
pgp-armor pgp-decrypt pgp-encrypt $(CF_PGP_TESTS) \
pgp-pubkey-decrypt pgp-pubkey-encrypt pgp-info

diff -ur postgresql-13.4/contrib/pgcrypto/sql/pgp-decrypt.sql postgresql-13.4.patched/contrib/pgcrypto/sql/pgp-decrypt.sql
--- postgresql-13.4/contrib/pgcrypto/sql/pgp-decrypt.sql 2021-08-09 16:49:05.000000000 -0400
+++ postgresql-13.4.patched/contrib/pgcrypto/sql/pgp-decrypt.sql 2021-09-01 08:16:12.525212175 -0400
@@ -5,16 +5,6 @@
-- Checking ciphers
select pgp_sym_decrypt(dearmor('
-----BEGIN PGP MESSAGE-----
-Comment: dat1.blowfish.sha1.mdc.s2k3.z0
-
-jA0EBAMCfFNwxnvodX9g0jwB4n4s26/g5VmKzVab1bX1SmwY7gvgvlWdF3jKisvS
-yA6Ce1QTMK3KdL2MPfamsTUSAML8huCJMwYQFfE=
-=JcP+
------END PGP MESSAGE-----
-'), 'foobar');
-
-select pgp_sym_decrypt(dearmor('
------BEGIN PGP MESSAGE-----
Comment: dat1.aes.sha1.mdc.s2k3.z0
jA0EBwMCci97v0Q6Z0Zg0kQBsVf5Oe3iC+FBzUmuMV9KxmAyOMyjCc/5i8f1Eest
diff -ur postgresql-13.4/contrib/pgcrypto/sql/pgp-pubkey-decrypt.sql postgresql-13.4.patched/contrib/pgcrypto/sql/pgp-pubkey-decrypt.sql
--- postgresql-13.4/contrib/pgcrypto/sql/pgp-pubkey-decrypt.sql 2021-08-09 16:49:05.000000000 -0400
+++ postgresql-13.4.patched/contrib/pgcrypto/sql/pgp-pubkey-decrypt.sql 2021-09-01 08:06:18.963732342 -0400
@@ -606,9 +606,6 @@
from keytbl, encdata where keytbl.id=1 and encdata.id=1;
select pgp_pub_decrypt(dearmor(data), dearmor(seckey))
-from keytbl, encdata where keytbl.id=2 and encdata.id=2;
-
-select pgp_pub_decrypt(dearmor(data), dearmor(seckey))
from keytbl, encdata where keytbl.id=3 and encdata.id=3;
select pgp_pub_decrypt(dearmor(data), dearmor(seckey))

58
SOURCES/postgresql-server-pg_config.patch

@ -0,0 +1,58 @@
We should ideally provide '/bin/pg_config' in postgresql-server-devel, and
provide no pg_config binary in libpq package. But most of the Fedora packages
that use pg_config actually only build against PG libraries (and
postgresql-server-devel isn't needed). So.., to avoid the initial rush around
rhbz#1618698 change, rather provide pg_server_config binary, which int urn means
that we'll have to fix only a minimal set of packages which really build
PostgreSQL server modules.

diff -ur postgresql-14rc1/src/bin/pg_config/Makefile pgsql14/src/bin/pg_config/Makefile
--- postgresql-14rc1/src/bin/pg_config/Makefile 2021-09-20 23:33:01.000000000 +0200
+++ pgsql14/src/bin/pg_config/Makefile 2021-09-22 10:48:06.484093152 +0200
@@ -11,6 +11,8 @@
PGFILEDESC = "pg_config - report configuration information"
PGAPPICON=win32
+PG_CONFIG = pg_server_config$(X)
+
subdir = src/bin/pg_config
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
@@ -19,22 +21,22 @@
$(WIN32RES) \
pg_config.o
-all: pg_config
+all: $(PG_CONFIG)
-pg_config: $(OBJS) | submake-libpgport
- $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
+$(PG_CONFIG): $(OBJS) | submake-libpgport
+ $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@
install: all installdirs
- $(INSTALL_SCRIPT) pg_config$(X) '$(DESTDIR)$(bindir)/pg_config$(X)'
+ $(INSTALL_SCRIPT) $(PG_CONFIG) '$(DESTDIR)$(bindir)/$(PG_CONFIG)'
installdirs:
$(MKDIR_P) '$(DESTDIR)$(bindir)'
uninstall:
- rm -f '$(DESTDIR)$(bindir)/pg_config$(X)'
+ rm -f '$(DESTDIR)$(bindir)/$(PG_CONFIG)'
clean distclean maintainer-clean:
- rm -f pg_config$(X) $(OBJS)
+ rm -f $(PG_CONFIG) $(OBJS)
rm -rf tmp_check
check:
diff -ur postgresql-15.0_original/src/bin/pg_config/nls.mk postgresql-15.0/src/bin/pg_config/nls.mk
--- postgresql-15.0_original/src/bin/pg_config/nls.mk 2022-09-05 23:12:45.000000000 +0200
+++ postgresql-15.0/src/bin/pg_config/nls.mk 2022-09-27 17:04:14.618932977 +0200
@@ -1,4 +1,4 @@
# src/bin/pg_config/nls.mk
-CATALOG_NAME = pg_config
+CATALOG_NAME = pg_server_config
AVAIL_LANGUAGES = cs de el es fr he it ja ka ko pl pt_BR ru sv tr uk vi zh_CN
GETTEXT_FILES = pg_config.c ../../common/config_info.c ../../common/exec.c

53
SOURCES/postgresql-var-run-socket.patch

@ -0,0 +1,53 @@
Change the built-in default socket directory to be /var/run/postgresql.
For backwards compatibility with (probably non-libpq-based) clients that
might still expect to find the socket in /tmp, also create a socket in
/tmp. This is to resolve communication problems with clients operating
under systemd's PrivateTmp environment, which won't be using the same
global /tmp directory as the server; see bug #825448.

Note that we apply the socket directory change at the level of the
hard-wired defaults in the C code, not by just twiddling the setting in
postgresql.conf.sample; this is so that the change will take effect on
server package update, without requiring any existing postgresql.conf
to be updated. (Of course, a user who dislikes this behavior can still
override it via postgresql.conf.)

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 9481f2d..75532c7 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3196,7 +3196,7 @@ static struct config_string ConfigureNamesString[] =
},
&Unix_socket_directories,
#ifdef HAVE_UNIX_SOCKETS
- DEFAULT_PGSOCKET_DIR,
+ DEFAULT_PGSOCKET_DIR ", /tmp",
#else
"",
#endif
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index feeff9e..3e3d784 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -1234,7 +1234,7 @@ setup_config(void)
#ifdef HAVE_UNIX_SOCKETS
snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'",
- DEFAULT_PGSOCKET_DIR);
+ DEFAULT_PGSOCKET_DIR ", /tmp");
#else
snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''");
#endif
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
index e278fa0..9ee15d4 100644
--- a/src/include/pg_config_manual.h
+++ b/src/include/pg_config_manual.h
@@ -201,7 +201,7 @@
* support them yet.
*/
#ifndef WIN32
-#define DEFAULT_PGSOCKET_DIR "/tmp"
+#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"
#else
#define DEFAULT_PGSOCKET_DIR ""
#endif

3
SOURCES/postgresql.pam

@ -0,0 +1,3 @@
#%PAM-1.0
auth include password-auth
account include password-auth

1
SOURCES/postgresql.tmpfiles.d

@ -0,0 +1 @@
d /run/postgresql 0755 postgres postgres -

72
SOURCES/rpm-pgsql.patch

@ -0,0 +1,72 @@
For the RPMs, we want the custom installation directories to end in
/pgsql not /postgresql. This is historical but not worth changing.

Notice that this patch also makes the appending of /pgsql unconditional.
This is to avoid unexpected behavior if the RPM is built in a working
directory whose path happens to include "postgres" or "pgsql" already.
However, datadir and sysconfdir are already set up in the specfile's
configure call, so we do not have to append anything to them.


diff -Naur postgresql-9.0.1.orig/src/Makefile.global.in postgresql-9.0.1/src/Makefile.global.in
--- postgresql-9.0.1.orig/src/Makefile.global.in 2010-10-01 10:25:44.000000000 -0400
+++ postgresql-9.0.1/src/Makefile.global.in 2010-10-11 11:52:05.224975308 -0400
@@ -55,8 +55,7 @@
# Installation directories
#
# These are set by the equivalent --xxxdir configure options. We
-# append "postgresql" to some of them, if the string does not already
-# contain "pgsql" or "postgres", in order to avoid directory clutter.
+# append "pgsql" to some of them, in order to avoid directory clutter.
#
# In a PGXS build, we cannot use the values inserted into Makefile.global
# by configure, since the installation tree may have been relocated.
@@ -74,45 +73,23 @@
bindir := @bindir@
datadir := @datadir@
-ifeq "$(findstring pgsql, $(datadir))" ""
-ifeq "$(findstring postgres, $(datadir))" ""
-override datadir := $(datadir)/postgresql
-endif
-endif
sysconfdir := @sysconfdir@
-ifeq "$(findstring pgsql, $(sysconfdir))" ""
-ifeq "$(findstring postgres, $(sysconfdir))" ""
-override sysconfdir := $(sysconfdir)/postgresql
-endif
-endif
libdir := @libdir@
pkglibdir = $(libdir)
-ifeq "$(findstring pgsql, $(pkglibdir))" ""
-ifeq "$(findstring postgres, $(pkglibdir))" ""
-override pkglibdir := $(pkglibdir)/postgresql
-endif
-endif
+override pkglibdir := $(pkglibdir)/pgsql
includedir := @includedir@
pkgincludedir = $(includedir)
-ifeq "$(findstring pgsql, $(pkgincludedir))" ""
-ifeq "$(findstring postgres, $(pkgincludedir))" ""
-override pkgincludedir := $(pkgincludedir)/postgresql
-endif
-endif
+override pkgincludedir := $(pkgincludedir)/pgsql
mandir := @mandir@
docdir := @docdir@
-ifeq "$(findstring pgsql, $(docdir))" ""
-ifeq "$(findstring postgres, $(docdir))" ""
-override docdir := $(docdir)/postgresql
-endif
-endif
+override docdir := $(docdir)/pgsql
htmldir := @htmldir@

2670
SPECS/postgresql.spec

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save