postgresql: update patch for hardcoded paths

This commit is contained in:
Leonid Pliushch 2020-10-19 20:26:59 +03:00
parent efd1bd5022
commit 99b1325706
5 changed files with 99 additions and 78 deletions

View File

@ -0,0 +1,99 @@
diff -uNr postgresql-13.0/contrib/pg_trgm/trgm_regexp.c postgresql-13.0.mod/contrib/pg_trgm/trgm_regexp.c
--- postgresql-13.0/contrib/pg_trgm/trgm_regexp.c 2020-09-21 23:47:36.000000000 +0300
+++ postgresql-13.0.mod/contrib/pg_trgm/trgm_regexp.c 2020-10-19 20:20:32.875091545 +0300
@@ -2173,7 +2173,7 @@
{
/* dot -Tpng -o /tmp/source.png < /tmp/source.gv */
- FILE *fp = fopen("/tmp/source.gv", "w");
+ FILE *fp = fopen("@TERMUX_PREFIX@/tmp/source.gv", "w");
fprintf(fp, "%s", buf.data);
fclose(fp);
diff -uNr postgresql-13.0/src/bin/initdb/initdb.c postgresql-13.0.mod/src/bin/initdb/initdb.c
--- postgresql-13.0/src/bin/initdb/initdb.c 2020-09-21 23:47:36.000000000 +0300
+++ postgresql-13.0.mod/src/bin/initdb/initdb.c 2020-10-19 20:20:44.907210164 +0300
@@ -1095,7 +1095,7 @@
#else
snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''");
#endif
- conflines = replace_token(conflines, "#unix_socket_directories = '/tmp'",
+ conflines = replace_token(conflines, "#unix_socket_directories = '@TERMUX_PREFIX@/tmp'",
repltok);
#if DEF_PGPORT != 5432
diff -uNr postgresql-13.0/src/bin/pg_ctl/pg_ctl.c postgresql-13.0.mod/src/bin/pg_ctl/pg_ctl.c
--- postgresql-13.0/src/bin/pg_ctl/pg_ctl.c 2020-09-21 23:47:36.000000000 +0300
+++ postgresql-13.0.mod/src/bin/pg_ctl/pg_ctl.c 2020-10-19 20:17:25.837231316 +0300
@@ -494,7 +494,7 @@
snprintf(cmd, MAXPGPATH, "exec \"%s\" %s%s < \"%s\" 2>&1",
exec_path, pgdata_opt, post_opts, DEVNULL);
- (void) execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL);
+ (void) execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", cmd, (char *) NULL);
/* exec failed */
write_stderr(_("%s: could not start server: %s\n"),
diff -uNr postgresql-13.0/src/bin/pg_upgrade/check.c postgresql-13.0.mod/src/bin/pg_upgrade/check.c
--- postgresql-13.0/src/bin/pg_upgrade/check.c 2020-09-21 23:47:36.000000000 +0300
+++ postgresql-13.0.mod/src/bin/pg_upgrade/check.c 2020-10-19 20:17:25.837231316 +0300
@@ -474,7 +474,7 @@
#ifndef WIN32
/* add shebang header */
- fprintf(script, "#!/bin/sh\n\n");
+ fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n");
#else
/* suppress command echoing */
fprintf(script, "@echo off\n");
@@ -602,7 +602,7 @@
#ifndef WIN32
/* add shebang header */
- fprintf(script, "#!/bin/sh\n\n");
+ fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n");
#endif
/* delete old cluster's default tablespace */
diff -uNr postgresql-13.0/src/bin/psql/command.c postgresql-13.0.mod/src/bin/psql/command.c
--- postgresql-13.0/src/bin/psql/command.c 2020-09-21 23:47:36.000000000 +0300
+++ postgresql-13.0.mod/src/bin/psql/command.c 2020-10-19 20:18:07.733650936 +0300
@@ -3577,7 +3577,7 @@
if (result == -1)
pg_log_error("could not start editor \"%s\"", editorName);
else if (result == 127)
- pg_log_error("could not start /bin/sh");
+ pg_log_error("could not start @TERMUX_PREFIX@/bin/sh");
free(sys);
return result == 0;
@@ -3607,7 +3607,7 @@
const char *tmpdir = getenv("TMPDIR");
if (!tmpdir)
- tmpdir = "/tmp";
+ tmpdir = "@TERMUX_PREFIX@/tmp";
#else
char tmpdir[MAXPGPATH];
int ret;
@@ -4590,7 +4590,7 @@
#ifndef WIN32
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
#else
/*
* CMD.EXE is in different places in different Win32 releases so we
diff -uNr postgresql-13.0/src/include/pg_config_manual.h postgresql-13.0.mod/src/include/pg_config_manual.h
--- postgresql-13.0/src/include/pg_config_manual.h 2020-09-21 23:47:36.000000000 +0300
+++ postgresql-13.0.mod/src/include/pg_config_manual.h 2020-10-19 20:22:20.620150044 +0300
@@ -203,7 +203,7 @@
#ifndef WIN32
#define DEFAULT_PGSOCKET_DIR "/tmp"
#else
-#define DEFAULT_PGSOCKET_DIR ""
+#define DEFAULT_PGSOCKET_DIR "@TERMUX_PREFIX@/tmp"
#endif
/*

View File

@ -1,12 +0,0 @@
diff -u -r ../postgresql-9.6.2/src/bin/pg_ctl/pg_ctl.c ./src/bin/pg_ctl/pg_ctl.c
--- ../postgresql-9.6.2/src/bin/pg_ctl/pg_ctl.c 2017-02-06 22:45:25.000000000 +0100
+++ ./src/bin/pg_ctl/pg_ctl.c 2017-03-05 14:47:06.985823535 +0100
@@ -466,7 +466,7 @@
snprintf(cmd, MAXPGPATH, "exec \"%s\" %s%s < \"%s\" 2>&1",
exec_path, pgdata_opt, post_opts, DEVNULL);
- (void) execl("/bin/sh", "/bin/sh", "-c", cmd, (char *) NULL);
+ (void) execl("@TERMUX_PREFIX@/bin/sh", "sh", "-c", cmd, (char *) NULL);
/* exec failed */
write_stderr(_("%s: could not start server: %s\n"),

View File

@ -1,21 +0,0 @@
diff -u -r ../postgresql-9.6.2/src/bin/pg_upgrade/check.c ./src/bin/pg_upgrade/check.c
--- ../postgresql-9.6.2/src/bin/pg_upgrade/check.c 2017-02-06 22:45:25.000000000 +0100
+++ ./src/bin/pg_upgrade/check.c 2017-03-05 14:47:58.793188439 +0100
@@ -436,7 +436,7 @@
#ifndef WIN32
/* add shebang header */
- fprintf(script, "#!/bin/sh\n\n");
+ fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n");
#else
/* suppress command echoing */
fprintf(script, "@echo off\n");
@@ -564,7 +564,7 @@
#ifndef WIN32
/* add shebang header */
- fprintf(script, "#!/bin/sh\n\n");
+ fprintf(script, "#!@TERMUX_PREFIX@/bin/sh\n\n");
#endif
/* delete old cluster's default tablespace */

View File

@ -1,21 +0,0 @@
diff -u -r ../postgresql-9.6.2/src/bin/psql/command.c ./src/bin/psql/command.c
--- ../postgresql-9.6.2/src/bin/psql/command.c 2017-02-06 22:45:25.000000000 +0100
+++ ./src/bin/psql/command.c 2017-03-05 15:33:33.579755248 +0100
@@ -2258,7 +2258,7 @@
const char *tmpdir = getenv("TMPDIR");
if (!tmpdir)
- tmpdir = "/tmp";
+ tmpdir = "@TERMUX_PREFIX@/tmp";
#else
char tmpdir[MAXPGPATH];
int ret;
@@ -3076,7 +3076,7 @@
#ifndef WIN32
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
#else
/*
* CMD.EXE is in different places in different Win32 releases so we

View File

@ -1,24 +0,0 @@
--- ./src/include/pg_config_manual.h.orig 2020-09-21 22:47:36.000000000 +0200
+++ ./src/include/pg_config_manual.h 2020-10-18 10:17:39.656801301 +0200
@@ -13,6 +13,8 @@
*------------------------------------------------------------------------
*/
+#include <paths.h>
+
/*
* This is the default value for wal_segment_size to be used when initdb is run
* without the --wal-segsize option. It must be a valid segment size.
@@ -203,8 +205,12 @@
#ifndef WIN32
#define DEFAULT_PGSOCKET_DIR "/tmp"
#else
+#ifdef _PATH_TMP
+#define DEFAULT_PGSOCKET_DIR _PATH_TMP
+#else
#define DEFAULT_PGSOCKET_DIR ""
#endif
+#endif
/*
* This is the default event source for Windows event log.