summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/patches/0001-Fix-FTBFS-on-kFreeBSD.patch21
-rw-r--r--debian/patches/0002-Add-CPPFLAGS-to-upstream-makefiles.patch63
-rw-r--r--debian/patches/0003-Use-get_current_dir_name-over-PATHMAX.patch46
-rw-r--r--debian/patches/0004-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch139
-rw-r--r--debian/patches/debian-packaging/0001-Set-Debian-configuration-defaults.patch96
-rw-r--r--debian/patches/series5
6 files changed, 370 insertions, 0 deletions
diff --git a/debian/patches/0001-Fix-FTBFS-on-kFreeBSD.patch b/debian/patches/0001-Fix-FTBFS-on-kFreeBSD.patch
new file mode 100644
index 0000000..6d073a7
--- /dev/null
+++ b/debian/patches/0001-Fix-FTBFS-on-kFreeBSD.patch
@@ -0,0 +1,21 @@
+From: Chris Lamb <lamby@debian.org>
+Date: Fri, 30 Oct 2015 10:53:42 +0000
+Subject: Fix FTBFS on kFreeBSD
+
+---
+ src/fmacros.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/fmacros.h b/src/fmacros.h
+index c5da4b7..103b325 100644
+--- a/src/fmacros.h
++++ b/src/fmacros.h
+@@ -41,7 +41,7 @@
+ #define _ALL_SOURCE
+ #endif
+
+-#if defined(__linux__) || defined(__OpenBSD__)
++#if defined(__linux__) || defined(__OpenBSD__) || defined(__GLIBC__)
+ #define _XOPEN_SOURCE 700
+ /*
+ * On NetBSD, _XOPEN_SOURCE undefines _NETBSD_SOURCE and
diff --git a/debian/patches/0002-Add-CPPFLAGS-to-upstream-makefiles.patch b/debian/patches/0002-Add-CPPFLAGS-to-upstream-makefiles.patch
new file mode 100644
index 0000000..7a2ae18
--- /dev/null
+++ b/debian/patches/0002-Add-CPPFLAGS-to-upstream-makefiles.patch
@@ -0,0 +1,63 @@
+From: Chris Lamb <lamby@debian.org>
+Date: Fri, 30 Oct 2015 10:53:42 +0000
+Subject: Add CPPFLAGS to upstream makefiles
+
+---
+ deps/fpconv/Makefile | 2 +-
+ deps/hdr_histogram/Makefile | 2 +-
+ deps/linenoise/Makefile | 2 +-
+ src/Makefile | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/deps/fpconv/Makefile b/deps/fpconv/Makefile
+index 2654888..64d2ed0 100644
+--- a/deps/fpconv/Makefile
++++ b/deps/fpconv/Makefile
+@@ -2,7 +2,7 @@ STD=
+ WARN= -Wall
+ OPT= -Os
+
+-R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
++R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(CPPFLAGS)
+ R_LDFLAGS= $(LDFLAGS)
+ DEBUG= -g
+
+diff --git a/deps/hdr_histogram/Makefile b/deps/hdr_histogram/Makefile
+index 28dd93e..3a6413e 100644
+--- a/deps/hdr_histogram/Makefile
++++ b/deps/hdr_histogram/Makefile
+@@ -2,7 +2,7 @@ STD= -std=c99
+ WARN= -Wall
+ OPT= -Os
+
+-R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) -DHDR_MALLOC_INCLUDE=\"hdr_redis_malloc.h\"
++R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(CPPFLAGS) -DHDR_MALLOC_INCLUDE=\"hdr_redis_malloc.h\"
+ R_LDFLAGS= $(LDFLAGS)
+ DEBUG= -g
+
+diff --git a/deps/linenoise/Makefile b/deps/linenoise/Makefile
+index 1dd894b..12ada21 100644
+--- a/deps/linenoise/Makefile
++++ b/deps/linenoise/Makefile
+@@ -6,7 +6,7 @@ R_CFLAGS= $(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)
+ R_LDFLAGS= $(LDFLAGS)
+ DEBUG= -g
+
+-R_CC=$(CC) $(R_CFLAGS)
++R_CC=$(CC) $(R_CFLAGS) $(CPPFLAGS)
+ R_LD=$(CC) $(R_LDFLAGS)
+
+ linenoise.o: linenoise.h linenoise.c
+diff --git a/src/Makefile b/src/Makefile
+index ecbd275..f81f892 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -317,7 +317,7 @@ else
+ endef
+ endif
+
+-REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS)
++REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS) $(CPPFLAGS)
+ REDIS_LD=$(QUIET_LINK)$(CC) $(FINAL_LDFLAGS)
+ REDIS_INSTALL=$(QUIET_INSTALL)$(INSTALL)
+
diff --git a/debian/patches/0003-Use-get_current_dir_name-over-PATHMAX.patch b/debian/patches/0003-Use-get_current_dir_name-over-PATHMAX.patch
new file mode 100644
index 0000000..50aff3d
--- /dev/null
+++ b/debian/patches/0003-Use-get_current_dir_name-over-PATHMAX.patch
@@ -0,0 +1,46 @@
+From: Chris Lamb <lamby@debian.org>
+Date: Wed, 24 Jan 2018 22:06:35 +1100
+Subject: Use get_current_dir_name over PATHMAX, etc.
+
+---
+ src/rdb.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/rdb.c b/src/rdb.c
+index ed30b65..a2d8aec 100644
+--- a/src/rdb.c
++++ b/src/rdb.c
+@@ -1443,7 +1443,6 @@ werr: /* Write error. */
+ }
+
+ static int rdbSaveInternal(int req, const char *filename, rdbSaveInfo *rsi, int rdbflags) {
+- char cwd[MAXPATHLEN]; /* Current working dir path for error messages. */
+ rio rdb;
+ int error = 0;
+ int saved_errno;
+@@ -1453,7 +1452,7 @@ static int rdbSaveInternal(int req, const char *filename, rdbSaveInfo *rsi, int
+ if (!fp) {
+ saved_errno = errno;
+ char *str_err = strerror(errno);
+- char *cwdp = getcwd(cwd,MAXPATHLEN);
++ char *cwdp = get_current_dir_name();
+ serverLog(LL_WARNING,
+ "Failed opening the temp RDB file %s (in server root dir %s) "
+ "for saving: %s",
+@@ -1515,7 +1514,6 @@ int rdbSaveToFile(const char *filename) {
+ /* Save the DB on disk. Return C_ERR on error, C_OK on success. */
+ int rdbSave(int req, char *filename, rdbSaveInfo *rsi, int rdbflags) {
+ char tmpfile[256];
+- char cwd[MAXPATHLEN]; /* Current working dir path for error messages. */
+
+ startSaving(RDBFLAGS_NONE);
+ snprintf(tmpfile,256,"temp-%d.rdb", (int) getpid());
+@@ -1529,7 +1527,7 @@ int rdbSave(int req, char *filename, rdbSaveInfo *rsi, int rdbflags) {
+ * if the generate DB file is ok. */
+ if (rename(tmpfile,filename) == -1) {
+ char *str_err = strerror(errno);
+- char *cwdp = getcwd(cwd,MAXPATHLEN);
++ char *cwdp = get_current_dir_name();
+ serverLog(LL_WARNING,
+ "Error moving temp DB file %s on the final "
+ "destination %s (in server root dir %s): %s",
diff --git a/debian/patches/0004-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch b/debian/patches/0004-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch
new file mode 100644
index 0000000..9f4b787
--- /dev/null
+++ b/debian/patches/0004-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch
@@ -0,0 +1,139 @@
+From: Chris Lamb <lamby@debian.org>
+Date: Sat, 25 Aug 2018 17:52:13 +0200
+Subject: Add support for USE_SYSTEM_JEMALLOC flag.
+
+Forwarded: https://github.com/antirez/redis/pull/5279
+---
+ deps/Makefile | 2 ++
+ src/Makefile | 5 +++++
+ src/debug.c | 4 ++++
+ src/object.c | 5 +++++
+ src/sds.c | 4 ++++
+ src/zmalloc.c | 10 ++++++++++
+ src/zmalloc.h | 4 ++++
+ 7 files changed, 34 insertions(+)
+
+diff --git a/deps/Makefile b/deps/Makefile
+index 3bf0363..9b25947 100644
+--- a/deps/Makefile
++++ b/deps/Makefile
+@@ -39,7 +39,9 @@ distclean:
+ -(cd hiredis && $(MAKE) clean) > /dev/null || true
+ -(cd linenoise && $(MAKE) clean) > /dev/null || true
+ -(cd lua && $(MAKE) clean) > /dev/null || true
++ifneq ($(USE_SYSTEM_JEMALLOC),yes)
+ -(cd jemalloc && [ -f Makefile ] && $(MAKE) distclean) > /dev/null || true
++endif
+ -(cd hdr_histogram && $(MAKE) clean) > /dev/null || true
+ -(cd fpconv && $(MAKE) clean) > /dev/null || true
+ -(rm -f .make-*)
+diff --git a/src/Makefile b/src/Makefile
+index f81f892..527eef9 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -266,10 +266,15 @@ ifeq ($(MALLOC),tcmalloc_minimal)
+ endif
+
+ ifeq ($(MALLOC),jemalloc)
++ifeq ($(USE_SYSTEM_JEMALLOC),yes)
++ FINAL_CFLAGS+= -DUSE_JEMALLOC -I/usr/include/jemalloc/include
++ FINAL_LIBS := -ljemalloc $(FINAL_LIBS)
++else
+ DEPENDENCY_TARGETS+= jemalloc
+ FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include
+ FINAL_LIBS := ../deps/jemalloc/lib/libjemalloc.a $(FINAL_LIBS)
+ endif
++endif
+
+ # LIBSSL & LIBCRYPTO
+ LIBSSL_LIBS=
+diff --git a/src/debug.c b/src/debug.c
+index 684f692..5dcc0ac 100644
+--- a/src/debug.c
++++ b/src/debug.c
+@@ -73,6 +73,10 @@ void printCrashReport(void);
+ void bugReportEnd(int killViaSignal, int sig);
+ void logStackTrace(void *eip, int uplevel);
+
++#if defined(USE_JEMALLOC) && (USE_SYSTEM_JEMALLOC == yes)
++#define je_mallctl mallctl
++#endif
++
+ /* ================================= Debugging ============================== */
+
+ /* Compute the sha1 of string at 's' with 'len' bytes long.
+diff --git a/src/object.c b/src/object.c
+index 4b3526a..be80376 100644
+--- a/src/object.c
++++ b/src/object.c
+@@ -38,6 +38,11 @@
+ #define strtold(a,b) ((long double)strtod((a),(b)))
+ #endif
+
++#if defined(USE_JEMALLOC) && (USE_SYSTEM_JEMALLOC == yes)
++#define je_mallctl mallctl
++#define je_malloc_stats_print malloc_stats_print
++#endif
++
+ /* ===================== Creation and parsing of objects ==================== */
+
+ robj *createObject(int type, void *ptr) {
+diff --git a/src/sds.c b/src/sds.c
+index 2cc5b23..f70a29e 100644
+--- a/src/sds.c
++++ b/src/sds.c
+@@ -40,6 +40,10 @@
+ #include "sdsalloc.h"
+ #include "util.h"
+
++#if USE_SYSTEM_JEMALLOC == yes
++#define je_nallocx(size, flags) nallocx(size, flags)
++#endif
++
+ const char *SDS_NOINIT = "SDS_NOINIT";
+
+ static inline int sdsHdrSize(char type) {
+diff --git a/src/zmalloc.c b/src/zmalloc.c
+index bbfa386..244748e 100644
+--- a/src/zmalloc.c
++++ b/src/zmalloc.c
+@@ -80,6 +80,15 @@ void zlibc_free(void *ptr) {
+ #define realloc(ptr,size) tc_realloc(ptr,size)
+ #define free(ptr) tc_free(ptr)
+ #elif defined(USE_JEMALLOC)
++#if USE_SYSTEM_JEMALLOC == yes
++#define malloc(size) malloc(size)
++#define calloc(count,size) calloc(count,size)
++#define realloc(ptr,size) realloc(ptr,size)
++#define free(ptr) free(ptr)
++#define mallocx(size,flags) mallocx(size,flags)
++#define dallocx(ptr,flags) dallocx(ptr,flags)
++#define je_mallctl mallctl
++#else
+ #define malloc(size) je_malloc(size)
+ #define calloc(count,size) je_calloc(count,size)
+ #define realloc(ptr,size) je_realloc(ptr,size)
+@@ -87,6 +96,7 @@ void zlibc_free(void *ptr) {
+ #define mallocx(size,flags) je_mallocx(size,flags)
+ #define dallocx(ptr,flags) je_dallocx(ptr,flags)
+ #endif
++#endif
+
+ #define update_zmalloc_stat_alloc(__n) atomicIncr(used_memory,(__n))
+ #define update_zmalloc_stat_free(__n) atomicDecr(used_memory,(__n))
+diff --git a/src/zmalloc.h b/src/zmalloc.h
+index 491013a..cfc3905 100644
+--- a/src/zmalloc.h
++++ b/src/zmalloc.h
+@@ -50,7 +50,11 @@
+ #include <jemalloc/jemalloc.h>
+ #if (JEMALLOC_VERSION_MAJOR == 2 && JEMALLOC_VERSION_MINOR >= 1) || (JEMALLOC_VERSION_MAJOR > 2)
+ #define HAVE_MALLOC_SIZE 1
++#if USE_SYSTEM_JEMALLOC == yes
++#define zmalloc_size(p) malloc_usable_size(p)
++#else
+ #define zmalloc_size(p) je_malloc_usable_size(p)
++#endif
+ #else
+ #error "Newer version of jemalloc required"
+ #endif
diff --git a/debian/patches/debian-packaging/0001-Set-Debian-configuration-defaults.patch b/debian/patches/debian-packaging/0001-Set-Debian-configuration-defaults.patch
new file mode 100644
index 0000000..abd060f
--- /dev/null
+++ b/debian/patches/debian-packaging/0001-Set-Debian-configuration-defaults.patch
@@ -0,0 +1,96 @@
+From: Chris Lamb <lamby@debian.org>
+Date: Tue, 10 Oct 2017 09:56:42 +0100
+Subject: Set Debian configuration defaults
+
+Forwarded: not-needed
+---
+ redis.conf | 10 +++++-----
+ sentinel.conf | 8 ++++----
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/redis.conf b/redis.conf
+index 97f077b..71806c8 100644
+--- a/redis.conf
++++ b/redis.conf
+@@ -152,7 +152,7 @@ tcp-backlog 511
+ # incoming connections. There is no default, so Redis will not listen
+ # on a unix socket when not specified.
+ #
+-# unixsocket /run/redis.sock
++# unixsocket /run/redis/redis-server.sock
+ # unixsocketperm 700
+
+ # Close the connection after a client is idle for N seconds (0 to disable)
+@@ -306,7 +306,7 @@ tcp-keepalive 300
+ # By default Redis does not run as a daemon. Use 'yes' if you need it.
+ # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
+ # When Redis is supervised by upstart or systemd, this parameter has no impact.
+-daemonize no
++daemonize yes
+
+ # If you run Redis from upstart or systemd, Redis can interact with your
+ # supervision tree. Options:
+@@ -338,7 +338,7 @@ daemonize no
+ #
+ # Note that on modern Linux systems "/run/redis.pid" is more conforming
+ # and should be used instead.
+-pidfile /var/run/redis_6379.pid
++pidfile /run/redis/redis-server.pid
+
+ # Specify the server verbosity level.
+ # This can be one of:
+@@ -352,7 +352,7 @@ loglevel notice
+ # Specify the log file name. Also the empty string can be used to force
+ # Redis to log on the standard output. Note that if you use standard
+ # output for logging but daemonize, logs will be sent to /dev/null
+-logfile ""
++logfile /var/log/redis/redis-server.log
+
+ # To enable logging to the system logger, just set 'syslog-enabled' to yes,
+ # and optionally update the other syslog parameters to suit your needs.
+@@ -507,7 +507,7 @@ rdb-del-sync-files no
+ # The Append Only File will also be created inside this directory.
+ #
+ # Note that you must specify a directory here, not a file name.
+-dir ./
++dir /var/lib/redis
+
+ ################################# REPLICATION #################################
+
+diff --git a/sentinel.conf b/sentinel.conf
+index b7b3604..ccd5944 100644
+--- a/sentinel.conf
++++ b/sentinel.conf
+@@ -12,12 +12,12 @@ port 26379
+ # By default Redis Sentinel does not run as a daemon. Use 'yes' if you need it.
+ # Note that Redis will write a pid file in /var/run/redis-sentinel.pid when
+ # daemonized.
+-daemonize no
++daemonize yes
+
+ # When running daemonized, Redis Sentinel writes a pid file in
+ # /var/run/redis-sentinel.pid by default. You can specify a custom pid file
+ # location here.
+-pidfile /var/run/redis-sentinel.pid
++pidfile /run/sentinel/redis-sentinel.pid
+
+ # Specify the server verbosity level.
+ # This can be one of:
+@@ -31,7 +31,7 @@ loglevel notice
+ # Specify the log file name. Also the empty string can be used to force
+ # Sentinel to log on the standard output. Note that if you use standard
+ # output for logging but daemonize, logs will be sent to /dev/null
+-logfile ""
++logfile /var/log/redis/redis-sentinel.log
+
+ # To enable logging to the system logger, just set 'syslog-enabled' to yes,
+ # and optionally update the other syslog parameters to suit your needs.
+@@ -70,7 +70,7 @@ logfile ""
+ # For Redis Sentinel to chdir to /tmp at startup is the simplest thing
+ # for the process to don't interfere with administrative tasks such as
+ # unmounting filesystems.
+-dir /tmp
++dir /var/lib/redis
+
+ # sentinel monitor <master-name> <ip> <redis-port> <quorum>
+ #
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..4dba69b
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,5 @@
+debian-packaging/0001-Set-Debian-configuration-defaults.patch
+0001-Fix-FTBFS-on-kFreeBSD.patch
+0002-Add-CPPFLAGS-to-upstream-makefiles.patch
+0003-Use-get_current_dir_name-over-PATHMAX.patch
+0004-Add-support-for-USE_SYSTEM_JEMALLOC-flag.patch