Apply patch from memcached issue #60, solves Bugzilla 631051

This commit is contained in:
Paul Lindner 2010-09-08 14:56:24 -07:00
parent 860e14cc36
commit dacc6d4d19
2 changed files with 53 additions and 2 deletions

View File

@ -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) */

View File

@ -3,7 +3,7 @@
Name: memcached Name: memcached
Version: 1.4.5 Version: 1.4.5
Release: 2%{?dist} Release: 3%{?dist}
Epoch: 0 Epoch: 0
Summary: High Performance, Distributed Memory Object Cache Summary: High Performance, Distributed Memory Object Cache
@ -15,6 +15,10 @@ Source0: http://memcached.googlecode.com/files/%{name}-%{version}.tar.gz
# custom init script # custom init script
Source1: memcached.sysv Source1: memcached.sysv
# Patches
# From http://code.google.com/p/memcached/issues/detail?id=60
Patch001: memcached-1.4.5-issue60.diff
# Fixes # Fixes
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -48,6 +52,7 @@ memcached binary include files.
%prep %prep
%setup -q %setup -q
%patch001 -p1
%build %build
%configure %configure
@ -55,13 +60,16 @@ memcached binary include files.
make %{?_smp_mflags} make %{?_smp_mflags}
%check %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. # Parts of the test suite only succeed as non-root.
if [ `id -u` -ne 0 ]; then if [ `id -u` -ne 0 ]; then
# remove failing test that doesn't work in # remove failing test that doesn't work in
# build systems # build systems
rm -f t/daemonize.t rm -f t/daemonize.t
make test
fi fi
make test
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
@ -139,6 +147,9 @@ exit 0
%{_includedir}/memcached/* %{_includedir}/memcached/*
%changelog %changelog
* Wed Sep 8 2010 Paul Lindner <lindner@inuus.com> - 0:1.4.5-3
- Apply patch from memcached issue #60, solves Bugzilla 631051
* Wed May 26 2010 Joe Orton <jorton@redhat.com> - 0:1.4.5-2 * Wed May 26 2010 Joe Orton <jorton@redhat.com> - 0:1.4.5-2
- LSB compliance fixes for init script - LSB compliance fixes for init script
- don't run the test suite as root - don't run the test suite as root