Debian

Available patches from Ubuntu

To see Ubuntu differences wrt. to Debian, write down a grep-dctrl query identifying the packages you're interested in:
grep-dctrl -n -sPackage Sources.Debian
(e.g. -FPackage linux-ntfs or linux-ntfs)

Modified packages are listed below:

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: desktop-base

desktop-base (8.0.2ubuntu1) vivid; urgency=medium * Merge from Debian unstable. Remaining changes: - Makefile: Don't install grub/grub_background.sh, as it installs a Debian-branded background for GRUB. -- Logan Rosen <logan@ubuntu.com> Sun, 14 Dec 2014 00:57:24 -0500

Modifications :
  1. Download patch debian/control

    --- 8.0.2/debian/control 2014-12-13 19:40:14.000000000 +0000 +++ 8.0.2ubuntu1/debian/control 2014-12-14 05:53:47.000000000 +0000 @@ -1,7 +1,8 @@ Source: desktop-base Section: x11 Priority: optional -Maintainer: Gustavo Franco <stratus@debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Gustavo Franco <stratus@debian.org> Uploaders: Loïc Minier <lool@dooz.org>, Fathi Boudra <fabo@debian.org>, Yves-Alexis Perez <corsac@debian.org>,
  2. Download patch Makefile

    --- 8.0.2/Makefile 2014-12-13 19:44:10.000000000 +0000 +++ 8.0.2ubuntu1/Makefile 2014-12-14 05:54:09.000000000 +0000 @@ -115,7 +115,6 @@ install: $(INSTALL) grub/joy-grub.png $(DESTDIR)/usr/share/images/desktop-base/ $(INSTALL) grub/spacefun-grub.png $(DESTDIR)/usr/share/images/desktop-base/ $(INSTALL) grub/spacefun-grub-widescreen.png $(DESTDIR)/usr/share/images/desktop-base/ - $(INSTALL) grub/grub_background.sh $(DESTDIR)/usr/share/desktop-base/ # plymouth install -d $(DESTDIR)/usr/share/plymouth/themes/spacefun

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: docker.io

