X-Original-To: alpine-devel@lists.alpinelinux.org Delivered-To: alpine-devel@lists.alpinelinux.org Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by lists.alpinelinux.org (Postfix) with ESMTP id 3E3DC1EBFF6 for ; Mon, 4 Apr 2011 11:50:41 +0000 (UTC) Received: by iyj12 with SMTP id 12so7296374iyj.13 for ; Mon, 04 Apr 2011 04:50:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=0KZtplYVI+8QN92bVBBZ1O2a7wsP5QECy7bGDc+xsIg=; b=FCD4hcsFjMcLNI5OkixxDZbkSMU3cnAz/xvKknlSUUsEhaG8hnU6es1HgyyfPOraB3 lIzKUDfycuzVg/DykuV9ZwJ5V76izcs9jgyHzT8CXM4QyXXlK5tJehWnUrWlIEqjnQA9 ndF1YadLmHM/OtxX6cKGDsC46/pbOPKcwbQ0Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=bJV0YMf2C1XAWnfCAZXuoTOxTu6pnK1YpOOcTBZzzF7eYsnvIplVf/28kUFISUxQCJ zPMvSmW+/KciG/lXpoNWM0T4k3WmBLWWTe/rMKKJftV6poWRPT6874E8UcatFXJQ1wgv V5QOPIZc8hT9xhNHGOq37FT4aX1Yx3Af9etHQ= X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Received: by 10.231.116.139 with SMTP id m11mr7052209ibq.165.1301917839986; Mon, 04 Apr 2011 04:50:39 -0700 (PDT) Received: by 10.231.40.9 with HTTP; Mon, 4 Apr 2011 04:50:39 -0700 (PDT) In-Reply-To: <1301784767-15794-1-git-send-email-jbilyk@gmail.com> References: <1301784767-15794-1-git-send-email-jbilyk@gmail.com> Date: Mon, 4 Apr 2011 13:50:39 +0200 Message-ID: Subject: Re: [alpine-devel] [PATCH] testing/memcached: new aport From: Carlo Landmeter To: Jeff Bilyk Cc: alpine-devel@lists.alpinelinux.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Sun, Apr 3, 2011 at 12:52 AM, Jeff Bilyk wrote: > ref #549 > --- > =A0.../memcached/0001-fix-type-punning-issues.patch =A0 | =A0 73 ++++++++= ++++++++++++ > =A0testing/memcached/APKBUILD =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 | =A0 42 +++++++++++ > =A02 files changed, 115 insertions(+), 0 deletions(-) > =A0create mode 100644 testing/memcached/0001-fix-type-punning-issues.patc= h > =A0create mode 100644 testing/memcached/APKBUILD > > diff --git a/testing/memcached/0001-fix-type-punning-issues.patch b/testi= ng/memcached/0001-fix-type-punning-issues.patch > new file mode 100644 > index 0000000..60bb941 > --- /dev/null > +++ b/testing/memcached/0001-fix-type-punning-issues.patch > @@ -0,0 +1,73 @@ > +commit df15887584f0025e7b188e408dd3c9f638d68518 > +Author: Dan McGee > +Date: =A0 Tue Nov 2 18:43:00 2010 -0500 > + > + =A0 =A0Fix type-punning issues exposed with GCC 4.5.1 > + > + =A0 =A0The errors below are due to pointer magic that isn't allowed if = following C > + =A0 =A0strict-aliasing rules: > + > + =A0 =A0 =A0 =A0memcached.c: In function =91complete_incr_bin=92: > + =A0 =A0 =A0 =A0memcached.c:1023:16: error: dereferencing type-punned po= inter will break > + =A0 =A0 =A0 =A0strict-aliasing rules > + =A0 =A0 =A0 =A0memcached.c:1044:13: error: dereferencing type-punned po= inter will break > + =A0 =A0 =A0 =A0strict-aliasing rules > + =A0 =A0 =A0 =A0memcached.c:1061:17: error: dereferencing type-punned po= inter will break > + =A0 =A0 =A0 =A0strict-aliasing rules > + > + =A0 =A0Fix this by introducing a union type that allows access to the u= int64_t > + =A0 =A0member as necessary, but doesn't add any additional length to th= e structure. > + =A0 =A0The size remains the same before and after; the only difference = is explict > + =A0 =A0casts are now refactored into union member accesses and all comp= ilers should > + =A0 =A0be happy. > + > + =A0 =A0Signed-off-by: Dan McGee > + > +diff --git a/memcached.h b/memcached.h > +index 4a7295b..74a6592 100644 > +--- a/memcached.h > ++++ b/memcached.h > +@@ -77,18 +77,22 @@ > + #define TAIL_REPAIR_TIME (3 * 3600) > + > + /* 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) ? \ > +- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0*(uint64_t*)&((i)->end[0]) : 0x0)) > +-#define ITEM_set_cas(i,v) { if ((i)->it_flags & ITEM_CAS) { \ > +- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*(uint64_t*)&((i)->= end[0]) =3D v; } } > ++#define ITEM_get_cas(i) (((i)->it_flags & ITEM_CAS) ? \ > ++ =A0 =A0 =A0 =A0(i)->data->cas : (uint64_t)0) > + > +-#define ITEM_key(item) (((char*)&((item)->end[0])) \ > ++#define ITEM_set_cas(i,v) { \ > ++ =A0 =A0if ((i)->it_flags & ITEM_CAS) { \ > ++ =A0 =A0 =A0 =A0(i)->data->cas =3D v; \ > ++ =A0 =A0} \ > ++} > ++ > ++#define ITEM_key(item) (((char*)&((item)->data)) \ > + =A0 =A0 =A0 =A0 =A0+ (((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)->data) + (item)->nkey + 1 \ > + =A0 =A0 =A0 =A0 =A0+ (((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)->data) + (item)->nkey + 1 \ > + =A0 =A0 =A0 =A0 =A0+ (item)->nsuffix \ > + =A0 =A0 =A0 =A0 =A0+ (((item)->it_flags & ITEM_CAS) ? sizeof(uint64_t) = : 0)) > + > +@@ -302,7 +306,12 @@ typedef struct _stritem { > + =A0 =A0 uint8_t =A0 =A0 =A0 =A0 it_flags; =A0 /* ITEM_* above */ > + =A0 =A0 uint8_t =A0 =A0 =A0 =A0 slabs_clsid;/* which slab class we're i= n */ > + =A0 =A0 uint8_t =A0 =A0 =A0 =A0 nkey; =A0 =A0 =A0 /* key length, w/term= inating null and padding */ > +- =A0 =A0void * end[]; > ++ =A0 =A0/* this odd type prevents type-punning issues when we do > ++ =A0 =A0 * the little shuffle to save space when not using CAS. */ > ++ =A0 =A0union { > ++ =A0 =A0 =A0 =A0uint64_t cas; > ++ =A0 =A0 =A0 =A0char end; > ++ =A0 =A0} data[]; > + =A0 =A0 /* if it_flags & ITEM_CAS we have 8 bytes CAS */ > + =A0 =A0 /* then null-terminated key */ > + =A0 =A0 /* then " flags length\r\n" (no terminating null) */ > diff --git a/testing/memcached/APKBUILD b/testing/memcached/APKBUILD > new file mode 100644 > index 0000000..db0607a > --- /dev/null > +++ b/testing/memcached/APKBUILD > @@ -0,0 +1,42 @@ > +# Contributor: Jeff Bilyk > +# Maintainer: Natanael Copa > +pkgname=3Dmemcached > +pkgver=3D1.4.5 > +pkgrel=3D0 > +pkgdesc=3D"Distributed memory object caching system" > +url=3D"http://memcached.org" > +arch=3D"all" > +license=3D"GPL" > +depends=3D"perl" > +depends_dev=3D"libevent-dev" > +makedepends=3D"$depends_dev" > +install=3D"" > +subpackages=3D"$pkgname-dev $pkgname-doc" > +source=3D"http://memcached.googlecode.com/files/$pkgname-$pkgver.tar.gz > + =A0 =A0 =A0 0001-fix-type-punning-issues.patch" > + > +_builddir=3D"$srcdir/$pkgname-$pkgver" > + > +prepare() { > + =A0 =A0 =A0 local i > + =A0 =A0 =A0 cd "$_builddir" > + =A0 =A0 =A0 for i in $source; do > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 case $i in > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *.patch) msg $i; patch -p1 -i "$srcdir"/$i = || return 1;; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 esac > + =A0 =A0 =A0 done > +} > + > +build() { > + =A0 =A0 =A0 cd "$_builddir" > + =A0 =A0 =A0 ./configure --prefix=3D/usr > + =A0 =A0 =A0 make || return 1 > +} > + > +package() { > + =A0 =A0 =A0 cd "$_builddir" > + =A0 =A0 =A0 make DESTDIR=3D"$pkgdir" install || return 1 > +} > + > +md5sums=3D"583441a25f937360624024f2881e5ea8 =A0memcached-1.4.5.tar.gz > +c4f6da682cb4e7599fede4904021f4ae =A00001-fix-type-punning-issues.patch" > -- > 1.7.4.2 > > > > --- > Unsubscribe: =A0alpine-devel+unsubscribe@lists.alpinelinux.org > Help: =A0 =A0 =A0 =A0 alpine-devel+help@lists.alpinelinux.org > --- > > Pushed and added initd scripts from Gentoo. Please check if they work. --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---