[memcached] Apply patch from memcached issue #60, solves Bugzilla 631051

Paul Lindner plindner at fedoraproject.org
Wed Sep 8 21:57:07 UTC 2010


commit dacc6d4d1966059dd780d7419604cf325c8753c9
Author: Paul Lindner <lindner at inuus.com>
Date:   Wed Sep 8 14:56:24 2010 -0700

    Apply patch from memcached issue #60, solves Bugzilla 631051

 memcached-1.4.5-issue60.diff |   40 ++++++++++++++++++++++++++++++++++++++++
 memcached.spec               |   15 +++++++++++++--
 2 files changed, 53 insertions(+), 2 deletions(-)
---
diff --git a/memcached-1.4.5-issue60.diff b/memcached-1.4.5-issue60.diff
new file mode 100644
index 0000000..ac8d4dd
--- /dev/null
+++ b/memcached-1.4.5-issue60.diff
@@ -0,0 +1,40 @@
+diff -rdBu memcached-1.4.0-rc1/memcached.h memcached-1.4.0-my/memcached.h
+--- memcached-1.4.0-rc1/memcached.h	2009-05-29 00:51:56.000000000 +0400
++++ memcached-1.4.0-my/memcached.h	2009-06-07 22:32:52.000000000 +0400
+@@ -75,21 +75,21 @@
+ 
+ /* warning: don't use these macros with a function, as it evals its arg twice */
+ #define ITEM_get_cas(i) ((uint64_t)(((i)->it_flags & ITEM_CAS) ? \
+-                                    *(uint64_t*)&((i)->end[0]) : 0x0))
++                                    *(uint64_t*)((char*)(i) + sizeof(*i)) : 0x0))
+ #define ITEM_set_cas(i,v) { if ((i)->it_flags & ITEM_CAS) { \
+-                          *(uint64_t*)&((i)->end[0]) = v; } }
++                          *(uint64_t*)((char*)(i) + sizeof(*i)) = v; } }
+ 
+-#define ITEM_key(item) (((char*)&((item)->end[0])) \
++#define ITEM_key(item) ((char*)(item) + sizeof(*item) \
+          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
+ 
+-#define ITEM_suffix(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
++#define ITEM_suffix(item) ((char*)(item) + sizeof(*item) + (item)->nkey + 1 \
+          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
+ 
+-#define ITEM_data(item) ((char*) &((item)->end[0]) + (item)->nkey + 1 \
++#define ITEM_data(item) ((char*)(item) + sizeof(*item) + (item)->nkey + 1 \
+          + (item)->nsuffix \
+          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
+ 
+-#define ITEM_ntotal(item) (sizeof(struct _stritem) + (item)->nkey + 1 \
++#define ITEM_ntotal(item) (sizeof(*item) + (item)->nkey + 1 \
+          + (item)->nsuffix + (item)->nbytes \
+          + (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) : 0))
+ 
+@@ -285,7 +285,6 @@
+     uint8_t         it_flags;   /* ITEM_* above */
+     uint8_t         slabs_clsid;/* which slab class we're in */
+     uint8_t         nkey;       /* key length, w/terminating null and padding */
+-    void * end[];
+     /* if it_flags & ITEM_CAS we have 8 bytes CAS */
+     /* then null-terminated key */
+     /* then " flags length\r\n" (no terminating null) */
+
diff --git a/memcached.spec b/memcached.spec
index 2fd9500..9a0c45e 100644
--- a/memcached.spec
+++ b/memcached.spec
@@ -3,7 +3,7 @@
 
 Name:           memcached
 Version:        1.4.5
-Release:        2%{?dist}
+Release:        3%{?dist}
 Epoch:		0
 Summary:        High Performance, Distributed Memory Object Cache
 
@@ -15,6 +15,10 @@ Source0:        http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
 # custom init script
 Source1:        memcached.sysv
 
+# Patches
+# From http://code.google.com/p/memcached/issues/detail?id=60
+Patch001: memcached-1.4.5-issue60.diff
+
 # Fixes
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -48,6 +52,7 @@ memcached binary include files.
 
 %prep
 %setup -q
+%patch001 -p1
 
 %build
 %configure
@@ -55,13 +60,16 @@ memcached binary include files.
 make %{?_smp_mflags}
 
 %check
+# whitespace tests fail locally on fedpkg systems now that they use git
+rm -f t/whitespace.t
+
 # Parts of the test suite only succeed as non-root.
 if [ `id -u` -ne 0 ]; then
   # remove failing test that doesn't work in
   # build systems
   rm -f t/daemonize.t 
-  make test
 fi
+make test
 
 %install
 rm -rf %{buildroot}
@@ -139,6 +147,9 @@ exit 0
 %{_includedir}/memcached/*
 
 %changelog
+* Wed Sep  8 2010 Paul Lindner <lindner at inuus.com> - 0:1.4.5-3
+- Apply patch from memcached issue #60, solves Bugzilla 631051
+
 * Wed May 26 2010 Joe Orton <jorton at redhat.com> - 0:1.4.5-2
 - LSB compliance fixes for init script
 - don't run the test suite as root


More information about the scm-commits mailing list