docker.io (1.13.1-0ubuntu4) artful; urgency=medium * d/tests/docker-in-lxd: Better handle DNS with systemd-resolved. -- Stéphane Graber <stgraber@ubuntu.com> Thu, 21 Sep 2017 01:12:33 -0400 docker.io (1.13.1-0ubuntu3) artful; urgency=medium * d/tests/docker-in-lxd: check for network-up has a race condition when systemd-resolved is used. Add an additional check for a real DNS server in systemd-resolve --status. -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 15 Sep 2017 23:32:16 -0700 docker.io (1.13.1-0ubuntu2) artful; urgency=medium * d/tests/docker-in-lxd: copy more apt config into container * d/golang-github-docker-docker-dev.install: install missing packages. (LP: #1714564) * d/control: Add Build-Depend on tzdata. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 04 Sep 2017 13:31:34 +1200 docker.io (1.13.1-0ubuntu1) artful; urgency=medium * Update to 1.13.1 upstream release - refresh patches (removing many that are applied upstream in 1.13+) - use dh_clean (via debian/clean) instead of explicit "rm" in rules - pull in explicit libnetwork sources for "docker-proxy" - drop unnecessary dh_golang usage (only used for Built-Using calculation) - update "upstream-version-gitcommits" with a more recent list of commits - add "tini" for building "docker-init" (used by "docker run --init") - prefer Go 1.7 explicitly if it's available -- Tianon Gravi <tianon@debian.org> Tue, 22 Aug 2017 09:30:24 -0700 docker.io (1.12.6-0ubuntu7) artful; urgency=medium * Make sure to set security.nesting for the LXD autopkgtest. -- Stéphane Graber <stgraber@ubuntu.com> Tue, 06 Jun 2017 14:55:34 -0600 docker.io (1.12.6-0ubuntu6) artful; urgency=medium * Fix FTBFS on Go 1.8. -- Stéphane Graber <stgraber@ubuntu.com> Mon, 05 Jun 2017 16:21:16 -0600 docker.io (1.12.6-0ubuntu5) artful; urgency=medium * Update LXD autopkgtest now that the "docker" profile is deprecated. -- Stéphane Graber <stgraber@ubuntu.com> Mon, 05 Jun 2017 15:59:18 -0600 docker.io (1.12.6-0ubuntu4) zesty; urgency=medium * Revert 1.12.6-0ubuntu2 as it does not achieve the stated goal on both s390x and armhf. And lxc/lxd adt runners are too restrictive to e.g. import an ubuntu-base container for a minimal functional test. -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 14 Mar 2017 09:41:30 +0000 docker.io (1.12.6-0ubuntu3) zesty; urgency=medium * debian/tests/docker-in-lxd: Fix a latent version comparison bug that was causing migration failures due to the script thinking it was dealing with an old LXD (< 2.2) when it was really dealing with a recent LXD (>= 2.10). The fix is to use `lxc info` to check if the network extension is supported, rather than trying to compare version strings. -- Tyler Hicks <tyhicks@canonical.com> Fri, 10 Mar 2017 17:40:22 +0000 docker.io (1.12.6-0ubuntu2) zesty; urgency=medium * Remove isolation-machine restriction from adt smoke-test testcase. Should pass on s390x lxd runners; will fails on armhf runners but that is not a regressions since previously all tests were simply skipped on armhf. LP: #1658150 -- Dimitri John Ledkov <xnox@ubuntu.com> Wed, 01 Feb 2017 10:08:00 +0000 docker.io (1.12.6-0ubuntu1) zesty; urgency=medium * Update to 1.12.6 upstream release (LP: #1655906) - add a few new privileged tests to "skip-privileged-unit-tests.patch" * Adjust runc Depends to ensure fix for CVE-2016-9962 is included -- Tianon Gravi <tianon@debian.org> Fri, 13 Jan 2017 11:57:24 +1300 docker.io (1.12.3-0ubuntu4) zesty; urgency=medium * Explicity depend on the version of runc that was built with seccomp support. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 12 Dec 2016 11:15:01 +1300 docker.io (1.12.3-0ubuntu3) zesty; urgency=medium [ Michael Hudson-Doyle ] * d/test/docker-in-lxd: make test for "is network up" more robust. [ Stefan Bader ] * Backport upstream 1.13 change to keep existing bridges untouched (LP: #1647376) - upstream-1.13-Vendor-libnetwork-51d88e9ae63f.patch -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Thu, 08 Dec 2016 11:53:36 +1300 docker.io (1.12.3-0ubuntu2) zesty; urgency=medium [ Tianon Gravi ] * Enable seccomp support (LP: #1639407) -- Steve Langasek <steve.langasek@ubuntu.com> Wed, 30 Nov 2016 12:34:22 -0800 docker.io (1.12.3-0ubuntu1) zesty; urgency=medium * Update to 1.12.3 upstream release - https://github.com/docker/docker/releases/tag/v1.12.2 - https://github.com/docker/docker/releases/tag/v1.12.3 -- Tianon Gravi <tianon@debian.org> Tue, 15 Nov 2016 15:50:32 -0800 docker.io (1.12.1-0ubuntu15) yakkety; urgency=medium * d/test/docker-in-lxd: use images:ubuntu/${suite}/${arch} instead of ubuntu-daily:${suite} because the former does not have cloud-init in it to rewrite /etc/apt/sources.list at unexpected times. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 10 Oct 2016 21:38:17 +1300 docker.io (1.12.1-0ubuntu14) yakkety; urgency=medium * d/test/docker-in-lxd: cope with changes in lxd 2.3. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 10 Oct 2016 15:30:42 +1300 docker.io (1.12.1-0ubuntu13) yakkety; urgency=medium * d/tests/docker-in-lxd: copy apt config from host to container rather than just enabling all of the -proposed pocket. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 27 Sep 2016 12:23:56 +1300 docker.io (1.12.1-0ubuntu12) yakkety; urgency=medium * Final(?) docker-in-lxd fix: of course, alpine:latest is only the name of the image on amd64. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 19 Sep 2016 20:34:59 +1200 docker.io (1.12.1-0ubuntu11) yakkety; urgency=medium * Even more docker-in-lxd fixes. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 19 Sep 2016 14:14:33 +1200 docker.io (1.12.1-0ubuntu10) yakkety; urgency=medium * Yet another docker-in-lxd fix. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 16 Sep 2016 19:02:41 +1200 docker.io (1.12.1-0ubuntu9) yakkety; urgency=medium * Proxy related fix for docker-in-lxd. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 16 Sep 2016 18:59:54 +1200 docker.io (1.12.1-0ubuntu8) yakkety; urgency=medium * Re-enable docker-in-lxd again after many fixes. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Fri, 16 Sep 2016 12:26:04 +1200 docker.io (1.12.1-0ubuntu7) yakkety; urgency=medium * d/tests/control: disable docker-in-lxd again, does not work in production infrastructure. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Thu, 08 Sep 2016 09:41:13 +1200 docker.io (1.12.1-0ubuntu6) yakkety; urgency=medium * d/tests/control: docker-in-lxd needs to depend on lxd-client as well. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 07 Sep 2016 21:18:18 +1200 docker.io (1.12.1-0ubuntu5) yakkety; urgency=medium * Ignore failure to set oom_score_adj, as happens in an unprivileged container. * Use $DOCKER_OPTS in service file again. * Add an autopkgtest to test docker-in-lxd. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 07 Sep 2016 15:36:50 +1200 docker.io (1.12.1-0ubuntu4) yakkety; urgency=medium * Fix service file. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 07 Sep 2016 14:13:12 +1200 docker.io (1.12.1-0ubuntu3) yakkety; urgency=medium * Skip "TestOverlay50LayerRead" on "overlay" driver too (in "skip-privileged-unit-tests.patch") -- Tianon Gravi <tianon@debian.org> Mon, 29 Aug 2016 16:00:00 -0700 docker.io (1.12.1-0ubuntu2) yakkety; urgency=medium * Add new "overlay2" driver's tests to "skip-privileged-unit-tests.patch" (FTBFS fix) -- Tianon Gravi <tianon@debian.org> Fri, 26 Aug 2016 10:20:24 -0700 docker.io (1.12.1-0ubuntu1) yakkety; urgency=medium * Update to 1.12.1 upstream release (LP: #1602243) - refresh "cgroupfs-mount-convenience-copy.patch" - remove "fatal-error-old-kernels.patch"; applied upstream, https://github.com/docker/docker/commit/51b23d88422918c24291f5876df35f91b23a446a - refresh "change-system-unit-env-file.patch" - refresh "21491--systemd-tasksmax.patch" - remove "22000--ignore-invalid-host-header.patch"; applied upstream, https://github.com/docker/docker/pull/22000 https://github.com/docker/docker/pull/22888 https://github.com/docker/docker/pull/23046 - refresh "remove-docker-prefix.patch" - refresh "skip-privileged-unit-tests.patch"; add new privileged tests, + TestMakeRemoteContext + TestMakeSumTarContext + TestDispatch + TestEmptyDockerfile + TestDockerfileOutsideTheBuildContext + TestRealodNoOpts - replace "lxd--20902--docker-in-userns.patch" with the upstream-applied "lxd--25672--docker-in-userns.patch" - remove "lxd--runc-617.patch"; no longer necessary (due to kernel fixes), https://github.com/opencontainers/runc/pull/617#issuecomment-223654149 - remove "21714--no-aufs-in-userns.patch"; applied upstream, https://github.com/docker/docker/pull/21714 - add "man" to "DH_GOLANG_EXCLUDES" (has new "generate.go" which imports the non-vendored "github.com/spf13/cobra/doc", causing dh_golang to choke) - add "docker-proxy-vendor.patch" to account for "vendor/..." vs "vendor/src/..." - install new explicit "dockerd" and "docker-proxy" binaries - update containerd dependency (>= 0.2.3) - update runc dependency (>= 1.0.0-rc1) * Update "debian/watch" to use "uscan.tianon.xyz" so older versions are still easily fetchable without excess work outside uscan -- Tianon Gravi <tianon@debian.org> Wed, 24 Aug 2016 11:48:34 -0700 docker.io (1.11.2-0ubuntu6) yakkety; urgency=medium * Merge from Debian Unstable: - more README.Debian notes (including a fixed href) - new "docker-doc" package which contains the documentation - use "dh-golang" for building (generates appropriate Built-Using) - run upstream unit tests during dh_auto_test - convert upstream-discouraged "/etc/default/docker" to comments-only - utilize dh_install (w/dh-exec) more fully to simplify debian/rules - fix "/etc/docker" permissions for co-existence with docker-registry - remove "/var/lib/docker" on purge * Remaining Ubuntu delta: - non-pruned vendor/ (included in golang-github-docker-docker-dev) - Docker-in-userns patches * Changes from pending Debian upload: - build from within GOPATH so Go packages are resolved properly - split "dh_auto_build-arch" from "dh_auto_build-indep" - include vendor/ in golang-github-docker-docker-dev (since we don't necessarily have the appropriate packages for Depends on that package) -- Tianon Gravi <tianon@debian.org> Fri, 19 Aug 2016 10:15:14 -0700

Modifications :
  1. Download patch integration-cli/docker_cli_daemon_test.go

    --- 1.13.1~ds1-2/integration-cli/docker_cli_daemon_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 1.13.1-0ubuntu4/integration-cli/docker_cli_daemon_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -2537,7 +2537,7 @@ func (s *DockerDaemonSuite) TestRunWithR { "runtimes": { "oci": { - "path": "docker-runc" + "path": "runc" }, "vm": { "path": "/usr/local/bin/vm-manager", @@ -2619,7 +2619,7 @@ func (s *DockerDaemonSuite) TestRunWithR "default-runtime": "vm", "runtimes": { "oci": { - "path": "docker-runc" + "path": "runc" }, "vm": { "path": "/usr/local/bin/vm-manager", @@ -2645,7 +2645,7 @@ func (s *DockerDaemonSuite) TestRunWithR } func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) { - err := s.d.StartWithBusybox("--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") + err := s.d.StartWithBusybox("--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") c.Assert(err, check.IsNil) // Run with default runtime @@ -2694,7 +2694,7 @@ func (s *DockerDaemonSuite) TestRunWithR // Check that we can select a default runtime s.d.Stop() - err = s.d.StartWithBusybox("--default-runtime=vm", "--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") + err = s.d.StartWithBusybox("--default-runtime=vm", "--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") c.Assert(err, check.IsNil) out, err = s.d.Cmd("run", "--rm", "busybox", "ls")
  2. Download patch debian/docker.io.NEWS

    --- 1.13.1~ds1-2/debian/docker.io.NEWS 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/docker.io.NEWS 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -docker.io (1.11.2~ds1-1) unstable; urgency=medium - - As of src:linux 4.0+ (specifically, >= 3.18-1~exp1), AUFS support is no longer - included in official Debian-compiled kernels. What this means to Docker users - is that if your existing images are stored within the "AUFS" graph driver that - once you update your kernel, your images (and containers) will become - inaccessible (due to the kernel not having the necessary aufs modules to mount - them). To recover from this, there are a couple options (detailed below). - - 1. Use the included nuke script to blow away your existing "/var/lib/docker" - contents and start fresh with Linux 4.0+: - - service docker stop - /usr/share/docker.io/contrib/nuke-graph-directory.sh /var/lib/docker - service docker start - - 2. Use "docker save" (see "docker help save" for usage) before booting 4.0+ to - preserve your images on-disk as tar files, then follow the nuke step from - the previous option followed by using "docker load" to re-load your images. - - 3. Update to src:linux >= 4.1.1-1~exp1 ("aufs: Apply patches to enable - building aufs out-of-tree"), and then compile the aufs modules out-of-tree - (a package for doing this module compilation automatically doesn't yet - exist at the time of this writing, but might in the future). - - -- Tianon Gravi <tianon@debian.org> Tue, 01 Dec 2015 01:02:44 -0800
  3. Download patch libnetwork/client/client_service_test.go

    --- 1.13.1~ds1-2/libnetwork/client/client_service_test.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/client/client_service_test.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,122 @@ +package client + +import ( + "bytes" + "testing" + + _ "github.com/docker/libnetwork/testutils" +) + +func TestClientServiceInvalidCommand(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "invalid") + if err == nil { + t.Fatalf("Passing invalid commands must fail") + } +} + +func TestClientServiceCreate(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "publish", mockServiceName+"."+mockNwName) + if err != nil { + t.Fatal(err) + } +} + +func TestClientServiceRm(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "unpublish", mockServiceName+"."+mockNwName) + if err != nil { + t.Fatal(err) + } +} + +func TestClientServiceLs(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "ls") + if err != nil { + t.Fatal(err) + } +} + +func TestClientServiceInfo(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "info", mockServiceName+"."+mockNwName) + if err != nil { + t.Fatal(err) + } +} + +func TestClientServiceInfoById(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "info", mockServiceID+"."+mockNwName) + if err != nil { + t.Fatal(err) + } +} + +func TestClientServiceJoin(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "attach", mockContainerID, mockServiceName+"."+mockNwName) + if err != nil { + t.Fatal(err) + } +} + +func TestClientServiceLeave(t *testing.T) { + var out, errOut bytes.Buffer + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "service", "detach", mockContainerID, mockServiceName+"."+mockNwName) + if err != nil { + t.Fatal(err) + } +} + +// Docker Flag processing in flag.go uses os.Exit() frequently, even for --help +// TODO : Handle the --help test-case in the IT when CLI is available +/* +func TestClientNetworkServiceCreateHelp(t *testing.T) { + var out, errOut bytes.Buffer + cFunc := func(method, path string, data interface{}, headers map[string][]string) (io.ReadCloser, int, error) { + return nil, 0, nil + } + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "network", "create", "--help") + if err != nil { + t.Fatalf(err.Error()) + } +} +*/ + +// Docker flag processing in flag.go uses os.Exit(1) for incorrect parameter case. +// TODO : Handle the missing argument case in the IT when CLI is available +/* +func TestClientNetworkServiceCreateMissingArgument(t *testing.T) { + var out, errOut bytes.Buffer + cFunc := func(method, path string, data interface{}, headers map[string][]string) (io.ReadCloser, int, error) { + return nil, 0, nil + } + cli := NewNetworkCli(&out, &errOut, callbackFunc) + + err := cli.Cmd("docker", "network", "create") + if err != nil { + t.Fatal(err.Error()) + } +} +*/
  4. Download patch debian/helpers/gen-build-depends.sh

    --- 1.13.1~ds1-2/debian/helpers/gen-build-depends.sh 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/helpers/gen-build-depends.sh 2017-01-12 22:50:50.000000000 +0000 @@ -163,9 +163,6 @@ declare -A transitionals=( [golang-github-syndtr-gocapability-dev]='golang-gocapability-dev' [golang-github-ugorji-go-dev]='golang-github-ugorji-go-codec-dev' [golang-gopkg-fsnotify.v1-dev]='golang-github-fsnotify-fsnotify-dev' - - # golang-golang-x-oauth2 version 0.0~git20161103.0.36bc617-2 introduced a separate google/ package - [golang-golang-x-oauth2-dev]='golang-golang-x-oauth2-google-dev' ) for goDep in "${goDeps[@]}"; do
  5. Download patch libnetwork/cluster/provider.go

    --- 1.13.1~ds1-2/libnetwork/cluster/provider.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cluster/provider.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,21 @@ +package cluster + +import ( + "github.com/docker/docker/api/types/network" + "golang.org/x/net/context" +) + +// Provider provides clustering config details +type Provider interface { + IsManager() bool + IsAgent() bool + GetLocalAddress() string + GetListenAddress() string + GetAdvertiseAddress() string + GetRemoteAddress() string + ListenClusterEvents() <-chan struct{} + AttachNetwork(string, string, []string) (*network.NetworkingConfig, error) + DetachNetwork(string, string) error + UpdateAttachment(string, string, *network.NetworkingConfig) error + WaitForDetachment(context.Context, string, string, string, string) error +}
  6. Download patch debian/patches/golang-google-api.patch

    --- 1.13.1~ds1-2/debian/patches/golang-google-api.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/golang-google-api.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -Index: docker.io/daemon/logger/gcplogs/gcplogging.go -=================================================================== ---- docker.io.orig/daemon/logger/gcplogs/gcplogging.go -+++ docker.io/daemon/logger/gcplogs/gcplogging.go -@@ -51,7 +51,7 @@ func init() { - } - - type gcplogs struct { -- client *logging.Client -+ logger *logging.Logger - instance *instanceInfo - container *containerInfo - } -@@ -114,17 +114,19 @@ func New(ctx logger.Context) (logger.Log - return nil, fmt.Errorf("No project was specified and couldn't read project from the meatadata server. Please specify a project") - } - -- c, err := logging.NewClient(context.Background(), project, "gcplogs-docker-driver") -+ c, err := logging.NewClient(context.Background(), project) - if err != nil { - return nil, err - } - -- if err := c.Ping(); err != nil { -+ lg := c.Logger("gcplogs-docker-driver") -+ -+ if err := c.Ping(context.Background()); err != nil { - return nil, fmt.Errorf("unable to connect or authenticate with Google Cloud Logging: %v", err) - } - - l := &gcplogs{ -- client: c, -+ logger: lg, - container: &containerInfo{ - Name: ctx.ContainerName, - ID: ctx.ContainerID, -@@ -157,11 +159,14 @@ func New(ctx logger.Context) (logger.Log - // overflow func is called. We want to surface the error to the user - // without overly spamming /var/log/docker.log so we log the first time - // we overflow and every 1000th time after. -- c.Overflow = func(_ *logging.Client, _ logging.Entry) error { -- if i := atomic.AddUint64(&droppedLogs, 1); i%1000 == 1 { -- logrus.Errorf("gcplogs driver has dropped %v logs", i) -- } -- return nil -+ c.OnError = func(err error) { -+ if err == logging.ErrOverflow { -+ if i := atomic.AddUint64(&droppedLogs, 1); i%1000 == 1 { -+ logrus.Errorf("gcplogs driver has dropped %v logs", i) -+ } -+ } else { -+ logrus.Error(err) -+ } - } - - return l, nil -@@ -181,18 +186,20 @@ func ValidateLogOpts(cfg map[string]stri - } - - func (l *gcplogs) Log(m *logger.Message) error { -- return l.client.Log(logging.Entry{ -- Time: m.Timestamp, -+ l.logger.Log(logging.Entry{ -+ Timestamp: m.Timestamp, - Payload: &dockerLogEntry{ - Instance: l.instance, - Container: l.container, - Data: string(m.Line), - }, - }) -+ return nil - } - - func (l *gcplogs) Close() error { -- return l.client.Flush() -+ l.logger.Flush() -+ return nil - } - - func (l *gcplogs) Name() string {
  7. Download patch libnetwork/client/mflag/flag_test.go
  8. Download patch libnetwork/agent.proto

    --- 1.13.1~ds1-2/libnetwork/agent.proto 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/agent.proto 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,72 @@ +syntax = "proto3"; + +import "gogoproto/gogo.proto"; + +package libnetwork; + +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; +option (gogoproto.stringer_all) = true; +option (gogoproto.gostring_all) = true; +option (gogoproto.sizer_all) = true; +option (gogoproto.goproto_stringer_all) = false; + +// EndpointRecord specifies all the endpoint specific information that +// needs to gossiped to nodes participating in the network. +message EndpointRecord { + // Name of the endpoint + string name = 1; + + // Service name of the service to which this endpoint belongs. + string service_name = 2; + + // Service ID of the service to which this endpoint belongs. + string service_id = 3 [(gogoproto.customname) = "ServiceID"]; + + // Virtual IP of the service to which this endpoint belongs. + string virtual_ip = 4 [(gogoproto.customname) = "VirtualIP"]; + + // IP assigned to this endpoint. + string endpoint_ip = 5 [(gogoproto.customname) = "EndpointIP"]; + + // IngressPorts exposed by the service to which this endpoint belongs. + repeated PortConfig ingress_ports = 6; + + // A list of aliases which are alternate names for the service + repeated string aliases = 7; + + // List of aliases task specific aliases + repeated string task_aliases = 8; +} + +// PortConfig specifies an exposed port which can be +// addressed using the given name. This can be later queried +// using a service discovery api or a DNS SRV query. The node +// port specifies a port that can be used to address this +// service external to the cluster by sending a connection +// request to this port to any node on the cluster. +message PortConfig { + enum Protocol { + option (gogoproto.goproto_enum_prefix) = false; + + TCP = 0 [(gogoproto.enumvalue_customname) = "ProtocolTCP"]; + UDP = 1 [(gogoproto.enumvalue_customname) = "ProtocolUDP"]; + } + + // Name for the port. If provided the port information can + // be queried using the name as in a DNS SRV query. + string name = 1; + + // Protocol for the port which is exposed. + Protocol protocol = 2; + + // The port which the application is exposing and is bound to. + uint32 target_port = 3; + + // PublishedPort specifies the port on which the service is + // exposed on all nodes on the cluster. If not specified an + // arbitrary port in the node port range is allocated by the + // system. If specified it should be within the node port + // range and it should be available. + uint32 published_port = 4; +}
  9. Download patch debian/tests/control

    --- 1.13.1~ds1-2/debian/tests/control 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/tests/control 2017-08-27 21:19:02.000000000 +0000 @@ -2,6 +2,10 @@ Tests: basic-smoke Depends: aufs-tools, debian-archive-keyring, debootstrap, @ Restrictions: allow-stderr isolation-machine needs-root +Tests: docker-in-lxd +Depends: lxd, lxd-client, dctrl-tools +Restrictions: allow-stderr isolation-machine needs-root + #Tests: integration #Depends: ca-certificates, curl, git, golang-check.v1-dev, jq, @, @builddeps@ #Restrictions: allow-stderr isolation-machine needs-root rw-build-tree
  10. Download patch libnetwork/client/network.go
  11. Download patch debian/patches/coreos-go-systemd.patch

    --- 1.13.1~ds1-2/debian/patches/coreos-go-systemd.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/coreos-go-systemd.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -Index: docker.io/cmd/dockerd/daemon_linux.go -=================================================================== ---- docker.io.orig/cmd/dockerd/daemon_linux.go -+++ docker.io/cmd/dockerd/daemon_linux.go -@@ -7,5 +7,5 @@ import systemdDaemon "github.com/coreos/ - // notifySystem sends a message to the host when the server is ready to be used - func notifySystem() { - // Tell the init daemon we are accepting requests -- go systemdDaemon.SdNotify("READY=1") -+ go systemdDaemon.SdNotify(false, "READY=1") - }
  12. Download patch libnetwork/cmd/dnet/flags.go

    --- 1.13.1~ds1-2/libnetwork/cmd/dnet/flags.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/dnet/flags.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,87 @@ +package main + +import ( + "fmt" + "os" + + "github.com/Sirupsen/logrus" + "github.com/codegangsta/cli" +) + +var ( + dnetFlags = []cli.Flag{ + cli.BoolFlag{ + Name: "d, -daemon", + Usage: "Enable daemon mode", + }, + cli.StringFlag{ + Name: "H, -host", + Value: "", + Usage: "Daemon socket to connect to", + }, + cli.StringFlag{ + Name: "l, -log-level", + Value: "info", + Usage: "Set the logging level", + }, + cli.BoolFlag{ + Name: "D, -debug", + Usage: "Enable debug mode", + }, + cli.StringFlag{ + Name: "c, -cfg-file", + Value: "/etc/default/libnetwork.toml", + Usage: "Configuration file", + }, + } +) + +func processFlags(c *cli.Context) error { + var err error + + if c.String("l") != "" { + lvl, err := logrus.ParseLevel(c.String("l")) + if err != nil { + fmt.Printf("Unable to parse logging level: %s\n", c.String("l")) + os.Exit(1) + } + logrus.SetLevel(lvl) + } else { + logrus.SetLevel(logrus.InfoLevel) + } + + if c.Bool("D") { + logrus.SetLevel(logrus.DebugLevel) + } + + hostFlag := c.String("H") + if hostFlag == "" { + defaultHost := os.Getenv("DNET_HOST") + if defaultHost == "" { + // TODO : Add UDS support + defaultHost = fmt.Sprintf("tcp://%s:%d", DefaultHTTPHost, DefaultHTTPPort) + } + hostFlag = defaultHost + } + + epConn, err = newDnetConnection(hostFlag) + if err != nil { + if c.Bool("d") { + logrus.Error(err) + } else { + fmt.Println(err) + } + os.Exit(1) + } + + if c.Bool("d") { + err = epConn.dnetDaemon(c.String("c")) + if err != nil { + logrus.Errorf("dnet Daemon exited with an error : %v", err) + os.Exit(1) + } + os.Exit(1) + } + + return nil +}
  13. Download patch daemon/daemon_test.go

    --- 1.13.1~ds1-2/daemon/daemon_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/daemon_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -158,7 +158,10 @@ func TestValidContainerNames(t *testing. } func TestContainerInitDNS(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + tmp, err := ioutil.TempDir("", "docker-container-test-") if err != nil { t.Fatal(err)
  14. Download patch contrib/init/systemd/docker.service

    --- 1.13.1~ds1-2/contrib/init/systemd/docker.service 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/contrib/init/systemd/docker.service 2017-09-21 09:40:39.000000000 +0000 @@ -10,7 +10,7 @@ Type=notify # exists and systemd currently does not support the cgroup feature set required # for containers run by docker EnvironmentFile=-/etc/default/docker -ExecStart=/usr/sbin/dockerd -H fd:// $DOCKER_OPTS +ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=1048576 # Having non-zero Limit*s causes performance problems due to accounting overhead
  15. Download patch contrib/init/upstart/docker.conf

    --- 1.13.1~ds1-2/contrib/init/upstart/docker.conf 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/contrib/init/upstart/docker.conf 2017-09-21 09:40:39.000000000 +0000 @@ -11,11 +11,18 @@ limit nproc unlimited unlimited respawn +pre-start script + # Cleanup any stale mounts left from previous shutdown + # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 + grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ + xargs -r umount || true +end script + kill timeout 20 script # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) - DOCKERD=/usr/sbin/dockerd + DOCKERD=/usr/bin/dockerd DOCKER_OPTS= if [ -f /etc/default/$UPSTART_JOB ]; then . /etc/default/$UPSTART_JOB
  16. Download patch debian/rules

    --- 1.13.1~ds1-2/debian/rules 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/rules 2017-08-25 00:40:51.000000000 +0000 @@ -5,6 +5,7 @@ export DH_GOPKG := github.com/docker/doc export DH_GOLANG_INSTALL_ALL := 1 export DH_GOLANG_EXCLUDES := \ integration-cli \ + man \ vendor # temporary build path (see http://golang.org/doc/code.html#GOPATH) @@ -22,13 +23,13 @@ export KEEPBUNDLE := 1 # AppArmor can be optionally used in Debian and is there by default in Ubuntu, so we need support for it compiled into our binary # same story with SELinux -export DOCKER_BUILDTAGS := apparmor selinux +export DOCKER_BUILDTAGS := apparmor seccomp selinux # since "gccgo" doesn't ship the "dist" go tool (and isn't likely to start), let's use that for now to detect gc vs gccgo export DOCKER_BUILD_TARGET := $(shell go tool dist env > /dev/null 2>&1 && echo dynbinary || echo dyngccgo) -# prefer Go 1.6 explicitly if it's available (golang-1.6-go) -export PATH := /usr/lib/go-1.6/bin:$(PATH) +# prefer Go 1.7 explicitly if it's available (golang-1.7-go) +export PATH := /usr/lib/go-1.7/bin:$(PATH) APPARMOR_RECOMMENDS := $(shell dpkg-vendor --is Ubuntu && echo apparmor) @@ -41,25 +42,13 @@ override_dh_gencontrol: override_dh_auto_configure: - dh_auto_configure - -ifneq (, $(wildcard $(CURDIR)/vendor/src)) - # prefer vendored deps (when they exist) - rm -rf '$(OUR_GOPATH)/src/$(DH_GOPKG)/vendor' \ - && mkdir '$(OUR_GOPATH)/src/$(DH_GOPKG)/vendor' \ - && cd vendor/src \ - && cp -r . '$(OUR_GOPATH)/src/$(DH_GOPKG)/vendor' -endif - - # make sure the bits modified at build-time are properly in our GOPATH - mkdir -p '$(OUR_GOPATH)/src/$(DH_GOPKG)' - # dockerversion - rm -rf '$(OUR_GOPATH)/src/$(DH_GOPKG)/dockerversion' - ln -sfT '$(CURDIR)/dockerversion' '$(OUR_GOPATH)/src/$(DH_GOPKG)/dockerversion' - # bundles - mkdir -p bundles - rm -rf '$(OUR_GOPATH)/src/$(DH_GOPKG)/bundles' - ln -sfT '$(CURDIR)/bundles' '$(OUR_GOPATH)/src/$(DH_GOPKG)/bundles' + # set up GOPATH symlink farm + # libnetwork + mkdir -p '$(OUR_GOPATH)/src/github.com/docker' + ln -sfT '$(CURDIR)/libnetwork' '$(OUR_GOPATH)/src/github.com/docker/libnetwork' + # docker + mkdir -p '$(OUR_GOPATH)/src/github.com/docker' + ln -sfT '$(CURDIR)' '$(OUR_GOPATH)/src/github.com/docker/docker' override_dh_auto_build-indep: # noop @@ -73,14 +62,23 @@ override_dh_auto_build-arch: # compile man pages ./man/md2man-all.sh -q + + # compile docker-proxy (from libnetwork) + go build -o libnetwork/docker-proxy github.com/docker/libnetwork/cmd/proxy + + # compile docker-init (tini) + cd tini \ + && cmake . \ + && make tini-static override_dh_install: ## Do not install extra license files: dh_install -XLICENSE + override_dh_auto_install: - # skip dh_auto_install to stop dh_golang trying to copy bits for /usr/share/gocode (we use dh_install/dh-exec for that) + # we use dh_install / dh-exec for installing files where they need to be override_dh_auto_test: @@ -106,13 +104,7 @@ override_dh_auto_clean: # OUR_GOPATH is created by us rm -rf '$(OUR_GOPATH)' - - # autogen is created by hack/make.sh - # bundles is created by hack/make.sh - # dockerversion/version_autogen.go is created by hack/make.sh - # man/man*/ is created by man/md2man-all.sh - rm -rf autogen bundles dockerversion/version_autogen.go man/man*/ %: - dh $@ --buildsystem=golang --with=systemd,bash-completion,golang --builddirectory='$(OUR_GOPATH)' + dh $@ --with=systemd,bash-completion
  17. Download patch libnetwork/client/mflag/example/example.go

    --- 1.13.1~ds1-2/libnetwork/client/mflag/example/example.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/client/mflag/example/example.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,36 @@ +package main + +import ( + "fmt" + + flag "github.com/docker/libnetwork/client/mflag" +) + +var ( + i int + str string + b, b2, h bool +) + +func init() { + flag.Bool([]string{"#hp", "#-halp"}, false, "display the halp") + flag.BoolVar(&b, []string{"b", "#bal", "#bol", "-bal"}, false, "a simple bool") + flag.BoolVar(&b, []string{"g", "#gil"}, false, "a simple bool") + flag.BoolVar(&b2, []string{"#-bool"}, false, "a simple bool") + flag.IntVar(&i, []string{"-integer", "-number"}, -1, "a simple integer") + flag.StringVar(&str, []string{"s", "#hidden", "-string"}, "", "a simple string") //-s -hidden and --string will work, but -hidden won't be in the usage + flag.BoolVar(&h, []string{"h", "#help", "-help"}, false, "display the help") + flag.StringVar(&str, []string{"mode"}, "mode1", "set the mode\nmode1: use the mode1\nmode2: use the mode2\nmode3: use the mode3") + flag.Parse() +} +func main() { + if h { + flag.PrintDefaults() + } else { + fmt.Printf("s/#hidden/-string: %s\n", str) + fmt.Printf("b: %t\n", b) + fmt.Printf("-bool: %t\n", b2) + fmt.Printf("s/#hidden/-string(via lookup): %s\n", flag.Lookup("s").Value.String()) + fmt.Printf("ARGS: %v\n", flag.Args()) + } +}
  18. Download patch libnetwork/client/types.go

    --- 1.13.1~ds1-2/libnetwork/client/types.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/client/types.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,96 @@ +package client + +import "github.com/docker/libnetwork/types" + +/*********** + Resources +************/ + +// networkResource is the body of the "get network" http response message +type networkResource struct { + Name string `json:"name"` + ID string `json:"id"` + Type string `json:"type"` + Services []*serviceResource `json:"services"` +} + +// serviceResource is the body of the "get service" http response message +type serviceResource struct { + Name string `json:"name"` + ID string `json:"id"` + Network string `json:"network"` +} + +// SandboxResource is the body of "get service backend" response message +type SandboxResource struct { + ID string `json:"id"` + Key string `json:"key"` + ContainerID string `json:"container_id"` +} + +/*********** + Body types + ************/ +type ipamConf struct { + PreferredPool string + SubPool string + Gateway string + AuxAddresses map[string]string +} + +// networkCreate is the expected body of the "create network" http request message +type networkCreate struct { + Name string `json:"name"` + ID string `json:"id"` + NetworkType string `json:"network_type"` + IPv4Conf []ipamConf `json:"ipv4_configuration"` + DriverOpts map[string]string `json:"driver_opts"` + NetworkOpts map[string]string `json:"network_opts"` +} + +// serviceCreate represents the body of the "publish service" http request message +type serviceCreate struct { + Name string `json:"name"` + MyAliases []string `json:"my_aliases"` + Network string `json:"network_name"` +} + +// serviceDelete represents the body of the "unpublish service" http request message +type serviceDelete struct { + Name string `json:"name"` + Force bool `json:"force"` +} + +// serviceAttach represents the expected body of the "attach/detach sandbox to/from service" http request messages +type serviceAttach struct { + SandboxID string `json:"sandbox_id"` + Aliases []string `json:"aliases"` +} + +// SandboxCreate is the body of the "post /sandboxes" http request message +type SandboxCreate struct { + ContainerID string `json:"container_id"` + HostName string `json:"host_name"` + DomainName string `json:"domain_name"` + HostsPath string `json:"hosts_path"` + ResolvConfPath string `json:"resolv_conf_path"` + DNS []string `json:"dns"` + ExtraHosts []extraHost `json:"extra_hosts"` + UseDefaultSandbox bool `json:"use_default_sandbox"` + ExposedPorts []types.TransportPort `json:"exposed_ports"` + PortMapping []types.PortBinding `json:"port_mapping"` +} + +// extraHost represents the extra host object +type extraHost struct { + Name string `json:"name"` + Address string `json:"address"` +} + +// sandboxParentUpdate is the object carrying the information about the +// sandbox parent that needs to be updated. +type sandboxParentUpdate struct { + ContainerID string `json:"container_id"` + Name string `json:"name"` + Address string `json:"address"` +}
  19. Download patch libnetwork/client/client.go

    --- 1.13.1~ds1-2/libnetwork/client/client.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/client/client.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,115 @@ +package client + +import ( + "fmt" + "io" + "io/ioutil" + "net/http" + "reflect" + "strings" + + flag "github.com/docker/libnetwork/client/mflag" +) + +// CallFunc provides environment specific call utility to invoke backend functions from UI +type CallFunc func(string, string, interface{}, map[string][]string) (io.ReadCloser, http.Header, int, error) + +// NetworkCli is the UI object for network subcmds +type NetworkCli struct { + out io.Writer + err io.Writer + call CallFunc +} + +// NewNetworkCli is a convenient function to create a NetworkCli object +func NewNetworkCli(out, err io.Writer, call CallFunc) *NetworkCli { + return &NetworkCli{ + out: out, + err: err, + call: call, + } +} + +// getMethod is Borrowed from Docker UI which uses reflection to identify the UI Handler +func (cli *NetworkCli) getMethod(args ...string) (func(string, ...string) error, bool) { + camelArgs := make([]string, len(args)) + for i, s := range args { + if len(s) == 0 { + return nil, false + } + camelArgs[i] = strings.ToUpper(s[:1]) + strings.ToLower(s[1:]) + } + methodName := "Cmd" + strings.Join(camelArgs, "") + method := reflect.ValueOf(cli).MethodByName(methodName) + if !method.IsValid() { + return nil, false + } + return method.Interface().(func(string, ...string) error), true +} + +// Cmd is borrowed from Docker UI and acts as the entry point for network UI commands. +// network UI commands are designed to be invoked from multiple parent chains +func (cli *NetworkCli) Cmd(chain string, args ...string) error { + if len(args) > 2 { + method, exists := cli.getMethod(args[:3]...) + if exists { + return method(chain+" "+args[0]+" "+args[1], args[3:]...) + } + } + if len(args) > 1 { + method, exists := cli.getMethod(args[:2]...) + if exists { + return method(chain+" "+args[0], args[2:]...) + } + } + if len(args) > 0 { + method, exists := cli.getMethod(args[0]) + if !exists { + return fmt.Errorf("%s: '%s' is not a %s command. See '%s --help'.\n", chain, args[0], chain, chain) + } + return method(chain, args[1:]...) + } + flag.Usage() + return nil +} + +// Subcmd is borrowed from Docker UI and performs the same function of configuring the subCmds +func (cli *NetworkCli) Subcmd(chain, name, signature, description string, exitOnError bool) *flag.FlagSet { + var errorHandling flag.ErrorHandling + if exitOnError { + errorHandling = flag.ExitOnError + } else { + errorHandling = flag.ContinueOnError + } + flags := flag.NewFlagSet(name, errorHandling) + flags.Usage = func() { + flags.ShortUsage() + flags.PrintDefaults() + } + flags.ShortUsage = func() { + options := "" + if signature != "" { + signature = " " + signature + } + if flags.FlagCountUndeprecated() > 0 { + options = " [OPTIONS]" + } + fmt.Fprintf(cli.out, "\nUsage: %s %s%s%s\n\n%s\n\n", chain, name, options, signature, description) + flags.SetOutput(cli.out) + } + return flags +} + +func readBody(stream io.ReadCloser, hdr http.Header, statusCode int, err error) ([]byte, int, error) { + if stream != nil { + defer stream.Close() + } + if err != nil { + return nil, statusCode, err + } + body, err := ioutil.ReadAll(stream) + if err != nil { + return nil, -1, err + } + return body, statusCode, nil +}
  20. Download patch libnetwork/agent.go
  21. Download patch debian/upstream-version-gitcommits

    --- 1.13.1~ds1-2/debian/upstream-version-gitcommits 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/upstream-version-gitcommits 2017-08-25 00:40:51.000000000 +0000 @@ -1,6 +1,6 @@ # To determine the proper value for this, download -# https://get.docker.io/builds/Linux/x86_64/docker-VERSION, chmod +x, and then -# run ./docker-VERSION -v, which will list the exact build hash needed. +# https://download.docker.com/linux/static/CHANNEL/x86_64/docker-VERSION-ce.tgz +# extract "docker", run "./docker -v", which will list the exact build hash needed. 0.5.3: 17c92b8 0.6.0: f4a4f1c @@ -124,5 +124,35 @@ 1.13.0-rc4: 88862e7 1.13.0-rc5: 43cc971 1.13.0-rc6: 2f2d055 +1.13.0-rc7: 48a9e53 1.13.0: 49bf474 +1.13.1-rc1: 2527cfc +1.13.1-rc2: 54f71fd 1.13.1: 092cba3 +17.03.0-rc1: ce07fb6 +17.03.0: 60ccb22 +17.03.1-rc1: 3476dbf +17.03.1: c6d412e +17.03.2-rc1: eef6495 +17.03.2: f5ec1e2 +17.04.0-rc1: d2532c6 +17.04.0-rc2: 2f35d73 +17.04.0: 4845c56 +17.05.0-rc1: 2878a85 +17.05.0-rc2: c57fdb2 +17.05.0-rc3: 90d35ab +17.05.0: 89658be +17.06.0-rc1: 7f8486a +17.06.0-rc2: 402dd4a +17.06.0-rc3: 7953dbc +17.06.0-rc4: 29fcd5d +17.06.0-rc5: b7e4173 +17.06.0: 02c1d87 +17.06.1-rc1: 77b4dce +17.06.1-rc2: 96d8424 +17.06.1-rc3: 87a7a64 +17.06.1-rc4: 0a33916 +17.06.1: 874a737 +17.07.0-rc1: 8c4be39 +17.07.0-rc2: 36ce605 +17.07.0-rc3: 665d244
  22. Download patch debian/patches/fix-test-umasks.patch

    --- 1.13.1~ds1-2/debian/patches/fix-test-umasks.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/fix-test-umasks.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -Description: Fix file mode values for some tests - Some tests specified invalid octal file mode values without the leading - zero. This was causing a test failure in pbuilder due to a less - permissive umask value. -Author: Tim Potter <tpot@hpe.com> -Bug-Github: https://github.com/moby/moby/issues/33484 -Forwarded: https://github.com/moby/moby/issues/33485 ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: docker.io/pkg/filenotify/poller_test.go -=================================================================== ---- docker.io.orig/pkg/filenotify/poller_test.go -+++ docker.io/pkg/filenotify/poller_test.go -@@ -61,7 +61,7 @@ func TestPollerEvent(t *testing.T) { - default: - } - -- if err := ioutil.WriteFile(f.Name(), []byte("hello"), 644); err != nil { -+ if err := ioutil.WriteFile(f.Name(), []byte("hello"), 0644); err != nil { - t.Fatal(err) - } - if err := assertEvent(w, fsnotify.Write); err != nil { -Index: docker.io/pkg/sysinfo/sysinfo_linux_test.go -=================================================================== ---- docker.io.orig/pkg/sysinfo/sysinfo_linux_test.go -+++ docker.io/pkg/sysinfo/sysinfo_linux_test.go -@@ -16,7 +16,7 @@ func TestReadProcBool(t *testing.T) { - defer os.RemoveAll(tmpDir) - - procFile := filepath.Join(tmpDir, "read-proc-bool") -- if err := ioutil.WriteFile(procFile, []byte("1"), 644); err != nil { -+ if err := ioutil.WriteFile(procFile, []byte("1"), 0644); err != nil { - t.Fatal(err) - } - -@@ -24,7 +24,7 @@ func TestReadProcBool(t *testing.T) { - t.Fatal("expected proc bool to be true, got false") - } - -- if err := ioutil.WriteFile(procFile, []byte("0"), 644); err != nil { -+ if err := ioutil.WriteFile(procFile, []byte("0"), 0644); err != nil { - t.Fatal(err) - } - if readProcBool(procFile) { -@@ -48,7 +48,7 @@ func TestCgroupEnabled(t *testing.T) { - t.Fatal("cgroupEnabled should be false") - } - -- if err := ioutil.WriteFile(path.Join(cgroupDir, "test"), []byte{}, 644); err != nil { -+ if err := ioutil.WriteFile(path.Join(cgroupDir, "test"), []byte{}, 0644); err != nil { - t.Fatal(err) - } -
  23. Download patch debian/docker.io.install

    --- 1.13.1~ds1-2/debian/docker.io.install 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/docker.io.install 2017-08-31 22:43:34.000000000 +0000 @@ -1,7 +1,10 @@ #!/usr/bin/dh-exec +# docker itself bundles/${DOCKER_VERSION}/${DOCKER_BUILD_TARGET}-client/docker-${DOCKER_VERSION} => usr/bin/docker -bundles/${DOCKER_VERSION}/${DOCKER_BUILD_TARGET}-daemon/dockerd-${DOCKER_VERSION} => usr/sbin/dockerd +bundles/${DOCKER_VERSION}/${DOCKER_BUILD_TARGET}-daemon/dockerd-${DOCKER_VERSION} => usr/bin/dockerd +libnetwork/docker-proxy => usr/bin/docker-proxy +tini/tini-static => usr/bin/docker-init contrib/*-integration usr/share/docker.io/contrib/ contrib/check-config.sh usr/share/docker.io/contrib/
  24. Download patch daemon/graphdriver/aufs/aufs_test.go

    --- 1.13.1~ds1-2/daemon/graphdriver/aufs/aufs_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/graphdriver/aufs/aufs_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -28,6 +28,10 @@ func init() { } func testInit(dir string, t testing.TB) graphdriver.Driver { + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + d, err := Init(dir, nil, nil, nil) if err != nil { if err == graphdriver.ErrNotSupported {
  25. Download patch debian/tests/common

    --- 1.13.1~ds1-2/debian/tests/common 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/tests/common 2017-01-12 22:50:50.000000000 +0000 @@ -0,0 +1,16 @@ +set -eux +set -o pipefail + +exitTraps=( 'true' ) +doExit() { + for exitTrap in "${exitTraps[@]}"; do + eval "$exitTrap" || true + done +} +trap 'doExit' EXIT +defer() { + exitTraps=( "$@" "${exitTraps[@]}" ) +} + +tempDir="$(mktemp -d)" +defer "rm -rf '$tempDir'"
  26. Download patch debian/patches/nuke-graph-directory-bash.patch

    --- 1.13.1~ds1-2/debian/patches/nuke-graph-directory-bash.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/nuke-graph-directory-bash.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -Description: Use bash instead of sh to execute nuke-graph-directory.sh script - This script uses bash-isms and so does not work in environments where /bin/sh is - not linked to /bin/bash. -Author: Tim Potter <tpot@hpe.com> -Forwarded: not-needed, applied in later upstream version ---- -This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ -Index: docker.io/contrib/nuke-graph-directory.sh -=================================================================== ---- docker.io.orig/contrib/nuke-graph-directory.sh -+++ docker.io/contrib/nuke-graph-directory.sh -@@ -1,4 +1,4 @@ --#!/bin/sh -+#!/usr/bin/env bash - set -e - - dir="$1"
  27. Download patch debian/control

    --- 1.13.1~ds1-2/debian/control 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/control 2017-09-04 01:07:54.000000000 +0000 @@ -1,90 +1,24 @@ Source: docker.io Section: admin Priority: optional -Maintainer: Tim Potter <tpot@hpe.com> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Paul Tagliamonte <paultag@debian.org> Uploaders: Docker Packaging Team <docker-maint@lists.alioth.debian.org>, - Tianon Gravi <tianon@debian.org>, - Paul Tagliamonte <paultag@debian.org> + Tianon Gravi <tianon@debian.org> Build-Conflicts: golang-github-docker-docker-dev Build-Depends: bash-completion, - btrfs-progs, + btrfs-tools, ca-certificates, + cmake, debhelper (>= 9), dh-exec, - dh-golang (>= 1.14~), dh-systemd, git, go-md2man (>= 1.0.3~), - golang-any (>= 2:1.6~) | golang-1.6-go, - golang-dbus-dev (>= 3~) | golang-github-godbus-dbus-dev (>= 3~), - golang-dns-dev (>= 0.0~git20151201~) | golang-github-miekg-dns-dev (>= 0.0~git20151201~), - golang-ed25519-dev (>= 0~20140907~) | golang-github-agl-ed25519-dev (>= 0~20140907~), - golang-etcd-server-dev (>= 2.2.0~) | golang-github-coreos-etcd-dev (>= 2.2.0~), - golang-github-aanand-compose-file-dev, - golang-github-armon-go-metrics-dev (>= 0.0~git20150106~), - golang-github-aws-aws-sdk-go-dev (>= 0.9.9~), - golang-github-boltdb-bolt-dev (>= 1.2.0~), - golang-github-bsphere-le-go-dev, - golang-github-burntsushi-toml-dev (>= 0.0~git20150127~), - golang-github-coreos-go-systemd-dev (>= 4~), - golang-github-deckarep-golang-set-dev (>= 0.0~git20141121~), - golang-github-dnephin-cobra-dev (>= 1.5+git20161103.0.a3c0924~), - golang-github-docker-containerd-dev (>= 0.2.3+git20170126.85.aa8187d~ds1~), - golang-github-docker-distribution-dev (>= 2.4.1~), - golang-github-docker-docker-credential-helpers-dev (>= 0.3.0+git20160906.22.f72c04f~), - golang-github-docker-engine-api-dev (>= 0.3.3~), - golang-github-docker-go-connections-dev (>= 0.2.1+git20170204.13.ecb4cb2~), - golang-github-docker-go-dev (>= 0.0~git20151102~), - golang-github-docker-go-events-dev, - golang-github-docker-go-metrics-dev, - golang-github-docker-go-units-dev (>= 0.3.1+git20161130.10.e30f1e7), - golang-github-docker-libkv-dev (>= 0.0~git20151014~), - golang-github-docker-libnetwork-dev (>= 0.8.0-dev.2+git20170202.599.45b4086~), - golang-github-docker-libtrust-dev (>= 0.0~git20150526~), - golang-github-docker-swarmkit-dev (>= 1.12.0+git20170201.779.1c7f003d~), - golang-github-fluent-fluent-logger-golang-dev (>= 1.1.0~), - golang-github-flynn-archive-go-shlex-dev, - golang-github-fsnotify-fsnotify-dev (>= 1.2.0~) | golang-gopkg-fsnotify.v1-dev (>= 1.2.0~), - golang-github-gorilla-context-dev (>= 0.0~git20140604~), - golang-github-gorilla-mux-dev (>= 0.0~git20140926~), - golang-github-azure-go-ansiterm-dev, - golang-github-graylog2-go-gelf-dev (>= 0.0~git20160208~), - golang-github-hashicorp-consul-dev (>= 0.5.2~), - golang-github-hashicorp-go-msgpack-dev (>= 0.0~git20140221~), - golang-github-hashicorp-memberlist-dev (>= 0.0~git20150107~), - golang-github-hashicorp-serf-dev (>= 0.0~git20150212~), - golang-github-imdario-mergo-dev (>= 0.2.1~), - golang-github-kr-pty-dev (>= 0.0~git20150511~), - golang-github-mattn-go-shellwords-dev (>= 1.0.0~), - golang-github-mattn-go-sqlite3-dev (>= 1.1.0~), - golang-github-miekg-pkcs11-dev (>= 0.0~git20160222~), - golang-github-opencontainers-runc-dev (>= 1.0.0~rc2+git20170201.133.9df8b30~), - golang-github-opencontainers-specs-dev (>= 0.0~git20160422~), - golang-github-philhofer-fwd-dev (>= 0.0~git20150401~), - golang-github-racksec-srslog-dev (>= 0.0~git20160120~), - golang-github-samuel-go-zookeeper-dev (>= 0.0~git20150415~), - golang-github-sirupsen-logrus-dev (>= 0.9.0~), - golang-github-tchap-go-patricia-dev (>= 2.1.0~), - golang-github-tinylib-msgp-dev (>= 0.0~git20150407~), - golang-github-tonistiigi-fifo-dev, - golang-github-ugorji-go-codec-dev (>= 0.0~git20150803~) | golang-github-ugorji-go-dev (>= 0.0~git20150803~), - golang-github-vaughan0-go-ini-dev (>= 0.0~git20130923~), - golang-github-vbatts-tar-split-dev (>= 0.9.11~), - golang-github-vdemeester-shakers-dev (>= 0.0~git20160210~), - golang-github-vishvananda-netlink-dev (>= 0.0~git20160214~), - golang-github-vishvananda-netns-dev (>= 0.0~git20150710~), - golang-golang-x-time-dev, - golang-go-zfs-dev (>= 2.1.1~) | golang-github-mistifyio-go-zfs-dev (>= 2.1.1~), - golang-gocapability-dev (>= 0.0~git20150614~) | golang-github-syndtr-gocapability-dev (>= 0.0~git20150614~), - golang-golang-x-net-dev (>= 0.0~git20160407~), - golang-golang-x-oauth2-google-dev (>= 0.0~git20151203~) | golang-golang-x-oauth2-dev (>= 0.0~git20151203~), - golang-google-api-dev (>= 0.0~git20151216~), - golang-google-cloud-dev (>= 0.0~git20151216~), - golang-google-grpc-dev (>= 0.0~git20151216~), - golang-gopkg-check.v1-dev (>= 0.0~git20160311~) | golang-github-go-check-check-dev (>= 0.0~git20160311~), - golang-goprotobuf-dev (>= 0.0~git20151207~) | golang-github-golang-protobuf-dev (>= 0.0~git20151207~), + golang-any (>= 2:1.7~) | golang-1.7-go, libapparmor-dev, libdevmapper-dev (>= 2:1.02.68~), + libseccomp-dev, pkg-config, procps, tzdata @@ -95,30 +29,28 @@ Vcs-Browser: https://anonscm.debian.org/ XS-Go-Import-Path: github.com/docker/docker Package: docker.io -Architecture: linux-any +Architecture: amd64 arm64 armhf i386 ppc64el s390x Depends: adduser, - containerd (>= 0.2.3+git20170126.85.aa8187d~ds1~), + containerd (>= 0.2.5~), iptables, - golang-libnetwork (>= 0.8.0-dev.2+git20170202.599.45b4086~), - lsb-base, - runc (>= 1.0.0~rc2+git20170201.133.9df8b30~), + runc (>= 1.0.0~rc2-0ubuntu1~), ${misc:Depends}, - ${perl:Depends}, ${shlibs:Depends} Recommends: ca-certificates, cgroupfs-mount | cgroup-lite, git, + ubuntu-fan, xz-utils, ${apparmor:Recommends} Replaces: docker (<< 1.5~) Breaks: docker (<< 1.5~) Suggests: aufs-tools, - btrfs-progs, + btrfs-tools, debootstrap, docker-doc, rinse, zfs-fuse | zfsutils -Built-Using: ${misc:Built-Using}, ${libc:Built-Using} +Built-Using: ${libc:Built-Using} Description: Linux container runtime Docker complements kernel namespacing with a high-level API which operates at the process level. It runs unix processes with strong guarantees of isolation @@ -147,21 +79,7 @@ Description: Docker container engine - V Package: golang-github-docker-docker-dev Architecture: all -Depends: golang-github-docker-go-connections-dev, - golang-github-docker-go-units-dev, - golang-github-docker-libkv-dev, - golang-github-fsnotify-fsnotify-dev, - golang-github-gorilla-mux-dev, - golang-github-mattn-go-shellwords-dev, - golang-github-mattn-go-sqlite3-dev, - golang-github-opencontainers-runc-dev, - golang-github-sirupsen-logrus-dev, - golang-github-tchap-go-patricia-dev, - golang-github-vdemeester-shakers-dev, - golang-golang-x-net-dev, - golang-gopkg-check.v1-dev, - ${misc:Depends} -Built-Using: ${misc:Built-Using} +Depends: ${misc:Depends} Replaces: golang-docker-dev (<< 1.8.2~ds1-1~) Breaks: golang-docker-dev (<< 1.8.2~ds1-1~) Provides: golang-docker-dev
  28. Download patch libnetwork/client/client_test.go
  29. Download patch hack/make/.build-deb/docker-engine.docker.upstart

    --- 1.13.1~ds1-2/hack/make/.build-deb/docker-engine.docker.upstart 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/hack/make/.build-deb/docker-engine.docker.upstart 2017-09-21 09:40:39.000000000 +0000 @@ -11,11 +11,18 @@ limit nproc unlimited unlimited respawn +pre-start script + # Cleanup any stale mounts left from previous shutdown + # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 + grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ + xargs -r umount || true +end script + kill timeout 20 script # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) - DOCKERD=/usr/sbin/dockerd + DOCKERD=/usr/bin/dockerd DOCKER_OPTS= if [ -f /etc/default/$UPSTART_JOB ]; then . /etc/default/$UPSTART_JOB
  30. Download patch builder/tarsum_test.go

    --- 1.13.1~ds1-2/builder/tarsum_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/builder/tarsum_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -193,7 +193,10 @@ func TestRemoveDirectory(t *testing.T) { } func TestMakeTarSumContext(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + contextDir, cleanup := createTestTempDir(t, "", "builder-tarsum-test") defer cleanup()
  31. Download patch libnetwork/cmd/proxy/proxy.go

    --- 1.13.1~ds1-2/libnetwork/cmd/proxy/proxy.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/proxy/proxy.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,37 @@ +// docker-proxy provides a network Proxy interface and implementations for TCP +// and UDP. +package main + +import ( + "fmt" + "net" +) + +// Proxy defines the behavior of a proxy. It forwards traffic back and forth +// between two endpoints : the frontend and the backend. +// It can be used to do software port-mapping between two addresses. +// e.g. forward all traffic between the frontend (host) 127.0.0.1:3000 +// to the backend (container) at 172.17.42.108:4000. +type Proxy interface { + // Run starts forwarding traffic back and forth between the front + // and back-end addresses. + Run() + // Close stops forwarding traffic and close both ends of the Proxy. + Close() + // FrontendAddr returns the address on which the proxy is listening. + FrontendAddr() net.Addr + // BackendAddr returns the proxied address. + BackendAddr() net.Addr +} + +// NewProxy creates a Proxy according to the specified frontendAddr and backendAddr. +func NewProxy(frontendAddr, backendAddr net.Addr) (Proxy, error) { + switch frontendAddr.(type) { + case *net.UDPAddr: + return NewUDPProxy(frontendAddr.(*net.UDPAddr), backendAddr.(*net.UDPAddr)) + case *net.TCPAddr: + return NewTCPProxy(frontendAddr.(*net.TCPAddr), backendAddr.(*net.TCPAddr)) + default: + panic(fmt.Errorf("Unsupported protocol")) + } +}
  32. Download patch cli/compose/template/template_test.go

    --- 1.13.1~ds1-2/cli/compose/template/template_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/cli/compose/template/template_test.go 2017-02-08 05:58:41.000000000 +0000 @@ -18,7 +18,7 @@ func defaultMapping(name string) (string func TestEscaped(t *testing.T) { result, err := Substitute("$${foo}", defaultMapping) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "${foo}", result) } @@ -43,7 +43,7 @@ func TestInvalid(t *testing.T) { func TestNoValueNoDefault(t *testing.T) { for _, template := range []string{"This ${missing} var", "This ${BAR} var"} { result, err := Substitute(template, defaultMapping) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "This var", result) } } @@ -51,7 +51,7 @@ func TestNoValueNoDefault(t *testing.T) func TestValueNoDefault(t *testing.T) { for _, template := range []string{"This $FOO var", "This ${FOO} var"} { result, err := Substitute(template, defaultMapping) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "This first var", result) } } @@ -59,25 +59,25 @@ func TestValueNoDefault(t *testing.T) { func TestNoValueWithDefault(t *testing.T) { for _, template := range []string{"ok ${missing:-def}", "ok ${missing-def}"} { result, err := Substitute(template, defaultMapping) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "ok def", result) } } func TestEmptyValueWithSoftDefault(t *testing.T) { result, err := Substitute("ok ${BAR:-def}", defaultMapping) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "ok def", result) } func TestEmptyValueWithHardDefault(t *testing.T) { result, err := Substitute("ok ${BAR-def}", defaultMapping) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "ok ", result) } func TestNonAlphanumericDefault(t *testing.T) { result, err := Substitute("ok ${BAR:-/non:-alphanumeric}", defaultMapping) - assert.Nil(t, err) + assert.NoError(t, err) assert.Equal(t, "ok /non:-alphanumeric", result) }
  33. Download patch debian/patches/fix-template-test.patch

    --- 1.13.1~ds1-2/debian/patches/fix-template-test.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/fix-template-test.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -Index: docker.io/cli/compose/template/template_test.go -=================================================================== ---- docker.io.orig/cli/compose/template/template_test.go -+++ docker.io/cli/compose/template/template_test.go -@@ -18,7 +18,7 @@ func defaultMapping(name string) (string - - func TestEscaped(t *testing.T) { - result, err := Substitute("$${foo}", defaultMapping) -- assert.NoError(t, err) -+ assert.Nil(t, err) - assert.Equal(t, "${foo}", result) - } - -@@ -43,7 +43,7 @@ func TestInvalid(t *testing.T) { - func TestNoValueNoDefault(t *testing.T) { - for _, template := range []string{"This ${missing} var", "This ${BAR} var"} { - result, err := Substitute(template, defaultMapping) -- assert.NoError(t, err) -+ assert.Nil(t, err) - assert.Equal(t, "This var", result) - } - } -@@ -51,7 +51,7 @@ func TestNoValueNoDefault(t *testing.T) - func TestValueNoDefault(t *testing.T) { - for _, template := range []string{"This $FOO var", "This ${FOO} var"} { - result, err := Substitute(template, defaultMapping) -- assert.NoError(t, err) -+ assert.Nil(t, err) - assert.Equal(t, "This first var", result) - } - } -@@ -59,25 +59,25 @@ func TestValueNoDefault(t *testing.T) { - func TestNoValueWithDefault(t *testing.T) { - for _, template := range []string{"ok ${missing:-def}", "ok ${missing-def}"} { - result, err := Substitute(template, defaultMapping) -- assert.NoError(t, err) -+ assert.Nil(t, err) - assert.Equal(t, "ok def", result) - } - } - - func TestEmptyValueWithSoftDefault(t *testing.T) { - result, err := Substitute("ok ${BAR:-def}", defaultMapping) -- assert.NoError(t, err) -+ assert.Nil(t, err) - assert.Equal(t, "ok def", result) - } - - func TestEmptyValueWithHardDefault(t *testing.T) { - result, err := Substitute("ok ${BAR-def}", defaultMapping) -- assert.NoError(t, err) -+ assert.Nil(t, err) - assert.Equal(t, "ok ", result) - } - - func TestNonAlphanumericDefault(t *testing.T) { - result, err := Substitute("ok ${BAR:-/non:-alphanumeric}", defaultMapping) -- assert.NoError(t, err) -+ assert.Nil(t, err) - assert.Equal(t, "ok /non:-alphanumeric", result) - }
  34. Download patch daemon/graphdriver/overlay/overlay_test.go

    --- 1.13.1~ds1-2/daemon/graphdriver/overlay/overlay_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/graphdriver/overlay/overlay_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -19,27 +19,37 @@ func init() { // This avoids creating a new driver for each test if all tests are run // Make sure to put new tests between TestOverlaySetup and TestOverlayTeardown func TestOverlaySetup(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } graphtest.GetDriver(t, "overlay") } func TestOverlayCreateEmpty(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } graphtest.DriverTestCreateEmpty(t, "overlay") } func TestOverlayCreateBase(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } graphtest.DriverTestCreateBase(t, "overlay") } func TestOverlayCreateSnap(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } graphtest.DriverTestCreateSnap(t, "overlay") } func TestOverlay50LayerRead(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } graphtest.DriverTestDeepLayerRead(t, 50, "overlay") }
  35. Download patch daemon/graphdriver/devmapper/devmapper_test.go

    --- 1.13.1~ds1-2/daemon/graphdriver/devmapper/devmapper_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/graphdriver/devmapper/devmapper_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -11,50 +11,70 @@ import ( "github.com/docker/docker/daemon/graphdriver/graphtest" ) -func init() { +func shortSkip(t *testing.T) { + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } +} + +// This avoids creating a new driver for each test if all tests are run +// Make sure to put new tests between TestDevmapperSetup and TestDevmapperTeardown +func TestDevmapperSetup(t *testing.T) { + shortSkip(t) + // Reduce the size the the base fs and loopback for the tests defaultDataLoopbackSize = 300 * 1024 * 1024 defaultMetaDataLoopbackSize = 200 * 1024 * 1024 defaultBaseFsSize = 300 * 1024 * 1024 defaultUdevSyncOverride = true if err := graphtest.InitLoopbacks(); err != nil { - panic(err) + t.Fatal(err) } -} -// This avoids creating a new driver for each test if all tests are run -// Make sure to put new tests between TestDevmapperSetup and TestDevmapperTeardown -func TestDevmapperSetup(t *testing.T) { graphtest.GetDriver(t, "devicemapper") } func TestDevmapperCreateEmpty(t *testing.T) { + shortSkip(t) + graphtest.DriverTestCreateEmpty(t, "devicemapper") } func TestDevmapperCreateBase(t *testing.T) { + shortSkip(t) + graphtest.DriverTestCreateBase(t, "devicemapper") } func TestDevmapperCreateSnap(t *testing.T) { + shortSkip(t) + graphtest.DriverTestCreateSnap(t, "devicemapper") } func TestDevmapperTeardown(t *testing.T) { + shortSkip(t) + graphtest.PutDriver(t) } func TestDevmapperReduceLoopBackSize(t *testing.T) { + shortSkip(t) + tenMB := int64(10 * 1024 * 1024) testChangeLoopBackSize(t, -tenMB, defaultDataLoopbackSize, defaultMetaDataLoopbackSize) } func TestDevmapperIncreaseLoopBackSize(t *testing.T) { + shortSkip(t) + tenMB := int64(10 * 1024 * 1024) testChangeLoopBackSize(t, tenMB, defaultDataLoopbackSize+tenMB, defaultMetaDataLoopbackSize+tenMB) } func testChangeLoopBackSize(t *testing.T, delta, expectDataSize, expectMetaDataSize int64) { + shortSkip(t) + driver := graphtest.GetDriver(t, "devicemapper").(*graphtest.Driver).Driver.(*graphdriver.NaiveDiffDriver).ProtoDriver.(*Driver) defer graphtest.PutDriver(t) // make sure data or metadata loopback size are the default size @@ -83,6 +103,8 @@ func testChangeLoopBackSize(t *testing.T // Make sure devices.Lock() has been release upon return from cleanupDeletedDevices() function func TestDevmapperLockReleasedDeviceDeletion(t *testing.T) { + shortSkip(t) + driver := graphtest.GetDriver(t, "devicemapper").(*graphtest.Driver).Driver.(*graphdriver.NaiveDiffDriver).ProtoDriver.(*Driver) defer graphtest.PutDriver(t)
  36. Download patch libnetwork/cmd/proxy/main.go

    --- 1.13.1~ds1-2/libnetwork/cmd/proxy/main.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/proxy/main.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,67 @@ +package main + +import ( + "flag" + "fmt" + "log" + "net" + "os" + "os/signal" + "syscall" +) + +func main() { + f := os.NewFile(3, "signal-parent") + host, container := parseHostContainerAddrs() + + p, err := NewProxy(host, container) + if err != nil { + fmt.Fprintf(f, "1\n%s", err) + f.Close() + os.Exit(1) + } + go handleStopSignals(p) + fmt.Fprint(f, "0\n") + f.Close() + + // Run will block until the proxy stops + p.Run() +} + +// parseHostContainerAddrs parses the flags passed on reexec to create the TCP or UDP +// net.Addrs to map the host and container ports +func parseHostContainerAddrs() (host net.Addr, container net.Addr) { + var ( + proto = flag.String("proto", "tcp", "proxy protocol") + hostIP = flag.String("host-ip", "", "host ip") + hostPort = flag.Int("host-port", -1, "host port") + containerIP = flag.String("container-ip", "", "container ip") + containerPort = flag.Int("container-port", -1, "container port") + ) + + flag.Parse() + + switch *proto { + case "tcp": + host = &net.TCPAddr{IP: net.ParseIP(*hostIP), Port: *hostPort} + container = &net.TCPAddr{IP: net.ParseIP(*containerIP), Port: *containerPort} + case "udp": + host = &net.UDPAddr{IP: net.ParseIP(*hostIP), Port: *hostPort} + container = &net.UDPAddr{IP: net.ParseIP(*containerIP), Port: *containerPort} + default: + log.Fatalf("unsupported protocol %s", *proto) + } + + return host, container +} + +func handleStopSignals(p Proxy) { + s := make(chan os.Signal, 10) + signal.Notify(s, os.Interrupt, syscall.SIGTERM) + + for range s { + p.Close() + + os.Exit(0) + } +}
  37. Download patch debian/clean

    --- 1.13.1~ds1-2/debian/clean 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/clean 2017-08-25 00:40:51.000000000 +0000 @@ -1,5 +1,15 @@ -## Useless non-doc files: -docs/.gitignore -docs/Dockerfile -docs/Makefile -docs/touch-up.sh +# generated files +autogen/ +bundles/ +dockerversion/*_autogen*.go +libnetwork/docker-proxy +man/man*/ +tini/CMakeCache.txt +tini/CMakeFiles/ +tini/CPackConfig.cmake +tini/CPackSourceConfig.cmake +tini/Makefile +tini/VERSION +tini/cmake_install.cmake +tini/tini-static +tini/tiniConfig.h
  38. Download patch debian/tests/basic-smoke

    --- 1.13.1~ds1-2/debian/tests/basic-smoke 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/tests/basic-smoke 2017-01-12 22:50:50.000000000 +0000 @@ -1,17 +1,6 @@ #!/bin/bash -set -eux -set -o pipefail -exitTraps=( 'true' ) -doExit() { - for exitTrap in "${exitTraps[@]}"; do - eval "$exitTrap" || true - done -} -trap 'doExit' EXIT -defer() { - exitTraps=( "$@" "${exitTraps[@]}" ) -} +. debian/tests/common /etc/init.d/docker start defer '/etc/init.d/docker stop' @@ -20,9 +9,6 @@ defer 'journalctl -u docker | tail' # make sure Docker itself is working before we go too deep down the rabbit hole docker version -tempDir="$(mktemp -d)" -defer "rm -rf '$tempDir'" - debootstrap \ --variant=minbase \ stable \
  39. Download patch daemon/daemon_unix_test.go

    --- 1.13.1~ds1-2/daemon/daemon_unix_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/daemon_unix_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -204,7 +204,10 @@ func TestNetworkOptions(t *testing.T) { } func TestMigratePre17Volumes(t *testing.T) { - t.Skip("DM - Skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + rootDir, err := ioutil.TempDir("", "test-daemon-volumes") if err != nil { t.Fatal(err)
  40. Download patch debian/patches/remove-docker-prefix.patch

    --- 1.13.1~ds1-2/debian/patches/remove-docker-prefix.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/remove-docker-prefix.patch 2017-08-25 00:40:51.000000000 +0000 @@ -1,8 +1,12 @@ -Index: docker.io/daemon/daemon.go -=================================================================== ---- docker.io.orig/daemon/daemon.go -+++ docker.io/daemon/daemon.go -@@ -64,7 +64,7 @@ import ( +Description: remove "docker-" prefix on expected "runc" and "containerd" binaries +Forwarded: not-needed +Author: Tianon Gravi <tianon@debian.org> + +diff --git a/daemon/daemon.go b/daemon/daemon.go +index 55a66aec9..d7b23379c 100644 +--- a/daemon/daemon.go ++++ b/daemon/daemon.go +@@ -61,7 +61,7 @@ import ( var ( // DefaultRuntimeBinary is the default runtime to be used by // containerd if none is specified @@ -11,24 +15,86 @@ Index: docker.io/daemon/daemon.go // DefaultInitBinary is the name of the default init binary DefaultInitBinary = "docker-init" -Index: docker.io/libcontainerd/remote_unix.go -=================================================================== ---- docker.io.orig/libcontainerd/remote_unix.go -+++ docker.io/libcontainerd/remote_unix.go -@@ -36,9 +36,9 @@ const ( +diff --git a/integration-cli/docker_cli_daemon_test.go b/integration-cli/docker_cli_daemon_test.go +index 3a74fe215..93b611739 100644 +--- a/integration-cli/docker_cli_daemon_test.go ++++ b/integration-cli/docker_cli_daemon_test.go +@@ -2537,7 +2537,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { + { + "runtimes": { + "oci": { +- "path": "docker-runc" ++ "path": "runc" + }, + "vm": { + "path": "/usr/local/bin/vm-manager", +@@ -2619,7 +2619,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { + "default-runtime": "vm", + "runtimes": { + "oci": { +- "path": "docker-runc" ++ "path": "runc" + }, + "vm": { + "path": "/usr/local/bin/vm-manager", +@@ -2645,7 +2645,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromConfigFile(c *check.C) { + } + + func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) { +- err := s.d.StartWithBusybox("--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") ++ err := s.d.StartWithBusybox("--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") + c.Assert(err, check.IsNil) + + // Run with default runtime +@@ -2694,7 +2694,7 @@ func (s *DockerDaemonSuite) TestRunWithRuntimeFromCommandLine(c *check.C) { + + // Check that we can select a default runtime + s.d.Stop() +- err = s.d.StartWithBusybox("--default-runtime=vm", "--add-runtime", "oci=docker-runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") ++ err = s.d.StartWithBusybox("--default-runtime=vm", "--add-runtime", "oci=runc", "--add-runtime", "vm=/usr/local/bin/vm-manager") + c.Assert(err, check.IsNil) + + out, err = s.d.Cmd("run", "--rm", "busybox", "ls") +diff --git a/integration-cli/docker_cli_events_unix_test.go b/integration-cli/docker_cli_events_unix_test.go +index dc9166711..2c3f0b7e0 100644 +--- a/integration-cli/docker_cli_events_unix_test.go ++++ b/integration-cli/docker_cli_events_unix_test.go +@@ -429,7 +429,7 @@ func (s *DockerDaemonSuite) TestDaemonEvents(c *check.C) { + out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c)) + c.Assert(err, checker.IsNil) + +- c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s (cluster-advertise=, cluster-store=, cluster-store-opts={}, debug=true, default-runtime=runc, insecure-registries=[], labels=[\"bar=foo\"], live-restore=false, max-concurrent-downloads=1, max-concurrent-uploads=5, name=%s, runtimes=runc:{docker-runc []}, shutdown-timeout=10)", daemonID, daemonName)) ++ c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s (cluster-advertise=, cluster-store=, cluster-store-opts={}, debug=true, default-runtime=runc, insecure-registries=[], labels=[\"bar=foo\"], live-restore=false, max-concurrent-downloads=1, max-concurrent-uploads=5, name=%s, runtimes=runc:{runc []}, shutdown-timeout=10)", daemonID, daemonName)) + } + + func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) { +diff --git a/integration-cli/docker_test_vars.go b/integration-cli/docker_test_vars.go +index 3559bfdbb..f9dad4809 100644 +--- a/integration-cli/docker_test_vars.go ++++ b/integration-cli/docker_test_vars.go +@@ -20,7 +20,7 @@ var ( + dockerdBinary = "dockerd" + + // path to containerd's ctr binary +- ctrBinary = "docker-containerd-ctr" ++ ctrBinary = "ctr" + + // the private registry image to use for tests involving the registry + registryImageName = "registry" +diff --git a/libcontainerd/remote_unix.go b/libcontainerd/remote_unix.go +index 64a28646b..92a2d49ab 100644 +--- a/libcontainerd/remote_unix.go ++++ b/libcontainerd/remote_unix.go +@@ -36,7 +36,7 @@ const ( maxConnectionRetryCount = 3 containerdHealthCheckTimeout = 3 * time.Second containerdShutdownTimeout = 15 * time.Second - containerdBinary = "docker-containerd" -- containerdPidFilename = "docker-containerd.pid" -- containerdSockFilename = "docker-containerd.sock" + containerdBinary = "containerd" -+ containerdPidFilename = "containerd.pid" -+ containerdSockFilename = "containerd.sock" + containerdPidFilename = "docker-containerd.pid" + containerdSockFilename = "docker-containerd.sock" containerdStateDir = "containerd" - eventTimestampFilename = "event.ts" - ) -@@ -383,7 +383,7 @@ func (r *remote) runContainerdDaemon() e +@@ -383,7 +383,7 @@ func (r *remote) runContainerdDaemon() error { if goruntime.GOOS == "solaris" { args = append(args, "--shim", "containerd-shim", "--runtime", "runc") } else {
  41. Download patch libnetwork/bitseq/sequence.go
  42. Download patch libnetwork/agent.pb.go
  43. Download patch libnetwork/api/api_linux_test.go

    --- 1.13.1~ds1-2/libnetwork/api/api_linux_test.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/api/api_linux_test.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,18 @@ +package api + +import ( + "github.com/docker/libnetwork/drivers/bridge" + "github.com/docker/libnetwork/netlabel" +) + +func GetOpsMap(bridgeName, defaultMTU string) map[string]string { + if defaultMTU == "" { + return map[string]string{ + bridge.BridgeName: bridgeName, + } + } + return map[string]string{ + bridge.BridgeName: bridgeName, + netlabel.DriverMTU: defaultMTU, + } +}
  44. Download patch cmd/dockerd/daemon_linux.go

    --- 1.13.1~ds1-2/cmd/dockerd/daemon_linux.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/cmd/dockerd/daemon_linux.go 2017-02-08 05:58:41.000000000 +0000 @@ -7,5 +7,5 @@ import systemdDaemon "github.com/coreos/ // notifySystem sends a message to the host when the server is ready to be used func notifySystem() { // Tell the init daemon we are accepting requests - go systemdDaemon.SdNotify(false, "READY=1") + go systemdDaemon.SdNotify("READY=1") }
  45. Download patch libnetwork/cmd/dnet/cmd.go

    --- 1.13.1~ds1-2/libnetwork/cmd/dnet/cmd.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/dnet/cmd.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,146 @@ +package main + +import ( + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + + "github.com/codegangsta/cli" + "github.com/docker/docker/pkg/term" + "github.com/docker/libnetwork/client" +) + +var ( + containerCreateCommand = cli.Command{ + Name: "create", + Usage: "Create a container", + Action: runContainerCreate, + } + + containerRmCommand = cli.Command{ + Name: "rm", + Usage: "Remove a container", + Action: runContainerRm, + } + + containerCommands = []cli.Command{ + containerCreateCommand, + containerRmCommand, + } + + dnetCommands = []cli.Command{ + createDockerCommand("network"), + createDockerCommand("service"), + { + Name: "container", + Usage: "Container management commands", + Subcommands: containerCommands, + }, + } +) + +func runContainerCreate(c *cli.Context) { + if len(c.Args()) == 0 { + fmt.Printf("Please provide container id argument\n") + os.Exit(1) + } + + sc := client.SandboxCreate{ContainerID: c.Args()[0]} + obj, _, err := readBody(epConn.httpCall("POST", "/sandboxes", sc, nil)) + if err != nil { + fmt.Printf("POST failed during create container: %v\n", err) + os.Exit(1) + } + + var replyID string + err = json.Unmarshal(obj, &replyID) + if err != nil { + fmt.Printf("Unmarshall of response failed during create container: %v\n", err) + os.Exit(1) + } + + fmt.Printf("%s\n", replyID) + +} + +func runContainerRm(c *cli.Context) { + var sbList []*client.SandboxResource + + if len(c.Args()) == 0 { + fmt.Printf("Please provide container id argument\n") + os.Exit(1) + } + + obj, _, err := readBody(epConn.httpCall("GET", "/sandboxes?partial-container-id="+c.Args()[0], nil, nil)) + if err != nil { + fmt.Printf("GET failed during container id lookup: %v\n", err) + os.Exit(1) + } + + err = json.Unmarshal(obj, &sbList) + if err != nil { + fmt.Printf("Unmarshall of container id lookup response failed: %v", err) + os.Exit(1) + } + + if len(sbList) == 0 { + fmt.Printf("No sandbox for container %s found\n", c.Args()[0]) + os.Exit(1) + } + + _, _, err = readBody(epConn.httpCall("DELETE", "/sandboxes/"+sbList[0].ID, nil, nil)) + if err != nil { + fmt.Printf("DELETE of sandbox id %s failed: %v", sbList[0].ID, err) + os.Exit(1) + } +} + +func runDockerCommand(c *cli.Context, cmd string) { + _, stdout, stderr := term.StdStreams() + oldcli := client.NewNetworkCli(stdout, stderr, epConn.httpCall) + var args []string + args = append(args, cmd) + if c.Bool("h") { + args = append(args, "--help") + } else { + args = append(args, c.Args()...) + } + if err := oldcli.Cmd("dnet", args...); err != nil { + fmt.Println(err) + os.Exit(1) + } +} + +func createDockerCommand(cmd string) cli.Command { + return cli.Command{ + Name: cmd, + Usage: fmt.Sprintf("%s management commands", cmd), + SkipFlagParsing: true, + Action: func(c *cli.Context) { + runDockerCommand(c, cmd) + }, + Subcommands: []cli.Command{ + { + Name: "h, -help", + Usage: fmt.Sprintf("%s help", cmd), + }, + }, + } +} + +func readBody(stream io.ReadCloser, hdr http.Header, statusCode int, err error) ([]byte, int, error) { + if stream != nil { + defer stream.Close() + } + if err != nil { + return nil, statusCode, err + } + body, err := ioutil.ReadAll(stream) + if err != nil { + return nil, -1, err + } + return body, statusCode, nil +}
  46. Download patch debian/patches/check-v1.patch
  47. Download patch libnetwork/api/api_solaris_test.go

    --- 1.13.1~ds1-2/libnetwork/api/api_solaris_test.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/api/api_solaris_test.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,18 @@ +package api + +import ( + "github.com/docker/libnetwork/drivers/solaris/bridge" + "github.com/docker/libnetwork/netlabel" +) + +func GetOpsMap(bridgeName, defaultMTU string) map[string]string { + if defaultMTU == "" { + return map[string]string{ + bridge.BridgeName: bridgeName, + } + } + return map[string]string{ + bridge.BridgeName: bridgeName, + netlabel.DriverMTU: defaultMTU, + } +}
  48. Download patch daemon/graphdriver/graphtest/graphtest_unix.go

    --- 1.13.1~ds1-2/daemon/graphdriver/graphtest/graphtest_unix.go 2017-02-08 05:58:41.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/graphdriver/graphtest/graphtest_unix.go 2017-09-21 09:40:39.000000000 +0000 @@ -32,6 +32,10 @@ type Driver struct { } func newDriver(t testing.TB, name string, options []string) *Driver { + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + root, err := ioutil.TempDir("", "docker-graphtest-") if err != nil { t.Fatal(err)
  49. Download patch debian/patches/golang-google-grpc-1.0.0.patch

    --- 1.13.1~ds1-2/debian/patches/golang-google-grpc-1.0.0.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/golang-google-grpc-1.0.0.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -Index: docker.io/libcontainerd/remote_linux.go -=================================================================== ---- docker.io.orig/libcontainerd/remote_linux.go -+++ docker.io/libcontainerd/remote_linux.go -@@ -23,12 +23,14 @@ import ( - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/grpclog" -+ "google.golang.org/grpc/health/grpc_health_v1" - "google.golang.org/grpc/transport" - ) - - const ( - maxConnectionRetryCount = 3 - connectionRetryDelay = 3 * time.Second -+ containerdHealthCheckTimeout = 3 * time.Second - containerdShutdownTimeout = 15 * time.Second - containerdBinary = "containerd" - containerdPidFilename = "docker-containerd.pid" -@@ -50,6 +52,7 @@ type remote struct { - eventTsPath string - pastEvents map[string]*containerd.Event - runtimeArgs []string -+ daemonWaitCh chan struct{} - } - - // New creates a fresh instance of libcontainerd remote. -@@ -111,36 +114,41 @@ func New(stateDir string, options ...Rem - - func (r *remote) handleConnectionChange() { - var transientFailureCount = 0 -- state := grpc.Idle -+ -+ ticker := time.NewTicker(500 * time.Millisecond) -+ defer ticker.Stop() -+ healthClient := grpc_health_v1.NewHealthClient(r.rpcConn) -+ - for { -- s, err := r.rpcConn.WaitForStateChange(context.Background(), state) -- if err != nil { -- break -+ <-ticker.C -+ ctx, cancel := context.WithTimeout(context.Background(), containerdHealthCheckTimeout) -+ _, err := healthClient.Check(ctx, &grpc_health_v1.HealthCheckRequest{}) -+ cancel() -+ if err == nil { -+ continue - } -- state = s -- logrus.Debugf("containerd connection state change: %v", s) -+ -+ logrus.Debugf("libcontainerd: containerd health check returned error: %v", err) - - if r.daemonPid != -1 { -- switch state { -- case grpc.TransientFailure: -- // Reset state to be notified of next failure -- transientFailureCount++ -- if transientFailureCount >= maxConnectionRetryCount { -- transientFailureCount = 0 -- if utils.IsProcessAlive(r.daemonPid) { -- utils.KillProcess(r.daemonPid) -- } -- if err := r.runContainerdDaemon(); err != nil { //FIXME: Handle error -- logrus.Errorf("error restarting containerd: %v", err) -- } -- } else { -- state = grpc.Idle -- time.Sleep(connectionRetryDelay) -- } -- case grpc.Shutdown: -+ if strings.Contains(err.Error(), "is closing") { - // Well, we asked for it to stop, just return - return - } -+ // all other errors are transient -+ // Reset state to be notified of next failure -+ transientFailureCount++ -+ if transientFailureCount >= maxConnectionRetryCount { -+ transientFailureCount = 0 -+ if utils.IsProcessAlive(r.daemonPid) { -+ utils.KillProcess(r.daemonPid) -+ } -+ <-r.daemonWaitCh -+ if err := r.runContainerdDaemon(); err != nil { //FIXME: Handle error -+ logrus.Errorf("libcontainerd: error restarting containerd: %v", err) -+ } -+ continue -+ } - } - } - } -@@ -383,7 +391,11 @@ func (r *remote) runContainerdDaemon() e - return err - } - -- go cmd.Wait() // Reap our child when needed -+ r.daemonWaitCh = make(chan struct{}) -+ go func() { -+ cmd.Wait() -+ close(r.daemonWaitCh) -+ }() // Reap our child when needed - r.daemonPid = cmd.Process.Pid - return nil - }
  50. Download patch debian/docker.io.docker.upstart

    --- 1.13.1~ds1-2/debian/docker.io.docker.upstart 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/docker.io.docker.upstart 2017-09-21 09:40:39.000000000 +0000 @@ -11,11 +11,18 @@ limit nproc unlimited unlimited respawn +pre-start script + # Cleanup any stale mounts left from previous shutdown + # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 + grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ + xargs -r umount || true +end script + kill timeout 20 script # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) - DOCKERD=/usr/sbin/dockerd + DOCKERD=/usr/bin/dockerd DOCKER_OPTS= if [ -f /etc/default/$UPSTART_JOB ]; then . /etc/default/$UPSTART_JOB
  51. Download patch hack/make/.build-deb/docker-engine.docker.init

    --- 1.13.1~ds1-2/hack/make/.build-deb/docker-engine.docker.init 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/hack/make/.build-deb/docker-engine.docker.init 2017-09-21 09:40:39.000000000 +0000 @@ -22,7 +22,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bi BASE=docker # modify these in /etc/default/$BASE (/etc/default/docker) -DOCKERD=/usr/sbin/dockerd +DOCKERD=/usr/bin/dockerd # This is the pid file managed by docker itself DOCKER_PIDFILE=/var/run/$BASE.pid # This is the pid file created/managed by start-stop-daemon @@ -59,12 +59,21 @@ fail_unless_root() { fi } +devicemapper_umount() { + # Cleanup any stale mounts left from previous shutdown + # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 + grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ + xargs -r umount || true +} + case "$1" in start) check_init fail_unless_root + devicemapper_umount + touch "$DOCKER_LOGFILE" chgrp docker "$DOCKER_LOGFILE"
  52. Download patch debian/repack/keep/vendor

    --- 1.13.1~ds1-2/debian/repack/keep/vendor 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/repack/keep/vendor 2017-01-12 22:50:50.000000000 +0000 @@ -2,4 +2,4 @@ #vendor/src/github.com/docker/some-library # notary versioning is a bit complex, so we'll use it vendored for now -vendor/github.com/docker/notary +vendor/src/github.com/docker/notary
  53. Download patch debian/patches/devicemapper-cleanup.patch

    --- 1.13.1~ds1-2/debian/patches/devicemapper-cleanup.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/devicemapper-cleanup.patch 2017-01-12 22:50:50.000000000 +0000 @@ -0,0 +1,60 @@ +Description: Cleanup stale device mapper mounts on start + On shutdown, docker sometimes leaves device mapper + mounts for container mounted, causing the containers + impacted to be un-startable post-restart. + . + Cleanup any stale device mapper mounts on startup; this + is really just a workaround for an open issue upstream. +Author: James Page <james.page@ubuntu.com> +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1404300 +Bug: https://github.com/docker/docker/issues/5684 +Forwarded: no + +To reproduce, just install docker.io from trusty archive (0.9.1 or 1.0.1), start a +container doing just a echo hello, every seconds, then upgrade. The container cannot +start again. + +diff --git a/contrib/init/sysvinit-debian/docker b/contrib/init/sysvinit-debian/docker +index 0a5ffc8..d1a1158 100755 +--- a/contrib/init/sysvinit-debian/docker ++++ b/contrib/init/sysvinit-debian/docker +@@ -59,12 +59,21 @@ fail_unless_root() { + fi + } + ++devicemapper_umount() { ++ # Cleanup any stale mounts left from previous shutdown ++ # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 ++ grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ ++ xargs -r umount || true ++} ++ + case "$1" in + start) + check_init + + fail_unless_root + ++ devicemapper_umount ++ + touch "$DOCKER_LOGFILE" + chgrp docker "$DOCKER_LOGFILE" + +diff --git a/contrib/init/upstart/docker.conf b/contrib/init/upstart/docker.conf +index 4414e4b..e8f718a 100644 +--- a/contrib/init/upstart/docker.conf ++++ b/contrib/init/upstart/docker.conf +@@ -7,6 +7,13 @@ limit nproc 524288 1048576 + + respawn + ++pre-start script ++ # Cleanup any stale mounts left from previous shutdown ++ # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 ++ grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ ++ xargs -r umount || true ++end script ++ + kill timeout 20 + + script
  54. Download patch daemon/graphdriver/vfs/vfs_test.go

    --- 1.13.1~ds1-2/daemon/graphdriver/vfs/vfs_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/graphdriver/vfs/vfs_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -10,32 +10,42 @@ import ( "github.com/docker/docker/pkg/reexec" ) -func init() { - reexec.Init() +func shortSkip(t *testing.T) { + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } } // This avoids creating a new driver for each test if all tests are run // Make sure to put new tests between TestVfsSetup and TestVfsTeardown func TestVfsSetup(t *testing.T) { - t.Skip("DM - skipping privileged test") + shortSkip(t) + + reexec.Init() + graphtest.GetDriver(t, "vfs") } func TestVfsCreateEmpty(t *testing.T) { - t.Skip("DM - skipping privileged test") + shortSkip(t) + graphtest.DriverTestCreateEmpty(t, "vfs") } func TestVfsCreateBase(t *testing.T) { - t.Skip("DM - skipping privileged test") + shortSkip(t) + graphtest.DriverTestCreateBase(t, "vfs") } func TestVfsCreateSnap(t *testing.T) { - t.Skip("DM - skipping privileged test") + shortSkip(t) + graphtest.DriverTestCreateSnap(t, "vfs") } func TestVfsTeardown(t *testing.T) { + shortSkip(t) + graphtest.PutDriver(t) }
  55. Download patch libnetwork/api/api_test.go
  56. Download patch debian/watch

    --- 1.13.1~ds1-2/debian/watch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/watch 2017-08-25 00:40:51.000000000 +0000 @@ -1,9 +1,25 @@ -version=3 +version=4 + +# github's ".../tags" paginates too soon, so we lose historical versions too early for tianon's tastes (hence uscan.tianon.xyz) +# https://github.com/docker/docker/tags + opts=\ dversionmangle=s/[+~](debian|dfsg|ds|deb)\d*$//,\ uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/,\ filenamemangle=s/.+\/v(\d\S*)\.tar\.gz/docker.io_$1.orig.tar.gz/ \ - https://uscan.tianon.xyz/github.com/docker/docker https://github.com/.*/v(\d\S*)\.tar\.gz debian ./debian/repack.sh + https://uscan.tianon.xyz/github.com/docker/docker \ + https://github.com/.*/v(\d\S*)\.tar\.gz -# /tags paginates too soon, so we lose historical versions too early for tianon's tastes -# https://github.com/docker/docker/tags .*/v(\d\S*)\.tar\.gz debian ./debian/repack.sh +opts=\ +component=libnetwork,\ +uversionmangle=s/-ce//g;s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/,\ +filenamemangle=s/.+\/docker-(\d\S*)\.tar\.gz/docker.io_$1.orig-libnetwork.tar.gz/ \ + https://uscan.tianon.xyz/github.com/tianon/docker-libnetwork-tags \ + https://github.com/.*/docker-(\d\S*)\.tar\.gz + +opts=\ +component=tini,\ +uversionmangle=s/-ce//g;s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/,\ +filenamemangle=s/.+\/docker-(\d\S*)\.tar\.gz/docker.io_$1.orig-tini.tar.gz/ \ + https://uscan.tianon.xyz/github.com/tianon/docker-tini-tags \ + https://github.com/.*/docker-(\d\S*)\.tar\.gz
  57. Download patch daemon/graphdriver/overlay2/overlay_test.go

    --- 1.13.1~ds1-2/daemon/graphdriver/overlay2/overlay_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/graphdriver/overlay2/overlay_test.go 2017-02-08 05:58:41.000000000 +0000 @@ -49,27 +49,22 @@ func skipIfNaive(t *testing.T) { // This avoids creating a new driver for each test if all tests are run // Make sure to put new tests between TestOverlaySetup and TestOverlayTeardown func TestOverlaySetup(t *testing.T) { - t.Skip("DM - skipping privileged test") graphtest.GetDriver(t, driverName) } func TestOverlayCreateEmpty(t *testing.T) { - t.Skip("DM - skipping privileged test") graphtest.DriverTestCreateEmpty(t, driverName) } func TestOverlayCreateBase(t *testing.T) { - t.Skip("DM - skipping privileged test") graphtest.DriverTestCreateBase(t, driverName) } func TestOverlayCreateSnap(t *testing.T) { - t.Skip("DM - skipping privileged test") graphtest.DriverTestCreateSnap(t, driverName) } func TestOverlay128LayerRead(t *testing.T) { - t.Skip("DM - skipping privileged test") graphtest.DriverTestDeepLayerRead(t, 128, driverName) }
  58. Download patch libcontainerd/remote_unix.go

    --- 1.13.1~ds1-2/libcontainerd/remote_unix.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/libcontainerd/remote_unix.go 2017-09-21 09:40:39.000000000 +0000 @@ -37,8 +37,8 @@ const ( containerdHealthCheckTimeout = 3 * time.Second containerdShutdownTimeout = 15 * time.Second containerdBinary = "containerd" - containerdPidFilename = "containerd.pid" - containerdSockFilename = "containerd.sock" + containerdPidFilename = "docker-containerd.pid" + containerdSockFilename = "docker-containerd.sock" containerdStateDir = "containerd" eventTimestampFilename = "event.ts" )
  59. Download patch contrib/init/sysvinit-debian/docker

    --- 1.13.1~ds1-2/contrib/init/sysvinit-debian/docker 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/contrib/init/sysvinit-debian/docker 2017-09-21 09:40:39.000000000 +0000 @@ -22,7 +22,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bi BASE=docker # modify these in /etc/default/$BASE (/etc/default/docker) -DOCKERD=/usr/sbin/dockerd +DOCKERD=/usr/bin/dockerd # This is the pid file managed by docker itself DOCKER_PIDFILE=/var/run/$BASE.pid # This is the pid file created/managed by start-stop-daemon @@ -59,12 +59,21 @@ fail_unless_root() { fi } +devicemapper_umount() { + # Cleanup any stale mounts left from previous shutdown + # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 + grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ + xargs -r umount || true +} + case "$1" in start) check_init fail_unless_root + devicemapper_umount + touch "$DOCKER_LOGFILE" chgrp docker "$DOCKER_LOGFILE"
  60. Download patch libnetwork/api/types.go

    --- 1.13.1~ds1-2/libnetwork/api/types.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/api/types.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,96 @@ +package api + +import "github.com/docker/libnetwork/types" + +/*********** + Resources +************/ + +// networkResource is the body of the "get network" http response message +type networkResource struct { + Name string `json:"name"` + ID string `json:"id"` + Type string `json:"type"` + Endpoints []*endpointResource `json:"endpoints"` +} + +// endpointResource is the body of the "get endpoint" http response message +type endpointResource struct { + Name string `json:"name"` + ID string `json:"id"` + Network string `json:"network"` +} + +// sandboxResource is the body of "get service backend" response message +type sandboxResource struct { + ID string `json:"id"` + Key string `json:"key"` + ContainerID string `json:"container_id"` +} + +/*********** + Body types + ************/ + +type ipamConf struct { + PreferredPool string + SubPool string + Gateway string + AuxAddresses map[string]string +} + +// networkCreate is the expected body of the "create network" http request message +type networkCreate struct { + Name string `json:"name"` + ID string `json:"id"` + NetworkType string `json:"network_type"` + IPv4Conf []ipamConf `json:"ipv4_configuration"` + DriverOpts map[string]string `json:"driver_opts"` + NetworkOpts map[string]string `json:"network_opts"` +} + +// endpointCreate represents the body of the "create endpoint" http request message +type endpointCreate struct { + Name string `json:"name"` + MyAliases []string `json:"my_aliases"` +} + +// sandboxCreate is the expected body of the "create sandbox" http request message +type sandboxCreate struct { + ContainerID string `json:"container_id"` + HostName string `json:"host_name"` + DomainName string `json:"domain_name"` + HostsPath string `json:"hosts_path"` + ResolvConfPath string `json:"resolv_conf_path"` + DNS []string `json:"dns"` + ExtraHosts []extraHost `json:"extra_hosts"` + UseDefaultSandbox bool `json:"use_default_sandbox"` + UseExternalKey bool `json:"use_external_key"` + ExposedPorts []types.TransportPort `json:"exposed_ports"` + PortMapping []types.PortBinding `json:"port_mapping"` +} + +// endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages +type endpointJoin struct { + SandboxID string `json:"sandbox_id"` + Aliases []string `json:"aliases"` +} + +// servicePublish represents the body of the "publish service" http request message +type servicePublish struct { + Name string `json:"name"` + MyAliases []string `json:"my_aliases"` + Network string `json:"network_name"` +} + +// serviceDelete represents the body of the "unpublish service" http request message +type serviceDelete struct { + Name string `json:"name"` + Force bool `json:"force"` +} + +// extraHost represents the extra host object +type extraHost struct { + Name string `json:"name"` + Address string `json:"address"` +}
  61. Download patch debian/patches/series

    --- 1.13.1~ds1-2/debian/patches/series 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/series 2017-08-31 22:43:34.000000000 +0000 @@ -4,20 +4,11 @@ cgroupfs-mount-convenience-copy.patch change-system-unit-env-file.patch # See also https://github.com/docker/docker/pull/7220#issuecomment-50076589 - 21491--systemd-tasksmax.patch remove-docker-prefix.patch - -#skip-privileged-unit-tests.patch -#skip-racy-unit-tests.patch -#check-v1.patch -coreos-go-systemd.patch -dockerd-binary-location.patch -nuke-graph-directory-bash.patch -golang-google-api.patch skip-privileged-unit-tests.patch -fix-test-umasks.patch -new-seccomp-format.patch -fix-template-test.patch -disable-TestChangesWithChangesGH13590-test.patch + +# Ubuntu Delta +devicemapper-cleanup.patch +no-test-libnetwork.patch
  62. Download patch libnetwork/bitseq/store.go

    --- 1.13.1~ds1-2/libnetwork/bitseq/store.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/bitseq/store.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,141 @@ +package bitseq + +import ( + "encoding/json" + "fmt" + + "github.com/docker/libnetwork/datastore" + "github.com/docker/libnetwork/types" +) + +// Key provides the Key to be used in KV Store +func (h *Handle) Key() []string { + h.Lock() + defer h.Unlock() + return []string{h.app, h.id} +} + +// KeyPrefix returns the immediate parent key that can be used for tree walk +func (h *Handle) KeyPrefix() []string { + h.Lock() + defer h.Unlock() + return []string{h.app} +} + +// Value marshals the data to be stored in the KV store +func (h *Handle) Value() []byte { + b, err := json.Marshal(h) + if err != nil { + return nil + } + return b +} + +// SetValue unmarshals the data from the KV store +func (h *Handle) SetValue(value []byte) error { + return json.Unmarshal(value, h) +} + +// Index returns the latest DB Index as seen by this object +func (h *Handle) Index() uint64 { + h.Lock() + defer h.Unlock() + return h.dbIndex +} + +// SetIndex method allows the datastore to store the latest DB Index into this object +func (h *Handle) SetIndex(index uint64) { + h.Lock() + h.dbIndex = index + h.dbExists = true + h.Unlock() +} + +// Exists method is true if this object has been stored in the DB. +func (h *Handle) Exists() bool { + h.Lock() + defer h.Unlock() + return h.dbExists +} + +// New method returns a handle based on the receiver handle +func (h *Handle) New() datastore.KVObject { + h.Lock() + defer h.Unlock() + + return &Handle{ + app: h.app, + store: h.store, + } +} + +// CopyTo deep copies the handle into the passed destination object +func (h *Handle) CopyTo(o datastore.KVObject) error { + h.Lock() + defer h.Unlock() + + dstH := o.(*Handle) + if h == dstH { + return nil + } + dstH.Lock() + dstH.bits = h.bits + dstH.unselected = h.unselected + dstH.head = h.head.getCopy() + dstH.app = h.app + dstH.id = h.id + dstH.dbIndex = h.dbIndex + dstH.dbExists = h.dbExists + dstH.store = h.store + dstH.Unlock() + + return nil +} + +// Skip provides a way for a KV Object to avoid persisting it in the KV Store +func (h *Handle) Skip() bool { + return false +} + +// DataScope method returns the storage scope of the datastore +func (h *Handle) DataScope() string { + h.Lock() + defer h.Unlock() + + return h.store.Scope() +} + +func (h *Handle) fromDsValue(value []byte) error { + var ba []byte + if err := json.Unmarshal(value, &ba); err != nil { + return fmt.Errorf("failed to decode json: %s", err.Error()) + } + if err := h.FromByteArray(ba); err != nil { + return fmt.Errorf("failed to decode handle: %s", err.Error()) + } + return nil +} + +func (h *Handle) writeToStore() error { + h.Lock() + store := h.store + h.Unlock() + if store == nil { + return nil + } + err := store.PutObjectAtomic(h) + if err == datastore.ErrKeyModified { + return types.RetryErrorf("failed to perform atomic write (%v). Retry might fix the error", err) + } + return err +} + +func (h *Handle) deleteFromStore() error { + h.Lock() + store := h.store + h.Unlock() + if store == nil { + return nil + } + return store.DeleteObjectAtomic(h) +}
  63. Download patch debian/README.Debian

    --- 1.13.1~ds1-2/debian/README.Debian 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/README.Debian 2017-01-12 22:50:50.000000000 +0000 @@ -1,14 +1,6 @@ Docker on Debian ================ -Please refer to upstream's documentation for information about what Docker is, -how it works, and how to use it: https://docs.docker.com/ - -The following notes are things that may have impact specifically to use of the -Docker package in Debian. - --- - To enable docker memory limitation, the kernel needs to be loaded with boot parameters: cgroup_enable=memory swapaccount=1. @@ -25,7 +17,6 @@ GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enabl Then run update-grub, and reboot. ---- It's worth pointing out that upstream maintains a "check-config.sh" script for verifying not only proper kernel configuration (which isn't terribly relevant in @@ -38,7 +29,6 @@ In the docker.io package, one can find t "/usr/share/docker.io/contrib/check-config.sh", which when run (does NOT require root/sudo) will report on problems with your installation/configuration. ---- As noted in the upstream documentation (https://docs.docker.io), Docker will allow non-root users in the "docker" group to access "docker.sock" and thus @@ -55,25 +45,3 @@ Docker, please be sure to read the "Dock upstream documentation: https://docs.docker.com/engine/security/security/ - ---- - - rpc error: code = 2 desc = "oci runtime error: could not synchronise with - container process: no subsystem for mount" - -This message is very likely related to https://bugs.debian.org/843530, and thus -https://github.com/opencontainers/runc/issues/1175. - -Adding "systemd.legacy_systemd_cgroup_controller=yes" to your system boot -parameters (in Grub, etc) is probably necessary to resolve it. - ---- - -Support for the logentries.com log driver has been removed from the -Debian version as it contains no license information and is therefore -not redistributable. - -Github issues have been filed upstream: - -https://github.com/bsphere/le_go/issues/14 -https://github.com/docker/docker/issues/31020
  64. Download patch debian/patches/change-system-unit-env-file.patch

    --- 1.13.1~ds1-2/debian/patches/change-system-unit-env-file.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/change-system-unit-env-file.patch 2017-08-25 00:40:51.000000000 +0000 @@ -4,11 +4,9 @@ Description: Use EnvironmentFile with th Bug-Debian: http://bugs.debian.org/746774 Forwarded: no -Index: docker.io/contrib/init/systemd/docker.service -=================================================================== ---- docker.io.orig/contrib/init/systemd/docker.service -+++ docker.io/contrib/init/systemd/docker.service -@@ -9,7 +9,8 @@ Type=notify +--- a/contrib/init/systemd/docker.service ++++ b/contrib/init/systemd/docker.service +@@ -9,7 +9,8 @@ # the default is not to use systemd for cgroups because the delegate issues still # exists and systemd currently does not support the cgroup feature set required # for containers run by docker
  65. Download patch debian/docker.io.docker.service

    --- 1.13.1~ds1-2/debian/docker.io.docker.service 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/docker.io.docker.service 2017-09-21 09:40:39.000000000 +0000 @@ -10,7 +10,7 @@ Type=notify # exists and systemd currently does not support the cgroup feature set required # for containers run by docker EnvironmentFile=-/etc/default/docker -ExecStart=/usr/sbin/dockerd -H fd:// $DOCKER_OPTS +ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS ExecReload=/bin/kill -s HUP $MAINPID LimitNOFILE=1048576 # Having non-zero Limit*s causes performance problems due to accounting overhead
  66. Download patch integration-cli/docker_cli_events_unix_test.go

    --- 1.13.1~ds1-2/integration-cli/docker_cli_events_unix_test.go 2017-02-08 05:58:41.000000000 +0000 +++ 1.13.1-0ubuntu4/integration-cli/docker_cli_events_unix_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -429,7 +429,7 @@ func (s *DockerDaemonSuite) TestDaemonEv out, err = s.d.Cmd("events", "--since=0", "--until", daemonUnixTime(c)) c.Assert(err, checker.IsNil) - c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s (cluster-advertise=, cluster-store=, cluster-store-opts={}, debug=true, default-runtime=runc, insecure-registries=[], labels=[\"bar=foo\"], live-restore=false, max-concurrent-downloads=1, max-concurrent-uploads=5, name=%s, runtimes=runc:{docker-runc []}, shutdown-timeout=10)", daemonID, daemonName)) + c.Assert(out, checker.Contains, fmt.Sprintf("daemon reload %s (cluster-advertise=, cluster-store=, cluster-store-opts={}, debug=true, default-runtime=runc, insecure-registries=[], labels=[\"bar=foo\"], live-restore=false, max-concurrent-downloads=1, max-concurrent-uploads=5, name=%s, runtimes=runc:{runc []}, shutdown-timeout=10)", daemonID, daemonName)) } func (s *DockerDaemonSuite) TestDaemonEventsWithFilters(c *check.C) {
  67. Download patch libnetwork/cmd/dnet/dnet.go
  68. Download patch libnetwork/client/service.go
  69. Download patch hack/make/test-unit

    --- 1.13.1~ds1-2/hack/make/test-unit 2017-02-08 05:58:41.000000000 +0000 +++ 1.13.1-0ubuntu4/hack/make/test-unit 2017-09-21 09:40:39.000000000 +0000 @@ -45,6 +45,7 @@ bundle_test_unit() { "${BUILDFLAGS[@]}" $TEST_PATH \ | grep github.com/docker/docker \ | grep -v github.com/docker/docker/vendor \ + | grep -v github.com/docker/docker/libnetwork \ | grep -v github.com/docker/docker/man \ | grep -v github.com/docker/docker/integration-cli) fi
  70. Download patch debian/patches/skip-racy-unit-tests.patch

    --- 1.13.1~ds1-2/debian/patches/skip-racy-unit-tests.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/skip-racy-unit-tests.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -Description: allow skipping racy tests with "-test.short" -Author: Tianon Gravi <tianon@debian.org> -Forwarded: no -Bug: https://github.com/docker/docker/issues/22965 - -diff --git a/pkg/integration/utils_test.go b/pkg/integration/utils_test.go -index d166489..38323ef 100644 ---- a/pkg/integration/utils_test.go -+++ b/pkg/integration/utils_test.go -@@ -191,6 +191,10 @@ func TestRunCommandWithOutputAndTimeoutFinished(t *testing.T) { - } - - func TestRunCommandWithOutputAndTimeoutKilled(t *testing.T) { -+ if testing.Short() { -+ t.Skip("Skipping racy test in short mode") -+ } -+ - // TODO Windows: Port this test - if runtime.GOOS == "windows" { - t.Skip("Needs porting to Windows")
  71. Download patch debian/patches/21491--systemd-tasksmax.patch

    --- 1.13.1~ds1-2/debian/patches/21491--systemd-tasksmax.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/21491--systemd-tasksmax.patch 2017-01-12 22:50:50.000000000 +0000 @@ -1,18 +1,11 @@ -From 33a8ab29ed9e51697772a0642b8d651b9a845532 Mon Sep 17 00:00:00 2001 -From: Pierre Carrier <pierre@meteor.com>, Tianon Gravi <tianon@debian.org> -Date: Thu, 24 Mar 2016 16:14:30 -0700 -Subject: [PATCH] docker.service: don't limit tasks -Origin: https://github.com/docker/docker/pull/21491 +Description: uncomment "TasksMax" in systemd service file (since our version of systemd supports it) +Author: Tianon Gravi <tianon@debian.org> +Origin: https://github.com/docker/docker/pull/21491#issuecomment-201431374 -Signed-off-by: Pierre Carrier <pierre@meteor.com> ---- - contrib/init/systemd/docker.service | 3 +++ - 1 file changed, 3 insertions(+) - -Index: docker.io/contrib/init/systemd/docker.service -=================================================================== ---- docker.io.orig/contrib/init/systemd/docker.service -+++ docker.io/contrib/init/systemd/docker.service +diff --git a/contrib/init/systemd/docker.service b/contrib/init/systemd/docker.service +index c10655d..d14b320 100644 +--- a/contrib/init/systemd/docker.service ++++ b/contrib/init/systemd/docker.service @@ -19,7 +19,7 @@ LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it.
  72. Download patch debian/patches/cgroupfs-mount-convenience-copy.patch

    --- 1.13.1~ds1-2/debian/patches/cgroupfs-mount-convenience-copy.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/cgroupfs-mount-convenience-copy.patch 2017-01-12 22:50:50.000000000 +0000 @@ -3,10 +3,10 @@ Description: remove convenience copies o Forwarded: not-needed Bug-Debian: https://bugs.debian.org/783143 -Index: docker.io/contrib/init/sysvinit-debian/docker -=================================================================== ---- docker.io.orig/contrib/init/sysvinit-debian/docker -+++ docker.io/contrib/init/sysvinit-debian/docker +diff --git a/contrib/init/sysvinit-debian/docker b/contrib/init/sysvinit-debian/docker +index 11500a0..3ad9e2e 100755 +--- a/contrib/init/sysvinit-debian/docker ++++ b/contrib/init/sysvinit-debian/docker @@ -59,37 +59,12 @@ fail_unless_root() { fi } @@ -45,11 +45,11 @@ Index: docker.io/contrib/init/sysvinit-d touch "$DOCKER_LOGFILE" chgrp docker "$DOCKER_LOGFILE" -Index: docker.io/contrib/init/upstart/docker.conf -=================================================================== ---- docker.io.orig/contrib/init/upstart/docker.conf -+++ docker.io/contrib/init/upstart/docker.conf -@@ -13,29 +13,6 @@ respawn +diff --git a/contrib/init/upstart/docker.conf b/contrib/init/upstart/docker.conf +index ec50b35..75858f8 100644 +--- a/contrib/init/upstart/docker.conf ++++ b/contrib/init/upstart/docker.conf +@@ -9,29 +9,6 @@ respawn kill timeout 20
  73. Download patch builder/dockerfile/internals_test.go

    --- 1.13.1~ds1-2/builder/dockerfile/internals_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/builder/dockerfile/internals_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -11,7 +11,10 @@ import ( ) func TestEmptyDockerfile(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + contextDir, cleanup := createTestTempDir(t, "", "builder-dockerfile-test") defer cleanup() @@ -21,7 +24,6 @@ func TestEmptyDockerfile(t *testing.T) { } func TestSymlinkDockerfile(t *testing.T) { - t.Skip("DM - skipping privileged test") contextDir, cleanup := createTestTempDir(t, "", "builder-dockerfile-test") defer cleanup() @@ -37,7 +39,10 @@ func TestSymlinkDockerfile(t *testing.T) } func TestDockerfileOutsideTheBuildContext(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + contextDir, cleanup := createTestTempDir(t, "", "builder-dockerfile-test") defer cleanup() @@ -47,7 +52,6 @@ func TestDockerfileOutsideTheBuildContex } func TestNonExistingDockerfile(t *testing.T) { - t.Skip("DM - skipping privileged test") contextDir, cleanup := createTestTempDir(t, "", "builder-dockerfile-test") defer cleanup() @@ -57,6 +61,10 @@ func TestNonExistingDockerfile(t *testin } func readAndCheckDockerfile(t *testing.T, testName, contextDir, dockerfilePath, expectedError string) { + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + tarStream, err := archive.Tar(contextDir, archive.Uncompressed) if err != nil {
  74. Download patch libnetwork/cmd/ovrouter/ovrouter.go

    --- 1.13.1~ds1-2/libnetwork/cmd/ovrouter/ovrouter.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/ovrouter/ovrouter.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,174 @@ +package main + +import ( + "fmt" + "net" + "os" + "os/signal" + + "github.com/docker/docker/pkg/plugingetter" + "github.com/docker/docker/pkg/reexec" + "github.com/docker/libnetwork/driverapi" + "github.com/docker/libnetwork/drivers/overlay" + "github.com/docker/libnetwork/netlabel" + "github.com/docker/libnetwork/types" + "github.com/vishvananda/netlink" +) + +type router struct { + d driverapi.Driver +} + +type endpoint struct { + addr *net.IPNet + mac net.HardwareAddr + name string +} + +func (r *router) GetPluginGetter() plugingetter.PluginGetter { + return nil +} + +func (r *router) RegisterDriver(name string, driver driverapi.Driver, c driverapi.Capability) error { + r.d = driver + return nil +} + +func (ep *endpoint) Interface() driverapi.InterfaceInfo { + return nil +} + +func (ep *endpoint) SetMacAddress(mac net.HardwareAddr) error { + if ep.mac != nil { + return types.ForbiddenErrorf("endpoint interface MAC address present (%s). Cannot be modified with %s.", ep.mac, mac) + } + if mac == nil { + return types.BadRequestErrorf("tried to set nil MAC address to endpoint interface") + } + ep.mac = types.GetMacCopy(mac) + return nil +} + +func (ep *endpoint) SetIPAddress(address *net.IPNet) error { + if address.IP == nil { + return types.BadRequestErrorf("tried to set nil IP address to endpoint interface") + } + if address.IP.To4() == nil { + return types.NotImplementedErrorf("do not support ipv6 yet") + } + if ep.addr != nil { + return types.ForbiddenErrorf("endpoint interface IP present (%s). Cannot be modified with %s.", ep.addr, address) + } + ep.addr = types.GetIPNetCopy(address) + return nil +} + +func (ep *endpoint) MacAddress() net.HardwareAddr { + return types.GetMacCopy(ep.mac) +} + +func (ep *endpoint) Address() *net.IPNet { + return types.GetIPNetCopy(ep.addr) +} + +func (ep *endpoint) AddressIPv6() *net.IPNet { + return nil +} + +func (ep *endpoint) InterfaceName() driverapi.InterfaceNameInfo { + return ep +} + +func (ep *endpoint) SetNames(srcName, dstPrefix string) error { + ep.name = srcName + return nil +} + +func (ep *endpoint) SetGateway(net.IP) error { + return nil +} + +func (ep *endpoint) SetGatewayIPv6(net.IP) error { + return nil +} + +func (ep *endpoint) AddStaticRoute(destination *net.IPNet, routeType int, + nextHop net.IP) error { + return nil +} + +func (ep *endpoint) AddTableEntry(tableName string, key string, value []byte) error { + return nil +} + +func (ep *endpoint) DisableGatewayService() {} + +func main() { + if reexec.Init() { + return + } + + opt := make(map[string]interface{}) + if len(os.Args) > 1 { + opt[netlabel.OverlayBindInterface] = os.Args[1] + } + if len(os.Args) > 2 { + opt[netlabel.OverlayNeighborIP] = os.Args[2] + } + if len(os.Args) > 3 { + opt[netlabel.GlobalKVProvider] = os.Args[3] + } + if len(os.Args) > 4 { + opt[netlabel.GlobalKVProviderURL] = os.Args[4] + } + + r := &router{} + if err := overlay.Init(r, opt); err != nil { + fmt.Printf("Failed to initialize overlay driver: %v\n", err) + os.Exit(1) + } + + if err := r.d.CreateNetwork("testnetwork", + map[string]interface{}{}, nil, nil, nil); err != nil { + fmt.Printf("Failed to create network in the driver: %v\n", err) + os.Exit(1) + } + + ep := &endpoint{} + if err := r.d.CreateEndpoint("testnetwork", "testep", + ep, map[string]interface{}{}); err != nil { + fmt.Printf("Failed to create endpoint in the driver: %v\n", err) + os.Exit(1) + } + + if err := r.d.Join("testnetwork", "testep", + "", ep, map[string]interface{}{}); err != nil { + fmt.Printf("Failed to join an endpoint in the driver: %v\n", err) + os.Exit(1) + } + + link, err := netlink.LinkByName(ep.name) + if err != nil { + fmt.Printf("Failed to find the container interface with name %s: %v\n", + ep.name, err) + os.Exit(1) + } + + ipAddr := &netlink.Addr{IPNet: ep.addr, Label: ""} + if err := netlink.AddrAdd(link, ipAddr); err != nil { + fmt.Printf("Failed to add address to the interface: %v\n", err) + os.Exit(1) + } + + sigCh := make(chan os.Signal, 1) + signal.Notify(sigCh, os.Interrupt, os.Kill) + + for { + select { + case <-sigCh: + r.d.Leave("testnetwork", "testep") + overlay.Fini(r.d) + os.Exit(0) + } + } +}
  75. Download patch libnetwork/cmd/dnet/libnetwork.toml

    --- 1.13.1~ds1-2/libnetwork/cmd/dnet/libnetwork.toml 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/dnet/libnetwork.toml 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,16 @@ +title = "LibNetwork Configuration file" + +[daemon] + debug = false +[cluster] + discovery = "consul://localhost:8500" + Address = "1.1.1.1" + Heartbeat = 20 +[datastore] + embedded = false +[datastore.client] + provider = "consul" + Address = "localhost:8500" +[orchestration] + agent = true + peer="2.2.2.2"
  76. Download patch libnetwork/CHANGELOG.md
  77. Download patch libnetwork/cmd/dnet/dnet_linux.go

    --- 1.13.1~ds1-2/libnetwork/cmd/dnet/dnet_linux.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/dnet/dnet_linux.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,19 @@ +package main + +import ( + "os" + "os/signal" + "syscall" + + psignal "github.com/docker/docker/pkg/signal" +) + +func setupDumpStackTrap() { + c := make(chan os.Signal, 1) + signal.Notify(c, syscall.SIGUSR1) + go func() { + for range c { + psignal.DumpStacks("") + } + }() +}
  78. Download patch libnetwork/bitseq/sequence_test.go
  79. Download patch debian/patches/dockerd-binary-location.patch

    --- 1.13.1~ds1-2/debian/patches/dockerd-binary-location.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/dockerd-binary-location.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -Index: docker.io/contrib/init/systemd/docker.service -=================================================================== ---- docker.io.orig/contrib/init/systemd/docker.service -+++ docker.io/contrib/init/systemd/docker.service -@@ -10,7 +10,7 @@ Type=notify - # exists and systemd currently does not support the cgroup feature set required - # for containers run by docker - EnvironmentFile=-/etc/default/docker --ExecStart=/usr/bin/dockerd -H fd:// $DOCKER_OPTS -+ExecStart=/usr/sbin/dockerd -H fd:// $DOCKER_OPTS - ExecReload=/bin/kill -s HUP $MAINPID - LimitNOFILE=1048576 - # Having non-zero Limit*s causes performance problems due to accounting overhead -Index: docker.io/contrib/init/sysvinit-debian/docker -=================================================================== ---- docker.io.orig/contrib/init/sysvinit-debian/docker -+++ docker.io/contrib/init/sysvinit-debian/docker -@@ -22,7 +22,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bi - BASE=docker - - # modify these in /etc/default/$BASE (/etc/default/docker) --DOCKERD=/usr/bin/dockerd -+DOCKERD=/usr/sbin/dockerd - # This is the pid file managed by docker itself - DOCKER_PIDFILE=/var/run/$BASE.pid - # This is the pid file created/managed by start-stop-daemon -Index: docker.io/contrib/init/upstart/docker.conf -=================================================================== ---- docker.io.orig/contrib/init/upstart/docker.conf -+++ docker.io/contrib/init/upstart/docker.conf -@@ -15,7 +15,7 @@ kill timeout 20 - - script - # modify these in /etc/default/$UPSTART_JOB (/etc/default/docker) -- DOCKERD=/usr/bin/dockerd -+ DOCKERD=/usr/sbin/dockerd - DOCKER_OPTS= - if [ -f /etc/default/$UPSTART_JOB ]; then - . /etc/default/$UPSTART_JOB
  80. Download patch daemon/logger/gcplogs/gcplogging.go

    --- 1.13.1~ds1-2/daemon/logger/gcplogs/gcplogging.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/daemon/logger/gcplogs/gcplogging.go 2017-02-08 05:58:41.000000000 +0000 @@ -51,7 +51,7 @@ func init() { } type gcplogs struct { - logger *logging.Logger + client *logging.Client instance *instanceInfo container *containerInfo } @@ -114,19 +114,17 @@ func New(ctx logger.Context) (logger.Log return nil, fmt.Errorf("No project was specified and couldn't read project from the meatadata server. Please specify a project") } - c, err := logging.NewClient(context.Background(), project) + c, err := logging.NewClient(context.Background(), project, "gcplogs-docker-driver") if err != nil { return nil, err } - lg := c.Logger("gcplogs-docker-driver") - - if err := c.Ping(context.Background()); err != nil { + if err := c.Ping(); err != nil { return nil, fmt.Errorf("unable to connect or authenticate with Google Cloud Logging: %v", err) } l := &gcplogs{ - logger: lg, + client: c, container: &containerInfo{ Name: ctx.ContainerName, ID: ctx.ContainerID, @@ -159,14 +157,11 @@ func New(ctx logger.Context) (logger.Log // overflow func is called. We want to surface the error to the user // without overly spamming /var/log/docker.log so we log the first time // we overflow and every 1000th time after. - c.OnError = func(err error) { - if err == logging.ErrOverflow { - if i := atomic.AddUint64(&droppedLogs, 1); i%1000 == 1 { - logrus.Errorf("gcplogs driver has dropped %v logs", i) - } - } else { - logrus.Error(err) - } + c.Overflow = func(_ *logging.Client, _ logging.Entry) error { + if i := atomic.AddUint64(&droppedLogs, 1); i%1000 == 1 { + logrus.Errorf("gcplogs driver has dropped %v logs", i) + } + return nil } return l, nil @@ -186,20 +181,18 @@ func ValidateLogOpts(cfg map[string]stri } func (l *gcplogs) Log(m *logger.Message) error { - l.logger.Log(logging.Entry{ - Timestamp: m.Timestamp, + return l.client.Log(logging.Entry{ + Time: m.Timestamp, Payload: &dockerLogEntry{ Instance: l.instance, Container: l.container, Data: string(m.Line), }, }) - return nil } func (l *gcplogs) Close() error { - l.logger.Flush() - return nil + return l.client.Flush() } func (l *gcplogs) Name() string {
  81. Download patch libnetwork/cmd/dnet/dnet_windows.go

    --- 1.13.1~ds1-2/libnetwork/cmd/dnet/dnet_windows.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/cmd/dnet/dnet_windows.go 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "os" + "syscall" + + "github.com/Sirupsen/logrus" + "github.com/docker/docker/pkg/signal" + "github.com/docker/docker/pkg/system" +) + +// Copied over from docker/daemon/debugtrap_windows.go +func setupDumpStackTrap() { + go func() { + sa := syscall.SecurityAttributes{ + Length: 0, + } + ev := "Global\\docker-daemon-" + fmt.Sprint(os.Getpid()) + if h, _ := system.CreateEvent(&sa, false, false, ev); h != 0 { + logrus.Debugf("Stackdump - waiting signal at %s", ev) + for { + syscall.WaitForSingleObject(h, syscall.INFINITE) + signal.DumpStacks("") + } + } + }() +}
  82. Download patch libnetwork/client/mflag/LICENSE

    --- 1.13.1~ds1-2/libnetwork/client/mflag/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/client/mflag/LICENSE 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,27 @@ +Copyright (c) 2014-2016 The Docker & Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  83. Download patch debian/golang-github-docker-docker-dev.install

    --- 1.13.1~ds1-2/debian/golang-github-docker-docker-dev.install 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/golang-github-docker-docker-dev.install 2017-09-03 23:51:20.000000000 +0000 @@ -1,7 +1,8 @@ #!/usr/bin/dh-exec -dockerversion usr/share/gocode/src/${DH_GOPKG}/ -pkg usr/share/gocode/src/${DH_GOPKG}/ -opts usr/share/gocode/src/${DH_GOPKG}/ api usr/share/gocode/src/${DH_GOPKG}/ client usr/share/gocode/src/${DH_GOPKG}/ +dockerversion usr/share/gocode/src/${DH_GOPKG}/ +opts usr/share/gocode/src/${DH_GOPKG}/ +pkg usr/share/gocode/src/${DH_GOPKG}/ +vendor usr/share/gocode/src/${DH_GOPKG}/
  84. Download patch debian/docker.io.docker.init

    --- 1.13.1~ds1-2/debian/docker.io.docker.init 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/docker.io.docker.init 2017-09-21 09:40:39.000000000 +0000 @@ -22,7 +22,7 @@ export PATH=/sbin:/bin:/usr/sbin:/usr/bi BASE=docker # modify these in /etc/default/$BASE (/etc/default/docker) -DOCKERD=/usr/sbin/dockerd +DOCKERD=/usr/bin/dockerd # This is the pid file managed by docker itself DOCKER_PIDFILE=/var/run/$BASE.pid # This is the pid file created/managed by start-stop-daemon @@ -59,12 +59,21 @@ fail_unless_root() { fi } +devicemapper_umount() { + # Cleanup any stale mounts left from previous shutdown + # see https://bugs.launchpad.net/ubuntu/+source/docker.io/+bug/1404300 + grep "mapper/docker" /proc/mounts | awk '{ print $2 }' | \ + xargs -r umount || true +} + case "$1" in start) check_init fail_unless_root + devicemapper_umount + touch "$DOCKER_LOGFILE" chgrp docker "$DOCKER_LOGFILE"
  85. Download patch builder/remote_test.go

    --- 1.13.1~ds1-2/builder/remote_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/builder/remote_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -152,7 +152,10 @@ func TestInspectResponseEmptyContentType } func TestMakeRemoteContext(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + contextDir, cleanup := createTestTempDir(t, "", "builder-tarsum-test") defer cleanup()
  86. Download patch libnetwork/cmd/proxy/network_proxy_test.go
  87. Download patch libnetwork/circle.yml

    --- 1.13.1~ds1-2/libnetwork/circle.yml 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/circle.yml 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,19 @@ +machine: + environment: + GODIST: "go1.7.1.linux-amd64.tar.gz" + services: + - docker + +dependencies: + override: + - sudo apt-get update; sudo apt-get install -y iptables zookeeperd + - go get golang.org/x/tools/cmd/goimports + - go get golang.org/x/tools/cmd/cover + - go get github.com/tools/godep + - go get github.com/golang/lint/golint + - go get github.com/mattn/goveralls + +test: + override: + - make circle-ci +
  88. Download patch libnetwork/api/api.go
  89. Download patch builder/dockerfile/evaluator_test.go

    --- 1.13.1~ds1-2/builder/dockerfile/evaluator_test.go 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/builder/dockerfile/evaluator_test.go 2017-09-21 09:40:39.000000000 +0000 @@ -131,7 +131,10 @@ func initDispatchTestCases() []dispatchT } func TestDispatch(t *testing.T) { - t.Skip("DM - skipping privileged test") + if testing.Short() { + t.Skip("Skipping privileged test in short mode") + } + testCases := initDispatchTestCases() for _, testCase := range testCases {
  90. Download patch debian/docker.io.lintian-overrides

    --- 1.13.1~ds1-2/debian/docker.io.lintian-overrides 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/docker.io.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -docker.io: spelling-error-in-binary -docker.io: spelling-error-in-manpage -docker.io: manpage-has-errors-from-man
  91. Download patch libnetwork/client/mflag/flag.go
  92. Download patch debian/patches/new-seccomp-format.patch

    --- 1.13.1~ds1-2/debian/patches/new-seccomp-format.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/new-seccomp-format.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Index: docker.io/profiles/seccomp/seccomp.go -=================================================================== ---- docker.io.orig/profiles/seccomp/seccomp.go -+++ docker.io/profiles/seccomp/seccomp.go -@@ -17,7 +17,7 @@ import ( - - // GetDefaultProfile returns the default seccomp profile. - func GetDefaultProfile(rs *specs.Spec) (*specs.Seccomp, error) { -- return setupSeccomp(DefaultProfile(), rs) -+ return setupSeccomp(DefaultProfile(rs), rs) - } - - // LoadProfile takes a file path and decodes the seccomp profile.
  93. Download patch debian/copyright
  94. Download patch contrib/nuke-graph-directory.sh

    --- 1.13.1~ds1-2/contrib/nuke-graph-directory.sh 2017-09-21 09:40:40.000000000 +0000 +++ 1.13.1-0ubuntu4/contrib/nuke-graph-directory.sh 2017-02-08 05:58:41.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh set -e dir="$1"
  95. Download patch integration-cli/docker_test_vars.go

    --- 1.13.1~ds1-2/integration-cli/docker_test_vars.go 2017-02-08 05:58:41.000000000 +0000 +++ 1.13.1-0ubuntu4/integration-cli/docker_test_vars.go 2017-09-21 09:40:39.000000000 +0000 @@ -20,7 +20,7 @@ var ( dockerdBinary = "dockerd" // path to containerd's ctr binary - ctrBinary = "docker-containerd-ctr" + ctrBinary = "ctr" // the private registry image to use for tests involving the registry registryImageName = "registry"
  96. Download patch debian/patches/no-test-libnetwork.patch

    --- 1.13.1~ds1-2/debian/patches/no-test-libnetwork.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/no-test-libnetwork.patch 2017-08-25 00:40:51.000000000 +0000 @@ -0,0 +1,12 @@ +diff --git a/hack/make/test-unit b/hack/make/test-unit +index f263345ce..7c8af402a 100644 +--- a/hack/make/test-unit ++++ b/hack/make/test-unit +@@ -45,6 +45,7 @@ bundle_test_unit() { + "${BUILDFLAGS[@]}" $TEST_PATH \ + | grep github.com/docker/docker \ + | grep -v github.com/docker/docker/vendor \ ++ | grep -v github.com/docker/docker/libnetwork \ + | grep -v github.com/docker/docker/man \ + | grep -v github.com/docker/docker/integration-cli) + fi
  97. Download patch debian/patches/disable-TestChangesWithChangesGH13590-test.patch

    --- 1.13.1~ds1-2/debian/patches/disable-TestChangesWithChangesGH13590-test.patch 2017-06-07 01:43:14.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/patches/disable-TestChangesWithChangesGH13590-test.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Index: docker.io/pkg/archive/changes_test.go -=================================================================== ---- docker.io.orig/pkg/archive/changes_test.go -+++ docker.io/pkg/archive/changes_test.go -@@ -197,6 +197,7 @@ func TestChangesWithChanges(t *testing.T - - // See https://github.com/docker/docker/pull/13590 - func TestChangesWithChangesGH13590(t *testing.T) { -+ t.Skip("DM - skipped, doesn't work under pbuilder") - // TODO Windows. There may be a way of running this, but turning off for now - // as createSampleDir uses symlinks. - if runtime.GOOS == "windows" {
  98. Download patch debian/tests/docker-in-lxd

    --- 1.13.1~ds1-2/debian/tests/docker-in-lxd 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/debian/tests/docker-in-lxd 2017-09-21 05:12:08.000000000 +0000 @@ -0,0 +1,166 @@ +#!/bin/bash + +. debian/tests/common + +# This stolen from lxd's debconf magic. +random_ipv4() { + while :; do + SUBNET="10.$(shuf -i 1-255 -n 1).$(shuf -i 0-255 -n 1)" + + # Check if well known + if [ "${SUBNET}" = "10.10.10" ]; then + continue + fi + + # Check if used locally + if ip -4 route show | grep -q ${SUBNET}; then + continue + fi + + # Attempt to see if used behind the gateway + if ping -n -q ${SUBNET}.1 -c 1 -W 1 >/dev/null 2>&1; then + continue + fi + + if ping -n -q ${SUBNET}.254 -c 1 -W 1 >/dev/null 2>&1; then + continue + fi + + break + done + + echo ${SUBNET} +} + +# Detect LXD API extensions +lxd_extension() { + lxc info | grep -q "^\- ${1}$" +} + +# Attempt to auto-configure ipv4, but only when really running under +# autopkgtest. +if [ -n "${AUTOPKGTEST_TMP:-}" ]; then + lxd init --auto + if lxd_extension "network"; then + lxc network create adt-br0 + lxc network attach-profile adt-br0 default eth0 + else + sleep 10 + systemctl stop lxd-bridge + SUBNET=$(random_ipv4) + cat <<EOF > /etc/default/lxd-bridge +USE_LXD_BRIDGE="true" +LXD_BRIDGE="lxdbr0" +UPDATE_PROFILE="true" +LXD_IPV4_ADDR="${SUBNET}.1" +LXD_IPV4_NETMASK="255.255.255.0" +LXD_IPV4_NETWORK="${SUBNET}.1/24" +LXD_IPV4_DHCP_RANGE="${SUBNET}.2,${SUBNET}.254" +LXD_IPV4_DHCP_MAX="252" +LXD_IPV4_NAT="true" +LXD_IPV6_ADDR="" +LXD_IPV6_MASK="" +LXD_IPV6_NETWORK="" +LXD_IPV6_NAT="false" +LXD_IPV6_PROXY="false" +EOF + systemctl start lxd-bridge + fi +fi + +if [ -n "${http_proxy:-}" ]; then + lxc config set core.proxy_http $http_proxy +fi +if [ -n "${https_proxy:-}" ]; then + lxc config set core.proxy_https $https_proxy +fi +if [ -n "${noproxy:-}" ]; then + lxc config set core.proxy_ignore_hosts $noproxy +fi + +suite=$(lsb_release -cs) +arch=$(dpkg --print-architecture) + +lxc launch images:ubuntu/${suite}/${arch} docker -c security.nesting=true + +defer 'lxc delete --force docker' + +# autopkgtest will have done some complicated things to ensure that "apt +# install docker.io" installs the version that should be tested in the +# host. But we want to test that version of docker in the container, so +# replace the entire apt configuration of the container with that of the host. +lxc exec docker -- rm -rf /etc/apt +lxc exec docker -- mkdir /etc/apt +tar -cC /etc/apt . | lxc exec docker -- tar -xC /etc/apt + +for local_source in $(apt-get indextargets | grep-dctrl -F URI -e '^file:///' -sURI); do + local_source=${local_source#file://} + local_dir=$(dirname ${local_source}) + lxc exec docker -- mkdir -p ${local_dir} + tar -cC ${local_dir} . | lxc exec docker -- tar -xC ${local_dir} +done + +if [ -n "${http_proxy:-}" ]; then + lxc exec docker -- mkdir -p /etc/systemd/system/docker.service.d + cat <<EOF | lxc file push - docker/etc/systemd/system/docker.service.d/http-proxy.conf +[Service] +Environment="HTTP_PROXY=$http_proxy" +EOF +fi +if [ -n "${https_proxy:-}" ]; then + lxc exec docker -- mkdir -p /etc/systemd/system/docker.service.d + cat <<EOF | lxc file push - docker/etc/systemd/system/docker.service.d/https-proxy.conf +[Service] +Environment="HTTPS_PROXY=$https_proxy" +EOF +fi +if [ -n "${no_proxy:-}" ]; then + lxc exec docker -- mkdir -p /etc/systemd/system/docker.service.d + cat <<EOF | lxc file push - docker/etc/systemd/system/docker.service.d/no-proxy.conf +[Service] +Environment="NO_PROXY=$no_proxy" +EOF +fi + +attempts=0 +while ! lxc file pull docker/etc/resolv.conf - 2> /dev/null | grep -q ^nameserver; do + sleep 1 + attempts=$((attempts+1)) + if [ $attempts -gt 30 ]; then + echo "Network failed to come up after 30 seconds" + exit 1 + fi +done +if ! lxc file pull docker/etc/resolv.conf - 2> /dev/null | grep ^nameserver | grep -qv 127.0.0.53 +then + echo "systemd-resolved" + while ! lxc file pull docker/run/systemd/resolve/resolv.conf - 2> /dev/null | grep -v fe80 | grep -q ^nameserver; do + sleep 1 + attempts=$((attempts+1)) + if [ $attempts -gt 30 ]; then + echo "Network failed to come up after 30 seconds" + exit 1 + fi + done +fi + +lxc exec docker -- apt-get update +lxc exec docker -- apt-get install docker.io -y + +# Now basically run the simplest possible test inside the container. + +case ${arch} in + amd64) + image=hello-world;; + armhf|i386|s390x) + image=${arch}/hello-world;; + ppc64el) + image=ppc64le/hello-world;; + arm64) + image=aarch64/hello-world;; + *) + echo "unknown arch: ${arch}" + exit 2;; +esac + +lxc exec docker -- docker run ${image}
  99. Download patch debian/patches/skip-privileged-unit-tests.patch
  100. Download patch libnetwork/client/mflag/README.md

    --- 1.13.1~ds1-2/libnetwork/client/mflag/README.md 1970-01-01 00:00:00.000000000 +0000 +++ 1.13.1-0ubuntu4/libnetwork/client/mflag/README.md 2016-10-19 21:33:29.000000000 +0000 @@ -0,0 +1,40 @@ +Package mflag (aka multiple-flag) implements command-line flag parsing. +It's an **hacky** fork of the [official golang package](http://golang.org/pkg/flag/) + +It adds: + +* both short and long flag version +`./example -s red` `./example --string blue` + +* multiple names for the same option +``` +$>./example -h +Usage of example: + -s, --string="": a simple string +``` + +___ +It is very flexible on purpose, so you can do things like: +``` +$>./example -h +Usage of example: + -s, -string, --string="": a simple string +``` + +Or: +``` +$>./example -h +Usage of example: + -oldflag, --newflag="": a simple string +``` + +You can also hide some flags from the usage, so if we want only `--newflag`: +``` +$>./example -h +Usage of example: + --newflag="": a simple string +$>./example -oldflag str +str +``` + +See [example.go](example/example.go) for more details.
  101. ...

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: golang-1.7

golang-1.7 (1.7.4-2ubuntu1) zesty; urgency=medium * Merge from Debian unstable. Remaining changes: - Do not distribute un-built from source race detector runtime files and recommend golang-race-detector-runtime instead (see Debian bug #807455). - Build Go standard library into a shared library. - Patches (all backports from upstream tip) for problems with Go shared libraries: + d/patches/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch + d/patches/0002-runtime-resolve-type-offsets-using-source-module.patch + d/patches/0003-runtime-make-module-typemaps-visible-to-the-GC.patch + d/patches/0004-cmd-compile-mark-go.itab.-symbols-local-earlier.patch + d/patches/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Wed, 05 Apr 2017 13:13:40 +1200

Modifications :
  1. Download patch misc/cgo/testshared/src/exe/exe.go

    --- 1.7.4-2/misc/cgo/testshared/src/exe/exe.go 2016-12-01 21:16:26.000000000 +0000 +++ 1.7.4-2ubuntu1/misc/cgo/testshared/src/exe/exe.go 2017-04-05 11:38:59.000000000 +0000 @@ -2,11 +2,34 @@ package main import ( "depBase" + "os" + "reflect" "runtime" ) +// Having a function declared in the main package triggered +// golang.org/issue/18250 +func DeclaredInMain() { +} + +type C struct { +} + +func F() *C { + return nil +} + func main() { defer depBase.ImplementedInAsm() + // This code below causes various go.itab.* symbols to be generated in + // the executable. Similar code in ../depBase/dep.go results in + // exercising https://github.com/golang/go/issues/17594 + reflect.TypeOf(os.Stdout).Elem() runtime.GC() depBase.V = depBase.F() + 1 + + var c *C + if reflect.TypeOf(F).Out(0) != reflect.TypeOf(c) { + panic("bad reflection results, see golang.org/issue/18252") + } }
  2. Download patch debian/patches/0004-cmd-compile-mark-go.itab.-symbols-local-earlier.patch

    --- 1.7.4-2/debian/patches/0004-cmd-compile-mark-go.itab.-symbols-local-earlier.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/patches/0004-cmd-compile-mark-go.itab.-symbols-local-earlier.patch 2017-04-05 01:13:29.000000000 +0000 @@ -0,0 +1,34 @@ +From 9a28d18e5b6c3c342f2b49ee6b4564abbad3c6ef Mon Sep 17 00:00:00 2001 +From: Michael Hudson-Doyle <michael.hudson@canonical.com> +Date: Fri, 28 Oct 2016 15:08:28 +1300 +Subject: [PATCH 4/4] cmd/compile: mark go.itab.* symbols local earlier + +This feels a bit like a layering violation, but as the bug report shows +it is sometimes necessary. + +Fixes #17642 + +Change-Id: I4ba060bb1ce73a527ce276e5a769c44692b50016 +Reviewed-on: https://go-review.googlesource.com/32236 +Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> +TryBot-Result: Gobot Gobot <gobot@golang.org> +Reviewed-by: David Crawshaw <crawshaw@golang.org> +--- + src/cmd/compile/internal/gc/reflect.go | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go +index 4457c66..5ad65fb 100644 +--- a/src/cmd/compile/internal/gc/reflect.go ++++ b/src/cmd/compile/internal/gc/reflect.go +@@ -976,6 +976,7 @@ func itabname(t, itype *Type) *Node { + Fatalf("itabname %v", t) + } + s := Pkglookup(Tconv(t, FmtLeft)+","+Tconv(itype, FmtLeft), itabpkg) ++ Linksym(s).Local = true + if s.Def == nil { + n := newname(s) + n.Type = Types[TUINT8] +-- +2.7.4 +
  3. Download patch src/runtime/runtime2.go

    --- 1.7.4-2/src/runtime/runtime2.go 2016-12-01 21:16:28.000000000 +0000 +++ 1.7.4-2ubuntu1/src/runtime/runtime2.go 2017-04-05 11:38:59.000000000 +0000 @@ -619,7 +619,7 @@ type itab struct { _type *_type link *itab bad int32 - unused int32 + inhash int32 // has this itab been added to hash? fun [1]uintptr // variable sized }
  4. Download patch .pc/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch/src/cmd/compile/internal/gc/reflect.go
  5. Download patch .pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/src/runtime/iface.go
  6. Download patch debian/rules

    --- 1.7.4-2/debian/rules 2017-04-04 23:52:45.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/rules 2017-04-05 01:12:55.000000000 +0000 @@ -18,6 +18,10 @@ ifneq (,$(findstring nocheck,$(DEB_BUILD RUN_TESTS := false endif +shlib_archs = $(shell GOVER=$(GOVER) perl debian/helpers/getshlibarches.pl) + +multiarch := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + %: +dh --parallel $(opt_no_act) $@ @@ -47,7 +51,7 @@ override_dh_auto_clean: gencontrol override_dh_prep: dh_prep - @set -e; cd debian; for x in golang-X.Y-*; do \ + @set -e; cd debian; for x in *golang-X.Y-*; do \ sed -e 's/X.Y/$(GOVER)/g' $$x > golang-$(GOVER)-$${x##golang-X.Y-}; \ done @@ -80,7 +84,13 @@ override_dh_install-indep: dh_install --fail-missing override_dh_install-arch: + set -ex; \ + export PATH="$(GOROOT)/bin:$$PATH"; \ + $(CURDIR)/debian/helpers/installshlib.sh dh_install --fail-missing + # Remove .syso files of the race detector; they are binary files that + # are not built from source in the go source distribution. + find $(CURDIR)/debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/runtime/race -type f -name '*.syso' -delete # Remove Plan9 rc(1) scripts find debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src -type f -name '*.rc' -delete # Remove empty /usr/share/go-$(GOVER)/src from golang-$(GOVER)-go, it is provided by golang-$(GOVER)-src @@ -95,12 +105,21 @@ override_dh_strip: override_dh_shlibdeps: dh_shlibdeps -Xtestdata -Xtest +override_dh_makeshlibs: + LDIR=$(CURDIR)/debian/libgolang-$(GOVER)-std1/usr/lib/$(multiarch); \ + HASH=$$(LD_LIBRARY_PATH=$$LDIR:$$LD_LIBRARY_PATH $(CURDIR)/bin/readabihash $$LDIR/libgolang-$(GOVER)-std.so.1); \ + dh_makeshlibs -Vlibgolang-$(GOVER)-std1-$$HASH; \ + echo "golang:Provides=libgolang-$(GOVER)-std1-$$HASH" >> $(CURDIR)/debian/libgolang-$(GOVER)-std1.substvars + override_dh_auto_build-arch: [ -f VERSION ] || echo "debian snapshot +$$(dpkg-parsechangelog -SVersion)" > VERSION export GOROOT_BOOTSTRAP=$$(env -i go env GOROOT) \ && cd src \ && $(CURDIR)/debian/helpers/goenv.sh \ bash ./make.bash --no-banner + $(CURDIR)/bin/go install -v -buildmode=shared \ + -ldflags '-extldflags "-Wl,-soname=libgolang-$(GOVER)-std.so.1"' \ + std opt_no_act := ifneq (,$(findstring n,$(MAKEFLAGS)))
  7. Download patch .pc/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch/src/runtime/runtime2.go
  8. Download patch .pc/0003-runtime-make-module-typemaps-visible-to-the-GC.patch/src/runtime/type.go
  9. Download patch debian/control

    --- 1.7.4-2/debian/control 2017-04-04 23:54:58.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/control 2017-04-05 01:12:55.000000000 +0000 @@ -5,7 +5,8 @@ Source: golang-1.7 Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -24,7 +25,11 @@ Depends: golang-1.7-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-1.7-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more @@ -96,3 +101,25 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: libgolang-1.7-std1 +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Provides: ${golang:Provides} +Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} +Description: Go standard shared library + This package contains the Go standard library built as a shared library. + Packages should not depend on this package directly but rather the ABI-stamped + value in Provides:. dpkg-shlibdeps will do this automatically. + +Package: golang-1.7-go-shared-dev +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Depends: golang-1.7-go (= ${binary:Version}), + libgolang-1.7-std1 (= ${binary:Version}), + ${misc:Depends}, + ${perl:Depends}, + ${shlibs:Depends} +Description: Go standard shared library support files + This package contains the files necessary to link against the shared + library packaged in libgolang-1.7-std1.
  10. Download patch .pc/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch/misc/cgo/testshared/src/exe/exe.go

    --- 1.7.4-2/.pc/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch/misc/cgo/testshared/src/exe/exe.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/.pc/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch/misc/cgo/testshared/src/exe/exe.go 2017-04-05 11:38:59.000000000 +0000 @@ -0,0 +1,18 @@ +package main + +import ( + "depBase" + "os" + "reflect" + "runtime" +) + +func main() { + defer depBase.ImplementedInAsm() + // This code below causes various go.itab.* symbols to be generated in + // the executable. Similar code in ../depBase/dep.go results in + // exercising https://github.com/golang/go/issues/17594 + reflect.TypeOf(os.Stdout).Elem() + runtime.GC() + depBase.V = depBase.F() + 1 +}
  11. Download patch misc/cgo/testshared/src/depBase/dep.go

    --- 1.7.4-2/misc/cgo/testshared/src/depBase/dep.go 2016-12-01 21:16:26.000000000 +0000 +++ 1.7.4-2ubuntu1/misc/cgo/testshared/src/depBase/dep.go 2017-04-05 11:38:59.000000000 +0000 @@ -1,5 +1,10 @@ package depBase +import ( + "os" + "reflect" +) + var V int = 1 var HasMask []string = []string{"hi"} @@ -13,6 +18,10 @@ type Dep struct { } func (d *Dep) Method() int { + // This code below causes various go.itab.* symbols to be generated in + // the shared library. Similar code in ../exe/exe.go results in + // exercising https://github.com/golang/go/issues/17594 + reflect.TypeOf(os.Stdout).Elem() return 10 }
  12. Download patch debian/libgolang-X.Y-std1.lintian-overrides

    --- 1.7.4-2/debian/libgolang-X.Y-std1.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/libgolang-X.Y-std1.lintian-overrides 2017-04-05 01:12:55.000000000 +0000 @@ -0,0 +1,3 @@ +# Go shared libraries are not linked by the system linker so +# the .so symlinks are not where lintian expects. +libgolang-std1: dev-pkg-without-shlib-symlink
  13. Download patch debian/control.in

    --- 1.7.4-2/debian/control.in 2017-04-04 23:52:45.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/control.in 2017-04-05 01:12:55.000000000 +0000 @@ -1,7 +1,8 @@ Source: golang-X.Y Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -20,7 +21,11 @@ Depends: golang-X.Y-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-X.Y-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more @@ -92,3 +97,25 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: libgolang-X.Y-std1 +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Provides: ${golang:Provides} +Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} +Description: Go standard shared library + This package contains the Go standard library built as a shared library. + Packages should not depend on this package directly but rather the ABI-stamped + value in Provides:. dpkg-shlibdeps will do this automatically. + +Package: golang-X.Y-go-shared-dev +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Depends: golang-X.Y-go (= ${binary:Version}), + libgolang-X.Y-std1 (= ${binary:Version}), + ${misc:Depends}, + ${perl:Depends}, + ${shlibs:Depends} +Description: Go standard shared library support files + This package contains the files necessary to link against the shared + library packaged in libgolang-X.Y-std1.
  14. Download patch .pc/applied-patches

    --- 1.7.4-2/.pc/applied-patches 2017-04-05 11:38:58.113753608 +0000 +++ 1.7.4-2ubuntu1/.pc/applied-patches 2017-04-05 11:38:59.125781348 +0000 @@ -1,2 +1,7 @@ cl-29995--tzdata-2016g.patch cl-37964--tzdata-2017a.patch +0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch +0002-runtime-resolve-type-offsets-using-source-module.patch +0003-runtime-make-module-typemaps-visible-to-the-GC.patch +0004-cmd-compile-mark-go.itab.-symbols-local-earlier.patch +0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch
  15. Download patch .pc/0003-runtime-make-module-typemaps-visible-to-the-GC.patch/src/runtime/symtab.go
  16. Download patch .pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/src/cmd/compile/internal/gc/reflect.go
  17. Download patch src/cmd/compile/internal/gc/reflect.go

    --- 1.7.4-2/src/cmd/compile/internal/gc/reflect.go 2016-12-01 21:16:26.000000000 +0000 +++ 1.7.4-2ubuntu1/src/cmd/compile/internal/gc/reflect.go 2017-04-05 11:38:59.000000000 +0000 @@ -1385,7 +1385,7 @@ func dumptypestructs() { // } o := dsymptr(i.sym, 0, dtypesym(i.itype), 0) o = dsymptr(i.sym, o, dtypesym(i.t), 0) - o += Widthptr + 8 // skip link/bad/unused fields + o += Widthptr + 8 // skip link/bad/inhash fields o += len(imethods(i.itype)) * Widthptr // skip fun method pointers // at runtime the itab will contain pointers to types, other itabs and // method functions. None are allocated on heap, so we can use obj.NOPTR.
  18. Download patch debian/patches/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch

    --- 1.7.4-2/debian/patches/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/patches/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch 2017-04-05 01:13:30.000000000 +0000 @@ -0,0 +1,141 @@ +From b6c826a037d3e16d68cd5732717971b72a8344d1 Mon Sep 17 00:00:00 2001 +From: Michael Hudson-Doyle <michael.hudson@canonical.com> +Date: Mon, 12 Dec 2016 13:31:56 +1300 +Subject: [PATCH 5/5] cmd/compile, runtime: a different approach to duplicate + itabs + +golang.org/issue/17594 was caused by additab being called more than once for +an itab. golang.org/cl/32131 fixed that by making the itabs local symbols, +but that in turn causes golang.org/issue/18252 because now there are now +multiple itab symbols in a process for a given (type,interface) pair and +different code paths can end up referring to different itabs which breaks +lots of reflection stuff. So this makes itabs global again and just takes +care to only call additab once for each itab. + +Fixes #18252 + +Change-Id: I781a193e2f8dd80af145a3a971f6a25537f633ea +Reviewed-on: https://go-review.googlesource.com/34173 +Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> +TryBot-Result: Gobot Gobot <gobot@golang.org> +Reviewed-by: David Crawshaw <crawshaw@golang.org> +--- + misc/cgo/testshared/src/exe/exe.go | 17 +++++++++++++++++ + src/cmd/compile/internal/gc/reflect.go | 7 +++---- + src/runtime/iface.go | 14 +++++++++----- + src/runtime/runtime2.go | 2 +- + 4 files changed, 30 insertions(+), 10 deletions(-) + +diff --git a/misc/cgo/testshared/src/exe/exe.go b/misc/cgo/testshared/src/exe/exe.go +index 31fbedd..4337271 100644 +--- a/misc/cgo/testshared/src/exe/exe.go ++++ b/misc/cgo/testshared/src/exe/exe.go +@@ -7,6 +7,18 @@ import ( + "runtime" + ) + ++// Having a function declared in the main package triggered ++// golang.org/issue/18250 ++func DeclaredInMain() { ++} ++ ++type C struct { ++} ++ ++func F() *C { ++ return nil ++} ++ + func main() { + defer depBase.ImplementedInAsm() + // This code below causes various go.itab.* symbols to be generated in +@@ -15,4 +27,9 @@ func main() { + reflect.TypeOf(os.Stdout).Elem() + runtime.GC() + depBase.V = depBase.F() + 1 ++ ++ var c *C ++ if reflect.TypeOf(F).Out(0) != reflect.TypeOf(c) { ++ panic("bad reflection results, see golang.org/issue/18252") ++ } + } +diff --git a/src/cmd/compile/internal/gc/reflect.go b/src/cmd/compile/internal/gc/reflect.go +index 5ad65fb..6267a13 100644 +--- a/src/cmd/compile/internal/gc/reflect.go ++++ b/src/cmd/compile/internal/gc/reflect.go +@@ -976,7 +976,6 @@ func itabname(t, itype *Type) *Node { + Fatalf("itabname %v", t) + } + s := Pkglookup(Tconv(t, FmtLeft)+","+Tconv(itype, FmtLeft), itabpkg) +- Linksym(s).Local = true + if s.Def == nil { + n := newname(s) + n.Type = Types[TUINT8] +@@ -1386,15 +1385,15 @@ func dumptypestructs() { + // } + o := dsymptr(i.sym, 0, dtypesym(i.itype), 0) + o = dsymptr(i.sym, o, dtypesym(i.t), 0) +- o += Widthptr + 8 // skip link/bad/unused fields ++ o += Widthptr + 8 // skip link/bad/inhash fields + o += len(imethods(i.itype)) * Widthptr // skip fun method pointers + // at runtime the itab will contain pointers to types, other itabs and + // method functions. None are allocated on heap, so we can use obj.NOPTR. +- ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR|obj.LOCAL)) ++ ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR)) + + ilink := Pkglookup(Tconv(i.t, FmtLeft)+","+Tconv(i.itype, FmtLeft), itablinkpkg) + dsymptr(ilink, 0, i.sym, 0) +- ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA|obj.LOCAL)) ++ ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA)) + } + + // generate import strings for imported packages +diff --git a/src/runtime/iface.go b/src/runtime/iface.go +index ff977bb..c6ab5a1 100644 +--- a/src/runtime/iface.go ++++ b/src/runtime/iface.go +@@ -138,11 +138,8 @@ func additab(m *itab, locked, canfail bool) { + throw("invalid itab locking") + } + h := itabhash(inter, typ) +- if m == hash[h] { +- println("duplicate itab for", typ.string(), "and", inter.typ.string()) +- throw("duplicate itabs") +- } + m.link = hash[h] ++ m.inhash = 1 + atomicstorep(unsafe.Pointer(&hash[h]), unsafe.Pointer(m)) + } + +@@ -150,7 +147,14 @@ func itabsinit() { + lock(&ifaceLock) + for m := &firstmoduledata; m != nil; m = m.next { + for _, i := range m.itablinks { +- additab(i, true, false) ++ // itablinks is a slice of pointers to the itabs used in this ++ // module. A given itab may be used in more than one module ++ // and thanks to the way global symbol resolution works, the ++ // pointed-to itab may already have been inserted into the ++ // global 'hash'. ++ if i.inhash == 0 { ++ additab(i, true, false) ++ } + } + } + unlock(&ifaceLock) +diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go +index 6119e75..a3d062d 100644 +--- a/src/runtime/runtime2.go ++++ b/src/runtime/runtime2.go +@@ -619,7 +619,7 @@ type itab struct { + _type *_type + link *itab + bad int32 +- unused int32 ++ inhash int32 // has this itab been added to hash? + fun [1]uintptr // variable sized + } + +-- +2.7.4 +
  19. Download patch .pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/misc/cgo/testshared/src/depBase/dep.go

    --- 1.7.4-2/.pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/misc/cgo/testshared/src/depBase/dep.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/.pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/misc/cgo/testshared/src/depBase/dep.go 2016-12-01 21:16:26.000000000 +0000 @@ -0,0 +1,22 @@ +package depBase + +var V int = 1 + +var HasMask []string = []string{"hi"} + +type HasProg struct { + array [1024]*byte +} + +type Dep struct { + X int +} + +func (d *Dep) Method() int { + return 10 +} + +func F() int { + defer func() {}() + return V +}
  20. Download patch debian/patches/series

    --- 1.7.4-2/debian/patches/series 2017-04-04 23:52:52.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/patches/series 2017-04-05 01:13:30.000000000 +0000 @@ -1,2 +1,7 @@ cl-29995--tzdata-2016g.patch cl-37964--tzdata-2017a.patch +0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch +0002-runtime-resolve-type-offsets-using-source-module.patch +0003-runtime-make-module-typemaps-visible-to-the-GC.patch +0004-cmd-compile-mark-go.itab.-symbols-local-earlier.patch +0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch
  21. Download patch .pc/0002-runtime-resolve-type-offsets-using-source-module.patch/src/runtime/type.go
  22. Download patch .pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/misc/cgo/testshared/src/exe/exe.go

    --- 1.7.4-2/.pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/misc/cgo/testshared/src/exe/exe.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/.pc/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch/misc/cgo/testshared/src/exe/exe.go 2016-12-01 21:16:26.000000000 +0000 @@ -0,0 +1,12 @@ +package main + +import ( + "depBase" + "runtime" +) + +func main() { + defer depBase.ImplementedInAsm() + runtime.GC() + depBase.V = depBase.F() + 1 +}
  23. Download patch debian/patches/0002-runtime-resolve-type-offsets-using-source-module.patch

    --- 1.7.4-2/debian/patches/0002-runtime-resolve-type-offsets-using-source-module.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/patches/0002-runtime-resolve-type-offsets-using-source-module.patch 2017-04-05 01:13:29.000000000 +0000 @@ -0,0 +1,86 @@ +From 34c480afa89a4efa917f30592d8c095dbaf7612e Mon Sep 17 00:00:00 2001 +From: David Crawshaw <crawshaw@golang.org> +Date: Tue, 1 Nov 2016 15:28:55 -0400 +Subject: [PATCH] runtime: resolve type offsets using source module + +The runtime.typeEquals function is used during typelinksinit to +determine the canonical set of *_type values to use throughout the +runtime. As such, it is run against non-canonical *_type values, that +is, types from modules that are duplicates of a type from another +module that was loaded earlier in the program life. + +These non-canonical *_type values sometimes contain pointers. These +pointers are pointing to position-independent data, and so they are set +by ld.so using dynamic relocations when the module is loaded. As such, +the pointer can point to the equivalent memory from a previous module. + +This means if typesEqual follows a pointer inside a *_type, it can end +up at a piece of memory from another module. If it reads a typeOff or +nameOff from that memory and attempts to resolve it against the +non-canonical *_type from the later module, it will end up with a +reference to junk memory. + +Instead, resolve against the pointer the offset was read from, so the +data is valid. + +Fixes #17709. +Should no longer matter after #17724 is resolved in a later Go. + +Change-Id: Ie88b151a3407d82ac030a97b5b6a19fc781901cb +Reviewed-on: https://go-review.googlesource.com/32513 +Run-TryBot: David Crawshaw <crawshaw@golang.org> +Reviewed-by: Keith Randall <khr@golang.org> +--- + src/runtime/type.go | 18 +++++++++++++----- + 1 file changed, 13 insertions(+), 5 deletions(-) + +--- a/src/runtime/type.go ++++ b/src/runtime/type.go +@@ -199,11 +199,11 @@ + return resolveNameOff(unsafe.Pointer(t), off) + } + +-func (t *_type) typeOff(off typeOff) *_type { ++func resolveTypeOff(ptrInModule unsafe.Pointer, off typeOff) *_type { + if off == 0 { + return nil + } +- base := uintptr(unsafe.Pointer(t)) ++ base := uintptr(ptrInModule) + var md *moduledata + for next := &firstmoduledata; next != nil; next = next.next { + if base >= next.types && base < next.etypes { +@@ -235,6 +235,10 @@ + return (*_type)(unsafe.Pointer(res)) + } + ++func (t *_type) typeOff(off typeOff) *_type { ++ return resolveTypeOff(unsafe.Pointer(t), off) ++} ++ + func (t *_type) textOff(off textOff) unsafe.Pointer { + base := uintptr(unsafe.Pointer(t)) + var md *moduledata +@@ -573,15 +577,19 @@ + for i := range it.mhdr { + tm := &it.mhdr[i] + vm := &iv.mhdr[i] +- tname := it.typ.nameOff(tm.name) +- vname := iv.typ.nameOff(vm.name) ++ // Note the mhdr array can be relocated from ++ // another module. See #17724. ++ tname := resolveNameOff(unsafe.Pointer(tm), tm.name) ++ vname := resolveNameOff(unsafe.Pointer(vm), vm.name) + if tname.name() != vname.name() { + return false + } + if tname.pkgPath() != vname.pkgPath() { + return false + } +- if !typesEqual(it.typ.typeOff(tm.ityp), iv.typ.typeOff(vm.ityp)) { ++ tityp := resolveTypeOff(unsafe.Pointer(tm), tm.ityp) ++ vityp := resolveTypeOff(unsafe.Pointer(vm), vm.ityp) ++ if !typesEqual(tityp, vityp) { + return false + } + }
  24. Download patch debian/gbp.conf.in

    --- 1.7.4-2/debian/gbp.conf.in 2017-04-04 23:52:45.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/gbp.conf.in 2017-04-05 01:13:29.000000000 +0000 @@ -1,5 +1,5 @@ [DEFAULT] -debian-branch = golang-X.Y +debian-branch = ubuntu-X.Y debian-tag = debian/%(version)s upstream-branch = upstream-X.Y upstream-tag = upstream/%(version)s
  25. Download patch debian/patches/0003-runtime-make-module-typemaps-visible-to-the-GC.patch

    --- 1.7.4-2/debian/patches/0003-runtime-make-module-typemaps-visible-to-the-GC.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/patches/0003-runtime-make-module-typemaps-visible-to-the-GC.patch 2017-04-05 01:13:29.000000000 +0000 @@ -0,0 +1,64 @@ +From 0bd8d2b00cf42a8bf89fdbc71e1dc4bbab9d53d8 Mon Sep 17 00:00:00 2001 +From: David Crawshaw <crawshaw@golang.org> +Date: Sun, 30 Oct 2016 21:19:59 -0400 +Subject: [PATCH 3/4] runtime: make module typemaps visible to the GC + +The map[typeOff]*_type object is created at run time and stored in +the moduledata. The moduledata object is marked by the linker as +SNOPTRDATA, so the reference is ignored by the GC. Running +misc/cgo/testplugin/test.bash with GOGC=1 will eventually collect +the typemap and crash. + +This bug probably comes up in -linkshared binaries in Go 1.7. +I don't know why we haven't seen a report about this yet. + +Fixes #17680 + +Change-Id: I0e9b5c006010e8edd51d9471651620ba665248d3 +Reviewed-on: https://go-review.googlesource.com/32430 +TryBot-Result: Gobot Gobot <gobot@golang.org> +Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com> +Reviewed-by: Ian Lance Taylor <iant@golang.org> +--- + src/runtime/symtab.go | 9 +++++++++ + src/runtime/type.go | 4 +++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/runtime/symtab.go b/src/runtime/symtab.go +index 4f6fae2..022e33b 100644 +--- a/src/runtime/symtab.go ++++ b/src/runtime/symtab.go +@@ -218,6 +218,15 @@ type modulehash struct { + runtimehash *string + } + ++// pinnedTypemaps are the map[typeOff]*_type from the moduledata objects. ++// ++// These typemap objects are allocated at run time on the heap, but the ++// only direct reference to them is in the moduledata, created by the ++// linker and marked SNOPTRDATA so it is ignored by the GC. ++// ++// To make sure the map isn't collected, we keep a second reference here. ++var pinnedTypemaps []map[typeOff]*_type ++ + var firstmoduledata moduledata // linker symbol + var lastmoduledatap *moduledata // linker symbol + +diff --git a/src/runtime/type.go b/src/runtime/type.go +index b54483b..fd100a7 100644 +--- a/src/runtime/type.go ++++ b/src/runtime/type.go +@@ -481,7 +481,9 @@ func typelinksinit() { + // prior module, prefer that prior type by adding the offset + // to this module's typemap. + md := modules[len(modules)-1] +- md.typemap = make(map[typeOff]*_type, len(md.typelinks)) ++ tm := make(map[typeOff]*_type, len(md.typelinks)) ++ pinnedTypemaps = append(pinnedTypemaps, tm) ++ md.typemap = tm + for _, tl := range md.typelinks { + t := (*_type)(unsafe.Pointer(md.types + uintptr(tl))) + for _, candidate := range typehash[t.hash] { +-- +2.7.4 +
  26. Download patch .pc/0004-cmd-compile-mark-go.itab.-symbols-local-earlier.patch/src/cmd/compile/internal/gc/reflect.go
  27. Download patch debian/helpers/readabihash.go

    --- 1.7.4-2/debian/helpers/readabihash.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/helpers/readabihash.go 2017-04-05 01:12:55.000000000 +0000 @@ -0,0 +1,85 @@ +package main + +import ( + "debug/elf" + "encoding/binary" + "fmt" + "io" + "log" + "os" +) + +func rnd(v int32, r int32) int32 { + if r <= 0 { + return v + } + v += r - 1 + c := v % r + if c < 0 { + c += r + } + v -= c + return v +} + +func readwithpad(r io.Reader, sz int32) ([]byte, error) { + full := rnd(sz, 4) + data := make([]byte, full) + _, err := r.Read(data) + if err != nil { + return nil, err + } + data = data[:sz] + return data, nil +} + +func readnote(filename, name string, type_ int32) ([]byte, error) { + f, err := elf.Open(filename) + if err != nil { + return nil, err + } + for _, sect := range f.Sections { + if sect.Type != elf.SHT_NOTE { + continue + } + r := sect.Open() + for { + var namesize, descsize, nt_type int32 + err = binary.Read(r, f.ByteOrder, &namesize) + if err != nil { + if err == io.EOF { + break + } + return nil, fmt.Errorf("read namesize failed", err) + } + err = binary.Read(r, f.ByteOrder, &descsize) + if err != nil { + return nil, fmt.Errorf("read descsize failed", err) + } + err = binary.Read(r, f.ByteOrder, &nt_type) + if err != nil { + return nil, fmt.Errorf("read type failed", err) + } + nt_name, err := readwithpad(r, namesize) + if err != nil { + return nil, fmt.Errorf("read name failed", err) + } + desc, err := readwithpad(r, descsize) + if err != nil { + return nil, fmt.Errorf("read desc failed", err) + } + if name == string(nt_name) && type_ == nt_type { + return desc, nil + } + } + } + return nil, nil +} + +func main() { + desc, err := readnote(os.Args[1], "Go\x00\x00", 2) + if err != nil { + log.Fatalf("readnote failed: %v", err) + } + fmt.Printf("%x\n", desc) +}
  28. Download patch debian/helpers/installshlib.sh

    --- 1.7.4-2/debian/helpers/installshlib.sh 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/helpers/installshlib.sh 2017-04-05 01:12:55.000000000 +0000 @@ -0,0 +1,17 @@ +#!/bin/bash +set -eux +GOARCH=$(./bin/go env GOARCH) + +./bin/go build -o ./bin/readabihash -linkshared -ldflags="-r ''" debian/helpers/readabihash.go + +TRIPLET=$(dpkg-architecture -qDEB_HOST_MULTIARCH) + +mkdir -p debian/libgolang-${GOVER}-std1/usr/lib/${TRIPLET} +mv pkg/linux_${GOARCH}_dynlink/libstd.so debian/libgolang-${GOVER}-std1/usr/lib/${TRIPLET}/libgolang-${GOVER}-std.so.1 + +ln -s ../../../${TRIPLET}/libgolang-${GOVER}-std.so.1 pkg/linux_${GOARCH}_dynlink/libstd.so + +mkdir -p debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/ +mv pkg/linux_${GOARCH}_dynlink/ debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/ + +cp bin/readabihash debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/
  29. Download patch debian/gbp.conf

    --- 1.7.4-2/debian/gbp.conf 2017-04-04 23:54:58.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/gbp.conf 2017-04-05 01:13:29.000000000 +0000 @@ -3,7 +3,7 @@ # [DEFAULT] -debian-branch = golang-1.7 +debian-branch = ubuntu-1.7 debian-tag = debian/%(version)s upstream-branch = upstream-1.7 upstream-tag = upstream/%(version)s
  30. Download patch src/runtime/iface.go

    --- 1.7.4-2/src/runtime/iface.go 2016-12-01 21:16:28.000000000 +0000 +++ 1.7.4-2ubuntu1/src/runtime/iface.go 2017-04-05 11:38:59.000000000 +0000 @@ -139,6 +139,7 @@ func additab(m *itab, locked, canfail bo } h := itabhash(inter, typ) m.link = hash[h] + m.inhash = 1 atomicstorep(unsafe.Pointer(&hash[h]), unsafe.Pointer(m)) } @@ -146,7 +147,14 @@ func itabsinit() { lock(&ifaceLock) for m := &firstmoduledata; m != nil; m = m.next { for _, i := range m.itablinks { - additab(i, true, false) + // itablinks is a slice of pointers to the itabs used in this + // module. A given itab may be used in more than one module + // and thanks to the way global symbol resolution works, the + // pointed-to itab may already have been inserted into the + // global 'hash'. + if i.inhash == 0 { + additab(i, true, false) + } } } unlock(&ifaceLock)
  31. Download patch debian/patches/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch

    --- 1.7.4-2/debian/patches/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.7.4-2ubuntu1/debian/patches/0001-cmd-compile-runtime-make-the-go.itab.-symbols-module.patch 2017-04-05 01:12:55.000000000 +0000 @@ -0,0 +1,85 @@ +Description: cmd/compile, runtime: make the go.itab.* symbols module-local + Otherwise, the way the ELF dynamic linker works means that you can end up with + the same itab being passed to additab twice, leading to the itab linked list + having a cycle in it. Add a test to additab in runtime to catch this when it + happens, not some arbitrary and surprsing time later. + . + Fixes #17594 +Author: Michael Hudson-Doyle <michael.hudson@ubuntu.com> +Origin: https://go.googlesource.com/go/+/8b07ec20f7a971edce9eaf413b20e453c50858c6 +Bug: https://github.com/golang/go/issues/17594 +Last-Update: 2016-10-28 + +--- a/misc/cgo/testshared/src/depBase/dep.go ++++ b/misc/cgo/testshared/src/depBase/dep.go +@@ -1,5 +1,10 @@ + package depBase + ++import ( ++ "os" ++ "reflect" ++) ++ + var V int = 1 + + var HasMask []string = []string{"hi"} +@@ -13,6 +18,10 @@ + } + + func (d *Dep) Method() int { ++ // This code below causes various go.itab.* symbols to be generated in ++ // the shared library. Similar code in ../exe/exe.go results in ++ // exercising https://github.com/golang/go/issues/17594 ++ reflect.TypeOf(os.Stdout).Elem() + return 10 + } + +--- a/misc/cgo/testshared/src/exe/exe.go ++++ b/misc/cgo/testshared/src/exe/exe.go +@@ -2,11 +2,17 @@ + + import ( + "depBase" ++ "os" ++ "reflect" + "runtime" + ) + + func main() { + defer depBase.ImplementedInAsm() ++ // This code below causes various go.itab.* symbols to be generated in ++ // the executable. Similar code in ../depBase/dep.go results in ++ // exercising https://github.com/golang/go/issues/17594 ++ reflect.TypeOf(os.Stdout).Elem() + runtime.GC() + depBase.V = depBase.F() + 1 + } +--- a/src/cmd/compile/internal/gc/reflect.go ++++ b/src/cmd/compile/internal/gc/reflect.go +@@ -1389,11 +1389,11 @@ + o += len(imethods(i.itype)) * Widthptr // skip fun method pointers + // at runtime the itab will contain pointers to types, other itabs and + // method functions. None are allocated on heap, so we can use obj.NOPTR. +- ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR)) ++ ggloblsym(i.sym, int32(o), int16(obj.DUPOK|obj.NOPTR|obj.LOCAL)) + + ilink := Pkglookup(Tconv(i.t, FmtLeft)+","+Tconv(i.itype, FmtLeft), itablinkpkg) + dsymptr(ilink, 0, i.sym, 0) +- ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA)) ++ ggloblsym(ilink, int32(Widthptr), int16(obj.DUPOK|obj.RODATA|obj.LOCAL)) + } + + // generate import strings for imported packages +--- a/src/runtime/iface.go ++++ b/src/runtime/iface.go +@@ -138,6 +138,10 @@ + throw("invalid itab locking") + } + h := itabhash(inter, typ) ++ if m == hash[h] { ++ println("duplicate itab for", typ.string(), "and", inter.typ.string()) ++ throw("duplicate itabs") ++ } + m.link = hash[h] + atomicstorep(unsafe.Pointer(&hash[h]), unsafe.Pointer(m)) + }
  32. Download patch src/runtime/type.go

    --- 1.7.4-2/src/runtime/type.go 2016-12-01 21:16:28.000000000 +0000 +++ 1.7.4-2ubuntu1/src/runtime/type.go 2017-04-05 11:38:59.000000000 +0000 @@ -199,11 +199,11 @@ func (t *_type) nameOff(off nameOff) nam return resolveNameOff(unsafe.Pointer(t), off) } -func (t *_type) typeOff(off typeOff) *_type { +func resolveTypeOff(ptrInModule unsafe.Pointer, off typeOff) *_type { if off == 0 { return nil } - base := uintptr(unsafe.Pointer(t)) + base := uintptr(ptrInModule) var md *moduledata for next := &firstmoduledata; next != nil; next = next.next { if base >= next.types && base < next.etypes { @@ -235,6 +235,10 @@ func (t *_type) typeOff(off typeOff) *_t return (*_type)(unsafe.Pointer(res)) } +func (t *_type) typeOff(off typeOff) *_type { + return resolveTypeOff(unsafe.Pointer(t), off) +} + func (t *_type) textOff(off textOff) unsafe.Pointer { base := uintptr(unsafe.Pointer(t)) var md *moduledata @@ -477,7 +481,9 @@ func typelinksinit() { // prior module, prefer that prior type by adding the offset // to this module's typemap. md := modules[len(modules)-1] - md.typemap = make(map[typeOff]*_type, len(md.typelinks)) + tm := make(map[typeOff]*_type, len(md.typelinks)) + pinnedTypemaps = append(pinnedTypemaps, tm) + md.typemap = tm for _, tl := range md.typelinks { t := (*_type)(unsafe.Pointer(md.types + uintptr(tl))) for _, candidate := range typehash[t.hash] { @@ -573,15 +579,19 @@ func typesEqual(t, v *_type) bool { for i := range it.mhdr { tm := &it.mhdr[i] vm := &iv.mhdr[i] - tname := it.typ.nameOff(tm.name) - vname := iv.typ.nameOff(vm.name) + // Note the mhdr array can be relocated from + // another module. See #17724. + tname := resolveNameOff(unsafe.Pointer(tm), tm.name) + vname := resolveNameOff(unsafe.Pointer(vm), vm.name) if tname.name() != vname.name() { return false } if tname.pkgPath() != vname.pkgPath() { return false } - if !typesEqual(it.typ.typeOff(tm.ityp), iv.typ.typeOff(vm.ityp)) { + tityp := resolveTypeOff(unsafe.Pointer(tm), tm.ityp) + vityp := resolveTypeOff(unsafe.Pointer(vm), vm.ityp) + if !typesEqual(tityp, vityp) { return false } }
  33. Download patch .pc/0005-cmd-compile-runtime-a-different-approach-to-duplicat.patch/src/runtime/iface.go
  34. Download patch src/runtime/symtab.go

    --- 1.7.4-2/src/runtime/symtab.go 2016-12-01 21:16:28.000000000 +0000 +++ 1.7.4-2ubuntu1/src/runtime/symtab.go 2017-04-05 11:38:59.000000000 +0000 @@ -218,6 +218,15 @@ type modulehash struct { runtimehash *string } +// pinnedTypemaps are the map[typeOff]*_type from the moduledata objects. +// +// These typemap objects are allocated at run time on the heap, but the +// only direct reference to them is in the moduledata, created by the +// linker and marked SNOPTRDATA so it is ignored by the GC. +// +// To make sure the map isn't collected, we keep a second reference here. +var pinnedTypemaps []map[typeOff]*_type + var firstmoduledata moduledata // linker symbol var lastmoduledatap *moduledata // linker symbol

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: golang-1.8

golang-1.8 (1.8.3-2ubuntu1) artful; urgency=medium * Merge from Debian unstable. Remaining changes: - Do not distribute un-built from source race detector runtime files and recommend golang-race-detector-runtime instead (see Debian bug #807455). - Build Go standard library into a shared library. - Backport d/patches/cl-40401--more-robust-ABI-hash.patch from upstream to make the ABIs of shared libraries slightly more robust. - Backport d/patches/i386-shlib-fix.patch from upstream to fix a problem with shared libraries on i386. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 15 Aug 2017 13:03:20 +1200

Modifications :
  1. Download patch .pc/cl-40401--more-robust-ABI-hash.patch/misc/cgo/testshared/shared_test.go
  2. Download patch src/cmd/internal/obj/x86/obj6.go

    --- 1.8.3-2/src/cmd/internal/obj/x86/obj6.go 2017-05-24 18:15:12.000000000 +0000 +++ 1.8.3-2ubuntu1/src/cmd/internal/obj/x86/obj6.go 2017-08-24 00:11:44.000000000 +0000 @@ -322,15 +322,13 @@ func progedit(ctxt *obj.Link, p *obj.Pro // Rewrite p, if necessary, to access global data via the global offset table. func rewriteToUseGot(ctxt *obj.Link, p *obj.Prog) { - var add, lea, mov obj.As + var lea, mov obj.As var reg int16 if p.Mode == 64 { - add = AADDQ lea = ALEAQ mov = AMOVQ reg = REG_R15 } else { - add = AADDL lea = ALEAL mov = AMOVL reg = REG_CX @@ -347,8 +345,10 @@ func rewriteToUseGot(ctxt *obj.Link, p * // ADUFFxxx $offset // becomes // $MOV runtime.duffxxx@GOT, $reg - // $ADD $offset, $reg + // $LEA $offset($reg), $reg // CALL $reg + // (we use LEAx rather than ADDx because ADDx clobbers + // flags and duffzero on 386 does not otherwise do so) var sym *obj.LSym if p.As == obj.ADUFFZERO { sym = obj.Linklookup(ctxt, "runtime.duffzero", 0) @@ -365,9 +365,10 @@ func rewriteToUseGot(ctxt *obj.Link, p * p.To.Offset = 0 p.To.Sym = nil p1 := obj.Appendp(ctxt, p) - p1.As = add - p1.From.Type = obj.TYPE_CONST + p1.As = lea + p1.From.Type = obj.TYPE_MEM p1.From.Offset = offset + p1.From.Reg = reg p1.To.Type = obj.TYPE_REG p1.To.Reg = reg p2 := obj.Appendp(ctxt, p1)
  3. Download patch debian/rules

    --- 1.8.3-2/debian/rules 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/rules 2017-08-15 01:01:11.000000000 +0000 @@ -18,6 +18,10 @@ ifneq (,$(findstring nocheck,$(DEB_BUILD RUN_TESTS := false endif +shlib_archs = $(shell GOVER=$(GOVER) perl debian/helpers/getshlibarches.pl) + +multiarch := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) + %: +dh --parallel $(opt_no_act) $@ @@ -47,7 +51,7 @@ override_dh_auto_clean: gencontrol override_dh_prep: dh_prep - @set -e; cd debian; for x in golang-X.Y-*; do \ + @set -e; cd debian; for x in *golang-X.Y-*; do \ sed -e 's/X.Y/$(GOVER)/g' $$x > golang-$(GOVER)-$${x##golang-X.Y-}; \ done @@ -80,7 +84,13 @@ override_dh_install-indep: dh_install --fail-missing override_dh_install-arch: + set -ex; \ + export PATH="$(GOROOT)/bin:$$PATH"; \ + $(CURDIR)/debian/helpers/installshlib.sh dh_install --fail-missing + # Remove .syso files of the race detector; they are binary files that + # are not built from source in the go source distribution. + find $(CURDIR)/debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/runtime/race -type f -name '*.syso' -delete # Remove Plan9 rc(1) scripts find debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src -type f -name '*.rc' -delete # Remove empty /usr/share/go-$(GOVER)/src from golang-$(GOVER)-go, it is provided by golang-$(GOVER)-src @@ -95,12 +105,21 @@ override_dh_strip: override_dh_shlibdeps: dh_shlibdeps -Xtestdata -Xtest +override_dh_makeshlibs: + LDIR=$(CURDIR)/debian/libgolang-$(GOVER)-std1/usr/lib/$(multiarch); \ + HASH=$$(LD_LIBRARY_PATH=$$LDIR:$$LD_LIBRARY_PATH $(CURDIR)/bin/readabihash $$LDIR/libgolang-$(GOVER)-std.so.1); \ + dh_makeshlibs -Vlibgolang-$(GOVER)-std1-$$HASH; \ + echo "golang:Provides=libgolang-$(GOVER)-std1-$$HASH" >> $(CURDIR)/debian/libgolang-$(GOVER)-std1.substvars + override_dh_auto_build-arch: [ -f VERSION ] || echo "debian snapshot +$$(dpkg-parsechangelog -SVersion)" > VERSION export GOROOT_BOOTSTRAP=$$(env -i go env GOROOT) \ && cd src \ && $(CURDIR)/debian/helpers/goenv.sh \ bash ./make.bash --no-banner + $(CURDIR)/bin/go install -v -buildmode=shared \ + -ldflags '-extldflags "-Wl,-soname=libgolang-$(GOVER)-std.so.1"' \ + std opt_no_act := ifneq (,$(findstring n,$(MAKEFLAGS)))
  4. Download patch debian/control

    --- 1.8.3-2/debian/control 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/control 2017-08-15 01:01:11.000000000 +0000 @@ -5,7 +5,8 @@ Source: golang-1.8 Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -24,7 +25,11 @@ Depends: golang-1.8-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-1.8-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more @@ -96,3 +101,25 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: libgolang-1.8-std1 +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Provides: ${golang:Provides} +Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} +Description: Go standard shared library + This package contains the Go standard library built as a shared library. + Packages should not depend on this package directly but rather the ABI-stamped + value in Provides:. dpkg-shlibdeps will do this automatically. + +Package: golang-1.8-go-shared-dev +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Depends: golang-1.8-go (= ${binary:Version}), + libgolang-1.8-std1 (= ${binary:Version}), + ${misc:Depends}, + ${perl:Depends}, + ${shlibs:Depends} +Description: Go standard shared library support files + This package contains the files necessary to link against the shared + library packaged in libgolang-1.8-std1.
  5. Download patch src/cmd/link/internal/ld/lib.go
  6. Download patch debian/libgolang-X.Y-std1.lintian-overrides

    --- 1.8.3-2/debian/libgolang-X.Y-std1.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/libgolang-X.Y-std1.lintian-overrides 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,3 @@ +# Go shared libraries are not linked by the system linker so +# the .so symlinks are not where lintian expects. +libgolang-std1: dev-pkg-without-shlib-symlink
  7. Download patch debian/control.in

    --- 1.8.3-2/debian/control.in 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/control.in 2017-08-15 01:01:11.000000000 +0000 @@ -1,7 +1,8 @@ Source: golang-X.Y Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -20,7 +21,11 @@ Depends: golang-X.Y-src (>= ${source:Ver ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Recommends: g++, gcc, libc6-dev, pkg-config +Recommends: g++, + gcc, + golang-X.Y-race-detector-runtime [amd64], + libc6-dev, + pkg-config Suggests: bzr, ca-certificates, git, mercurial, subversion Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more @@ -92,3 +97,25 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: libgolang-X.Y-std1 +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Provides: ${golang:Provides} +Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} +Description: Go standard shared library + This package contains the Go standard library built as a shared library. + Packages should not depend on this package directly but rather the ABI-stamped + value in Provides:. dpkg-shlibdeps will do this automatically. + +Package: golang-X.Y-go-shared-dev +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Pre-Depends: ${misc:Pre-Depends} +Depends: golang-X.Y-go (= ${binary:Version}), + libgolang-X.Y-std1 (= ${binary:Version}), + ${misc:Depends}, + ${perl:Depends}, + ${shlibs:Depends} +Description: Go standard shared library support files + This package contains the files necessary to link against the shared + library packaged in libgolang-X.Y-std1.
  8. Download patch .pc/applied-patches

    --- 1.8.3-2/.pc/applied-patches 2017-08-24 00:11:43.386431442 +0000 +++ 1.8.3-2ubuntu1/.pc/applied-patches 2017-08-24 00:11:44.458461131 +0000 @@ -1 +1,3 @@ +i386-shlib-fix.patch +cl-40401--more-robust-ABI-hash.patch 0001-Fix-FTBFS-with-Perl-526.patch
  9. Download patch .pc/cl-40401--more-robust-ABI-hash.patch/src/cmd/link/internal/ld/lib.go
  10. Download patch misc/cgo/testshared/shared_test.go

    --- 1.8.3-2/misc/cgo/testshared/shared_test.go 2017-05-24 18:15:12.000000000 +0000 +++ 1.8.3-2ubuntu1/misc/cgo/testshared/shared_test.go 2017-08-24 00:11:44.000000000 +0000 @@ -759,6 +759,13 @@ func appendFile(path, content string) { } } +func writeFile(path, content string) { + err := ioutil.WriteFile(path, []byte(content), 0644) + if err != nil { + log.Fatalf("ioutil.WriteFile failed: %v", err) + } +} + func TestABIChecking(t *testing.T) { goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") goCmd(t, "install", "-linkshared", "exe") @@ -797,9 +804,10 @@ func TestABIChecking(t *testing.T) { run(t, "rebuilt exe", "./bin/exe") // If we make a change which does not break ABI (such as adding an unexported - // function) and rebuild libdepBase.so, exe still works. + // function) and rebuild libdepBase.so, exe still works, even if new function + // is in a file by itself. resetFileStamps() - appendFile("src/depBase/dep.go", "func noABIBreak() {}\n") + writeFile("src/depBase/dep2.go", "package depBase\nfunc noABIBreak() {}\n") goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") run(t, "after non-ABI breaking change", "./bin/exe") }
  11. Download patch .pc/i386-shlib-fix.patch/src/cmd/internal/obj/x86/obj6.go
  12. Download patch debian/patches/series

    --- 1.8.3-2/debian/patches/series 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/patches/series 2017-08-15 01:01:50.000000000 +0000 @@ -1 +1,3 @@ +i386-shlib-fix.patch +cl-40401--more-robust-ABI-hash.patch 0001-Fix-FTBFS-with-Perl-526.patch
  13. Download patch debian/gbp.conf.in

    --- 1.8.3-2/debian/gbp.conf.in 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/gbp.conf.in 2017-08-15 01:01:11.000000000 +0000 @@ -1,9 +1,9 @@ [DEFAULT] -debian-branch = golang-X.Y +debian-branch = ubuntu-X.Y debian-tag = debian/%(version)s upstream-branch = upstream-X.Y upstream-tag = upstream/%(version)s pristine-tar = True -[dch] +[git-dch] meta = 1
  14. Download patch debian/patches/i386-shlib-fix.patch

    --- 1.8.3-2/debian/patches/i386-shlib-fix.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/patches/i386-shlib-fix.patch 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,63 @@ +commit a735b8bec8fd3782748777ad9bb2e49bcaf10e4f +Author: Michael Hudson-Doyle <michael.hudson@canonical.com> +Date: Thu Apr 27 11:56:42 2017 +1200 + + cmd/internal/obj/x86: use LEAx rather than ADDx when calling DUFFxxxx via GOT + + DUFFZERO on 386 is not marked as clobbering flags, but rewriteToUseGot rewrote + "ADUFFZERO $offset" to "MOVL runtime.duffxxx@GOT, CX; ADDL $offset, CX; CALL CX" + which does. Luckily the fix is easier than figuring out what the problem was: + replace the ADDL $offset, CX with LEAL $offset(CX), CX. + + On amd64 DUFFZERO clobbers flags, on arm, arm64 and ppc64 ADD does not clobber + flags and s390x does not use the duff functions, so I'm fairly confident this + is the only fix required. + + I don't know how to write a test though. + + Change-Id: I69b0958f5f45771d61db5f5ecb4ded94e8960d4d + +--- a/src/cmd/internal/obj/x86/obj6.go ++++ b/src/cmd/internal/obj/x86/obj6.go +@@ -322,15 +322,13 @@ + + // Rewrite p, if necessary, to access global data via the global offset table. + func rewriteToUseGot(ctxt *obj.Link, p *obj.Prog) { +- var add, lea, mov obj.As ++ var lea, mov obj.As + var reg int16 + if p.Mode == 64 { +- add = AADDQ + lea = ALEAQ + mov = AMOVQ + reg = REG_R15 + } else { +- add = AADDL + lea = ALEAL + mov = AMOVL + reg = REG_CX +@@ -347,8 +345,10 @@ + // ADUFFxxx $offset + // becomes + // $MOV runtime.duffxxx@GOT, $reg +- // $ADD $offset, $reg ++ // $LEA $offset($reg), $reg + // CALL $reg ++ // (we use LEAx rather than ADDx because ADDx clobbers ++ // flags and duffzero on 386 does not otherwise do so) + var sym *obj.LSym + if p.As == obj.ADUFFZERO { + sym = obj.Linklookup(ctxt, "runtime.duffzero", 0) +@@ -365,9 +365,10 @@ + p.To.Offset = 0 + p.To.Sym = nil + p1 := obj.Appendp(ctxt, p) +- p1.As = add +- p1.From.Type = obj.TYPE_CONST ++ p1.As = lea ++ p1.From.Type = obj.TYPE_MEM + p1.From.Offset = offset ++ p1.From.Reg = reg + p1.To.Type = obj.TYPE_REG + p1.To.Reg = reg + p2 := obj.Appendp(ctxt, p1)
  15. Download patch debian/patches/cl-40401--more-robust-ABI-hash.patch

    --- 1.8.3-2/debian/patches/cl-40401--more-robust-ABI-hash.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/patches/cl-40401--more-robust-ABI-hash.patch 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,89 @@ +From 533ed967c6e842b4f9b9b503d20b3af698a4e022 Mon Sep 17 00:00:00 2001 +From: Michael Hudson-Doyle <michael.hudson@canonical.com> +Date: Wed, 12 Apr 2017 16:08:46 +1200 +Subject: [PATCH] cmd/link: only include the version info and export data in ABI hash + +Previously the "ABI hash" for a package (used to determine if a loaded shared +library has the ABI expected by its loader) was the hash of the entire +__.PKGDEF file. But that means it depends on the build ID generated by the go +tool for the package, which means that if a file is added (even a .c or .h +file!) to the package, the ABI changes, perhaps uncessarily. + +Fixes #19920 + +Change-Id: If919481e1a03afb350c8a9c7a0666bb90ee90270 +Reviewed-on: https://go-review.googlesource.com/40401 +Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> +TryBot-Result: Gobot Gobot <gobot@golang.org> +Reviewed-by: Ian Lance Taylor <iant@golang.org> +--- + +--- a/misc/cgo/testshared/shared_test.go ++++ b/misc/cgo/testshared/shared_test.go +@@ -759,6 +759,13 @@ + } + } + ++func writeFile(path, content string) { ++ err := ioutil.WriteFile(path, []byte(content), 0644) ++ if err != nil { ++ log.Fatalf("ioutil.WriteFile failed: %v", err) ++ } ++} ++ + func TestABIChecking(t *testing.T) { + goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") + goCmd(t, "install", "-linkshared", "exe") +@@ -797,9 +804,10 @@ + run(t, "rebuilt exe", "./bin/exe") + + // If we make a change which does not break ABI (such as adding an unexported +- // function) and rebuild libdepBase.so, exe still works. ++ // function) and rebuild libdepBase.so, exe still works, even if new function ++ // is in a file by itself. + resetFileStamps() +- appendFile("src/depBase/dep.go", "func noABIBreak() {}\n") ++ writeFile("src/depBase/dep2.go", "package depBase\nfunc noABIBreak() {}\n") + goCmd(t, "install", "-buildmode=shared", "-linkshared", "depBase") + run(t, "after non-ABI breaking change", "./bin/exe") + } +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -709,10 +709,35 @@ + } + + h := sha1.New() +- if _, err := io.CopyN(h, f, atolwhex(arhdr.size)); err != nil { +- Errorf(nil, "bad read of %s for hash generation: %v", lib.File, err) ++ ++ // To compute the hash of a package, we hash the first line of ++ // __.PKGDEF (which contains the toolchain version and any ++ // GOEXPERIMENT flags) and the export data (which is between ++ // the first two occurences of "\n$$"). ++ ++ pkgDefBytes := make([]byte, atolwhex(arhdr.size)) ++ _, err = io.ReadFull(f, pkgDefBytes) ++ if err != nil { ++ Errorf(nil, "%s: error reading package data: %v", lib.File, err) ++ return ++ } ++ firstEOL := bytes.Index(pkgDefBytes, []byte("\n")) ++ if firstEOL < 0 { ++ Errorf(nil, "cannot parse package data of %s for hash generation, no newline found", lib.File) ++ return ++ } ++ firstDoubleDollar := bytes.Index(pkgDefBytes, []byte("\n$$")) ++ if firstDoubleDollar < 0 { ++ Errorf(nil, "cannot parse package data of %s for hash generation, no \\n$$ found", lib.File) ++ return ++ } ++ secondDoubleDollar := bytes.Index(pkgDefBytes[firstDoubleDollar+1:], []byte("\n$$")) ++ if secondDoubleDollar < 0 { ++ Errorf(nil, "cannot parse package data of %s for hash generation, only one \\n$$ found", lib.File) + return + } ++ h.Write(pkgDefBytes[0:firstEOL]) ++ h.Write(pkgDefBytes[firstDoubleDollar : firstDoubleDollar+secondDoubleDollar]) + lib.hash = hex.EncodeToString(h.Sum(nil)) + } +
  16. Download patch debian/helpers/readabihash.go

    --- 1.8.3-2/debian/helpers/readabihash.go 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/helpers/readabihash.go 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,85 @@ +package main + +import ( + "debug/elf" + "encoding/binary" + "fmt" + "io" + "log" + "os" +) + +func rnd(v int32, r int32) int32 { + if r <= 0 { + return v + } + v += r - 1 + c := v % r + if c < 0 { + c += r + } + v -= c + return v +} + +func readwithpad(r io.Reader, sz int32) ([]byte, error) { + full := rnd(sz, 4) + data := make([]byte, full) + _, err := r.Read(data) + if err != nil { + return nil, err + } + data = data[:sz] + return data, nil +} + +func readnote(filename, name string, type_ int32) ([]byte, error) { + f, err := elf.Open(filename) + if err != nil { + return nil, err + } + for _, sect := range f.Sections { + if sect.Type != elf.SHT_NOTE { + continue + } + r := sect.Open() + for { + var namesize, descsize, nt_type int32 + err = binary.Read(r, f.ByteOrder, &namesize) + if err != nil { + if err == io.EOF { + break + } + return nil, fmt.Errorf("read namesize failed", err) + } + err = binary.Read(r, f.ByteOrder, &descsize) + if err != nil { + return nil, fmt.Errorf("read descsize failed", err) + } + err = binary.Read(r, f.ByteOrder, &nt_type) + if err != nil { + return nil, fmt.Errorf("read type failed", err) + } + nt_name, err := readwithpad(r, namesize) + if err != nil { + return nil, fmt.Errorf("read name failed", err) + } + desc, err := readwithpad(r, descsize) + if err != nil { + return nil, fmt.Errorf("read desc failed", err) + } + if name == string(nt_name) && type_ == nt_type { + return desc, nil + } + } + } + return nil, nil +} + +func main() { + desc, err := readnote(os.Args[1], "Go\x00\x00", 2) + if err != nil { + log.Fatalf("readnote failed: %v", err) + } + fmt.Printf("%x\n", desc) +}
  17. Download patch debian/helpers/installshlib.sh

    --- 1.8.3-2/debian/helpers/installshlib.sh 1970-01-01 00:00:00.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/helpers/installshlib.sh 2017-08-15 01:01:11.000000000 +0000 @@ -0,0 +1,17 @@ +#!/bin/bash +set -eux +GOARCH=$(./bin/go env GOARCH) + +./bin/go build -o ./bin/readabihash -linkshared -ldflags="-r ''" debian/helpers/readabihash.go + +TRIPLET=$(dpkg-architecture -qDEB_HOST_MULTIARCH) + +mkdir -p debian/libgolang-${GOVER}-std1/usr/lib/${TRIPLET} +mv pkg/linux_${GOARCH}_dynlink/libstd.so debian/libgolang-${GOVER}-std1/usr/lib/${TRIPLET}/libgolang-${GOVER}-std.so.1 + +ln -s ../../../${TRIPLET}/libgolang-${GOVER}-std.so.1 pkg/linux_${GOARCH}_dynlink/libstd.so + +mkdir -p debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/ +mv pkg/linux_${GOARCH}_dynlink/ debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/ + +cp bin/readabihash debian/golang-${GOVER}-go-shared-dev/usr/lib/go-${GOVER}/pkg/
  18. Download patch debian/gbp.conf

    --- 1.8.3-2/debian/gbp.conf 2017-07-24 20:51:01.000000000 +0000 +++ 1.8.3-2ubuntu1/debian/gbp.conf 2017-08-15 01:01:11.000000000 +0000 @@ -3,11 +3,11 @@ # [DEFAULT] -debian-branch = golang-1.8 +debian-branch = ubuntu-1.8 debian-tag = debian/%(version)s upstream-branch = upstream-1.8 upstream-tag = upstream/%(version)s pristine-tar = True -[dch] +[git-dch] meta = 1

Debian ( Changelog | PTS | Bugs ) Ubuntu ( Changelog | txt | LP | Bugs ) | Diff from Ubuntu

Source: golang-defaults

golang-defaults (2:1.8~1ubuntu1) artful; urgency=medium * Merge with Debian experimental. Remaining changes: - Build and recommend golang-race-detector-runtime on amd64. - Add golang-go-shared-dev and golang-any-shared-dev. - Build golang-go and related packages on s390x. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 24 Apr 2017 10:59:33 +1200

Modifications :
  1. Download patch debian/control

    --- 2:1.8~1/debian/control 2017-03-15 08:17:16.000000000 +0000 +++ 2:1.8~1ubuntu1/debian/control 2017-04-23 23:13:44.000000000 +0000 @@ -1,7 +1,8 @@ Source: golang-defaults Section: devel Priority: optional -Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Go Compiler Team <pkg-golang-devel@lists.alioth.debian.org> Uploaders: Michael Stapelberg <stapelberg@debian.org>, Paul Tagliamonte <paultag@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -13,7 +14,7 @@ Vcs-Browser: https://anonscm.debian.org/ Vcs-Git: https://anonscm.debian.org/git/pkg-golang/golang-defaults.git Package: golang-go -Architecture: amd64 arm64 armel armhf i386 ppc64 ppc64el +Architecture: amd64 arm64 armel armhf i386 ppc64 ppc64el s390x Conflicts: gccgo-go Depends: golang-${golang:GOVER}-go, golang-src (>= ${source:Version}), @@ -50,6 +51,7 @@ Replaces: golang-doc (<< 2:1.6.1+1~), golang-go-windows-amd64, golang-go.tools (<< 1:0.0~git20151026.0.0f9d71c-1~), golang-golang-x-tools (<< 1:0.0~git20151026.0.0f9d71c-1~) +Recommends: golang-race-detector-runtime [amd64] Description: Go programming language compiler, linker, compiled stdlib The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and efficient. Its concurrency @@ -104,7 +106,7 @@ Description: Go programming language -- It conflicts with golang-go. Package: golang-src -Architecture: amd64 arm64 armel armhf i386 ppc64 ppc64el +Architecture: amd64 arm64 armel armhf i386 ppc64 ppc64el s390x Depends: golang-${golang:GOVER}-src, ${misc:Depends} Description: Go programming language - source files The Go programming language is an open source project to make programmers more @@ -147,7 +149,7 @@ Depends: golang-${golang:GOVER}, golang-go (>= ${source:Version}), golang-src (>= ${source:Version}), ${misc:Depends} -Architecture: amd64 arm64 armel armhf i386 ppc64 ppc64el +Architecture: amd64 arm64 armel armhf i386 ppc64 ppc64el s390x Description: Go programming language compiler - metapackage The Go programming language is an open source project to make programmers more productive. Go is expressive, concise, clean, and @@ -161,3 +163,38 @@ Description: Go programming language com . This package is a metapackage that, when installed, guarantees that (most of) a full Go development environment is installed. + +Package: golang-race-detector-runtime +Architecture: amd64 +Depends: golang-${golang:GOVER}-race-detector-runtime, ${misc:Depends} +Description: Runtime support for Go's race detector + The runtime support for the race detector is included as a binary + file in the go source distribution so this package exists to build it + from source on trusted infrastructure. + . + Installing this package will make the -race flag to the go tool functional. + . + This is a dependency package that depends on the race detector runtime for the + default version of Go. + +Package: golang-go-shared-dev +Architecture: amd64 arm64 armhf i386 ppc64el s390x +Depends: golang-${golang:GOVER}-go-shared-dev, golang-go, ${misc:Depends} +Description: Go standard shared library support files + Files necessary to link against the shared library version of the Go + standard library. + . + This is a dependency package that depends on the support files for the + default version of Go. + +Package: golang-any-shared-dev +Architecture: any +Depends: golang-any, + golang-go-shared-dev [amd64 arm64 armhf i386 ppc64el s390x], + ${misc:Depends} +Description: Go standard shared library support files + Files necessary to link against the shared library version of the Go + standard library. + . + This is a dependency package that depends on the support files for the + default version of Go, or gccgo if no version of Go is available.
  1. desktop-base
  2. docker.io
  3. golang-1.7
  4. golang-1.8
  5. golang-defaults