From: Kacper Kowalik Date: Thu, 27 Aug 2015 15:42:07 +0000 (-0500) Subject: Apply upstream patch fixing issue with go>=1.4. Fixes #558344 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ebf518399f1b302b738d6da9afa0351f4035384a;p=gentoo.git Apply upstream patch fixing issue with go>=1.4. Fixes #558344 Package-Manager: portage-2.2.20 --- diff --git a/app-emulation/docker/docker-1.8.1.ebuild b/app-emulation/docker/docker-1.8.1.ebuild index 0fea9a31ac7e..73cc01d8a979 100644 --- a/app-emulation/docker/docker-1.8.1.ebuild +++ b/app-emulation/docker/docker-1.8.1.ebuild @@ -20,7 +20,7 @@ else [ "$DOCKER_GITCOMMIT" ] || die "DOCKER_GITCOMMIT must be added manually for each bump!" inherit golang-vcs-snapshot fi -inherit bash-completion-r1 linux-info multilib systemd udev user +inherit eutils bash-completion-r1 linux-info multilib systemd udev user DESCRIPTION="Docker complements kernel namespacing with a high-level API which operates at the process level" HOMEPAGE="https://dockerproject.org" @@ -170,6 +170,7 @@ pkg_setup() { src_prepare() { cd "src/${EGO_PN}" || die + epatch "${FILESDIR}"/15404-fix-go14_15.patch # allow user patches (use sparingly - upstream won't support them) epatch_user } diff --git a/app-emulation/docker/files/15404-fix-go14_15.patch b/app-emulation/docker/files/15404-fix-go14_15.patch new file mode 100644 index 000000000000..7cda1f933c44 --- /dev/null +++ b/app-emulation/docker/files/15404-fix-go14_15.patch @@ -0,0 +1,85 @@ +From f83d05c3be3c3bcc84f6fa229504848ee8078321 Mon Sep 17 00:00:00 2001 +From: Vincent Batts +Date: Fri, 7 Aug 2015 10:18:20 -0400 +Subject: [PATCH] devicemapper: fix zero-sized field access + +Fixes: #15279 + +Due to +https://github.com/golang/go/commit/7904946eeb35faece61bbf6f5b3cc8be2f519c17 +the devices field is dropped. + +This solution works on go1.4 and go1.5 + +Signed-off-by: Vincent Batts +--- + daemon/graphdriver/devmapper/deviceset.go | 14 +++++++++----- + pkg/devicemapper/devmapper_wrapper.go | 18 +++++++++++++++--- + 2 files changed, 24 insertions(+), 8 deletions(-) + +diff --git a/daemon/graphdriver/devmapper/deviceset.go b/daemon/graphdriver/devmapper/deviceset.go +index 6dddeb1..97e2032 100644 +--- a/daemon/graphdriver/devmapper/deviceset.go ++++ b/daemon/graphdriver/devmapper/deviceset.go +@@ -1509,12 +1509,16 @@ func (devices *DeviceSet) deactivatePool() error { + if err != nil { + return err + } +- if d, err := devicemapper.GetDeps(devname); err == nil { +- // Access to more Debug output +- logrus.Debugf("[devmapper] devicemapper.GetDeps() %s: %#v", devname, d) ++ ++ if devinfo.Exists == 0 { ++ return nil + } +- if devinfo.Exists != 0 { +- return devicemapper.RemoveDevice(devname) ++ if err := devicemapper.RemoveDevice(devname); err != nil { ++ return err ++ } ++ ++ if d, err := devicemapper.GetDeps(devname); err == nil { ++ logrus.Warnf("[devmapper] device %s still has %d active dependents", devname, d.Count) + } + + return nil +diff --git a/pkg/devicemapper/devmapper_wrapper.go b/pkg/devicemapper/devmapper_wrapper.go +index 87c2003..44ca772 100644 +--- a/pkg/devicemapper/devmapper_wrapper.go ++++ b/pkg/devicemapper/devmapper_wrapper.go +@@ -38,7 +38,10 @@ static void log_with_errno_init() + */ + import "C" + +-import "unsafe" ++import ( ++ "reflect" ++ "unsafe" ++) + + type ( + CDmTask C.struct_dm_task +@@ -184,12 +187,21 @@ func dmTaskGetDepsFct(task *CDmTask) *Deps { + if Cdeps == nil { + return nil + } ++ ++ // golang issue: https://github.com/golang/go/issues/11925 ++ hdr := reflect.SliceHeader{ ++ Data: uintptr(unsafe.Pointer(uintptr(unsafe.Pointer(Cdeps)) + unsafe.Sizeof(*Cdeps))), ++ Len: int(Cdeps.count), ++ Cap: int(Cdeps.count), ++ } ++ devices := *(*[]C.uint64_t)(unsafe.Pointer(&hdr)) ++ + deps := &Deps{ + Count: uint32(Cdeps.count), + Filler: uint32(Cdeps.filler), + } +- for _, device := range Cdeps.device { +- deps.Device = append(deps.Device, (uint64)(device)) ++ for _, device := range devices { ++ deps.Device = append(deps.Device, uint64(device)) + } + return deps + }