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: consul

consul (1.4.4~dfsg1-2ubuntu2) focal; urgency=medium * Add additional missing build-dependencies, golang-github-ghodss-yaml-dev and golang-github-spf13-pflag-dev. -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 29 Oct 2019 00:03:41 -0700 consul (1.4.4~dfsg1-2ubuntu1) focal; urgency=medium * Add missing build-dependency on golang-github-aws-aws-sdk-go-dev and golang-google-api-dev. Closes: #910714. -- Steve Langasek <steve.langasek@ubuntu.com> Mon, 28 Oct 2019 23:25:03 -0700

Modifications :
  1. Download patch debian/control

    --- 1.4.4~dfsg1-2/debian/control 2019-10-19 10:09:03.000000000 +0000 +++ 1.4.4~dfsg1-2ubuntu2/debian/control 2019-10-29 07:03:37.000000000 +0000 @@ -2,7 +2,8 @@ Source: consul Section: devel Priority: optional Standards-Version: 4.4.1 -Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org> Uploaders: Dmitry Smirnov <onlyjob@debian.org>, Martín Ferrari <tincho@debian.org>, Tianon Gravi <tianon@debian.org>, @@ -12,6 +13,7 @@ Build-Depends: debhelper (>= 11~) ,bash- ,golang-github-armon-circbuf-dev ,golang-github-armon-go-metrics-dev (>= 0.0~git20171117~) ,golang-github-armon-go-radix-dev + ,golang-github-aws-aws-sdk-go-dev ,golang-github-azure-go-autorest-dev (>= 10.15.5~) # ,golang-github-dgrijalva-jwt-go-dev (>= 3.2.0~) # ,golang-github-beorn7-perks-dev @@ -25,6 +27,7 @@ Build-Depends: debhelper (>= 11~) ,bash- ,golang-github-docker-go-connections-dev ,golang-github-elazarl-go-bindata-assetfs-dev (>= 0.0~git20151224~) ,golang-github-fsouza-go-dockerclient-dev + ,golang-github-ghodss-yaml-dev ,golang-github-gogo-googleapis-dev ,golang-github-gogo-protobuf-dev (>= 1.2.1~) ,golang-github-golang-snappy-dev @@ -83,8 +86,10 @@ Build-Depends: debhelper (>= 11~) ,bash- ,golang-github-ryanuber-go-glob-dev ,golang-github-sergi-go-diff-dev ,golang-github-shirou-gopsutil-dev + ,golang-github-spf13-pflag-dev ,golang-github-vmware-govmomi-dev ,golang-golang-x-sys-dev (>= 0.0~git20161012~) + ,golang-google-api-dev ,golang-gopkg-inf.v0-dev # ,mockery # tests:

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

Source: golang-defaults

golang-defaults (2:1.12~1ubuntu1) eoan; urgency=low * Merge from Debian unstable. Remaining changes: - Build and recommend golang-race-detector-runtime on amd64. -- Gianfranco Costamagna <locutusofborg@debian.org> Sun, 04 Aug 2019 22:46:14 +0200

Modifications :
  1. Download patch debian/control

    --- 2:1.12~1/debian/control 2019-08-03 10:22:56.000000000 +0000 +++ 2:1.12~1ubuntu1/debian/control 2019-08-03 15:44:09.000000000 +0000 @@ -55,6 +55,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 @@ -168,3 +169,16 @@ 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.

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

Source: golang-github-miekg-dns

golang-github-miekg-dns (1.0.4+ds-1ubuntu1) eoan; urgency=medium * Backport patch from upstream that skips TestParseDstFromOOB and TestCorrectSource on !amd64 as they contain hard coded data that is only valid on 64-bit little endian. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Mon, 19 Aug 2019 16:49:49 +1200

Modifications :
  1. Download patch debian/control

    --- 1.0.4+ds-1/debian/control 2018-03-26 21:25:00.000000000 +0000 +++ 1.0.4+ds-1ubuntu1/debian/control 2019-08-19 04:49:49.000000000 +0000 @@ -1,5 +1,6 @@ Source: golang-github-miekg-dns -Maintainer: pkg-go <pkg-go-maintainers@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: pkg-go <pkg-go-maintainers@lists.alioth.debian.org> Uploaders: Tonnerre LOMBARD <tonnerre@ancient-solutions.com>, Tim Potter <tpot@hpe.com>, Martín Ferrari <tincho@debian.org>,
  2. Download patch debian/patches/series

    --- 1.0.4+ds-1/debian/patches/series 2018-03-26 21:25:00.000000000 +0000 +++ 1.0.4+ds-1ubuntu1/debian/patches/series 2019-08-19 04:47:18.000000000 +0000 @@ -1 +1,2 @@ 01-Disable_network_tests.patch +skip-UDP-OOB-tests-on-unsupported-architectures.patch
  3. Download patch debian/patches/skip-UDP-OOB-tests-on-unsupported-architectures.patch

    --- 1.0.4+ds-1/debian/patches/skip-UDP-OOB-tests-on-unsupported-architectures.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.0.4+ds-1ubuntu1/debian/patches/skip-UDP-OOB-tests-on-unsupported-architectures.patch 2019-08-19 04:47:27.000000000 +0000 @@ -0,0 +1,46 @@ +From 3f2548fb607990e095dd0981bd2021593fdb0cb8 Mon Sep 17 00:00:00 2001 +From: Tom Thorogood <me+github@tomthorogood.co.uk> +Date: Fri, 6 Apr 2018 23:21:59 +0930 +Subject: [PATCH] Skip UDP OOB tests on unsupported architectures (#661) + +--- + udp_test.go | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/udp_test.go ++++ b/udp_test.go +@@ -5,6 +5,7 @@ + import ( + "bytes" + "net" ++ "runtime" + "strings" + "testing" + "time" +@@ -74,6 +75,14 @@ + } + + func TestParseDstFromOOB(t *testing.T) { ++ if runtime.GOARCH != "amd64" { ++ // The cmsghdr struct differs in the width (32/64-bit) of ++ // lengths and the struct padding between architectures. ++ // The data below was only written with amd64 in mind, and ++ // thus the test must be skipped on other architectures. ++ t.Skip("skipping test on unsupported architecture") ++ } ++ + // dst is :ffff:100.100.100.100 + oob := []byte{36, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 100, 100, 100, 100, 2, 0, 0, 0} + dst := parseDstFromOOB(oob) +@@ -106,6 +115,11 @@ + } + + func TestCorrectSource(t *testing.T) { ++ if runtime.GOARCH != "amd64" { ++ // See comment above in TestParseDstFromOOB. ++ t.Skip("skipping test on unsupported architecture") ++ } ++ + // dst is :ffff:100.100.100.100 which should be counted as IPv4 + oob := []byte{36, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 100, 100, 100, 100, 2, 0, 0, 0} + soob := correctSource(oob)

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

Source: golang-github-prometheus-client-golang

golang-github-prometheus-client-golang (0.9.2-0ubuntu3) eoan; urgency=medium * Renable TestCounterAddLarge, cherrypick upstream patch to resolve the testcode. -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 07 May 2019 14:48:51 +0100 golang-github-prometheus-client-golang (0.9.2-0ubuntu2) disco; urgency=medium * Skip TestCounterAddLarge fails on many 64bit arches. -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 22 Jan 2019 22:41:21 +0000 golang-github-prometheus-client-golang (0.9.2-0ubuntu1) disco; urgency=medium * New upstream release -- Dimitri John Ledkov <xnox@ubuntu.com> Tue, 22 Jan 2019 14:17:40 +0000

Modifications :
  1. Download patch prometheus/examples_test.go

    --- 0.9.0-1/prometheus/examples_test.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/examples_test.go 2018-12-07 10:51:17.000000000 +0000 @@ -282,7 +282,7 @@ func ExampleRegister() { // taskCounter unregistered. // taskCounterVec not registered: a previously registered descriptor with the same fully-qualified name as Desc{fqName: "worker_pool_completed_tasks_total", help: "Total number of tasks completed.", constLabels: {}, variableLabels: [worker_id]} has different label names or a different help string // taskCounterVec registered. - // Worker initialization failed: inconsistent label cardinality + // Worker initialization failed: inconsistent label cardinality: expected 1 label values but got 2 in []string{"42", "spurious arg"} // notMyCounter is nil. // taskCounterForWorker42 registered. // taskCounterForWorker2001 registered.
  2. Download patch prometheus/example_clustermanager_test.go

    --- 0.9.0-1/prometheus/example_clustermanager_test.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/example_clustermanager_test.go 2018-12-07 10:51:17.000000000 +0000 @@ -13,7 +13,13 @@ package prometheus_test -import "github.com/prometheus/client_golang/prometheus" +import ( + "log" + "net/http" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" +) // ClusterManager is an example for a system that might have been built without // Prometheus in mind. It models a central manager of jobs running in a @@ -124,4 +130,13 @@ func ExampleCollector() { // variables to then do something with them. NewClusterManager("db", reg) NewClusterManager("ca", reg) + + // Add the standard process and Go metrics to the custom registry. + reg.MustRegister( + prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}), + prometheus.NewGoCollector(), + ) + + http.Handle("/metrics", promhttp.HandlerFor(reg, promhttp.HandlerOpts{})) + log.Fatal(http.ListenAndServe(":8080", nil)) }
  3. Download patch prometheus/promhttp/http_test.go

    --- 0.9.0-1/prometheus/promhttp/http_test.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/promhttp/http_test.go 2018-12-07 10:51:17.000000000 +0000 @@ -103,7 +103,7 @@ func TestHandlerErrorHandling(t *testing }) wantMsg := `error gathering metrics: error collecting metric Desc{fqName: "invalid_metric", help: "not helpful", constLabels: {}, variableLabels: []}: collect error ` - wantErrorBody := `An error has occurred during metrics gathering: + wantErrorBody := `An error has occurred while serving metrics: error collecting metric Desc{fqName: "invalid_metric", help: "not helpful", constLabels: {}, variableLabels: []}: collect error `
  4. Download patch prometheus/timer.go

    --- 0.9.0-1/prometheus/timer.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/timer.go 2018-12-07 10:51:17.000000000 +0000 @@ -39,13 +39,16 @@ func NewTimer(o Observer) *Timer { // ObserveDuration records the duration passed since the Timer was created with // NewTimer. It calls the Observe method of the Observer provided during -// construction with the duration in seconds as an argument. ObserveDuration is -// usually called with a defer statement. +// construction with the duration in seconds as an argument. The observed +// duration is also returned. ObserveDuration is usually called with a defer +// statement. // // Note that this method is only guaranteed to never observe negative durations // if used with Go1.9+. -func (t *Timer) ObserveDuration() { +func (t *Timer) ObserveDuration() time.Duration { + d := time.Since(t.begin) if t.observer != nil { - t.observer.Observe(time.Since(t.begin).Seconds()) + t.observer.Observe(d.Seconds()) } + return d }
  5. Download patch prometheus/testutil/testutil.go

    --- 0.9.0-1/prometheus/testutil/testutil.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/testutil/testutil.go 2018-12-07 10:51:17.000000000 +0000 @@ -37,7 +37,6 @@ import ( "bytes" "fmt" "io" - "reflect" "github.com/prometheus/common/expfmt" @@ -125,38 +124,43 @@ func CollectAndCompare(c prometheus.Coll // exposition format. If any metricNames are provided, only metrics with those // names are compared. func GatherAndCompare(g prometheus.Gatherer, expected io.Reader, metricNames ...string) error { - metrics, err := g.Gather() + got, err := g.Gather() if err != nil { return fmt.Errorf("gathering metrics failed: %s", err) } if metricNames != nil { - metrics = filterMetrics(metrics, metricNames) + got = filterMetrics(got, metricNames) } var tp expfmt.TextParser - expectedMetrics, err := tp.TextToMetricFamilies(expected) + wantRaw, err := tp.TextToMetricFamilies(expected) if err != nil { return fmt.Errorf("parsing expected metrics failed: %s", err) } + want := internal.NormalizeMetricFamilies(wantRaw) - if !reflect.DeepEqual(metrics, internal.NormalizeMetricFamilies(expectedMetrics)) { - // Encode the gathered output to the readable text format for comparison. - var buf1 bytes.Buffer - enc := expfmt.NewEncoder(&buf1, expfmt.FmtText) - for _, mf := range metrics { - if err := enc.Encode(mf); err != nil { - return fmt.Errorf("encoding result failed: %s", err) - } + return compare(got, want) +} + +// compare encodes both provided slices of metric families into the text format, +// compares their string message, and returns an error if they do not match. +// The error contains the encoded text of both the desired and the actual +// result. +func compare(got, want []*dto.MetricFamily) error { + var gotBuf, wantBuf bytes.Buffer + enc := expfmt.NewEncoder(&gotBuf, expfmt.FmtText) + for _, mf := range got { + if err := enc.Encode(mf); err != nil { + return fmt.Errorf("encoding gathered metrics failed: %s", err) } - // Encode normalized expected metrics again to generate them in the same ordering - // the registry does to spot differences more easily. - var buf2 bytes.Buffer - enc = expfmt.NewEncoder(&buf2, expfmt.FmtText) - for _, mf := range internal.NormalizeMetricFamilies(expectedMetrics) { - if err := enc.Encode(mf); err != nil { - return fmt.Errorf("encoding result failed: %s", err) - } + } + enc = expfmt.NewEncoder(&wantBuf, expfmt.FmtText) + for _, mf := range want { + if err := enc.Encode(mf); err != nil { + return fmt.Errorf("encoding expected metrics failed: %s", err) } + } + if wantBuf.String() != gotBuf.String() { return fmt.Errorf(` metric output does not match expectation; want: @@ -165,7 +169,8 @@ metric output does not match expectation got: %s -`, buf2.String(), buf1.String()) +`, wantBuf.String(), gotBuf.String()) + } return nil }
  6. Download patch debian/patches/0010-Update-Makefile.common-to-current-upstream-version.patch

    --- 0.9.0-1/debian/patches/0010-Update-Makefile.common-to-current-upstream-version.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/patches/0010-Update-Makefile.common-to-current-upstream-version.patch 2019-01-22 14:26:00.000000000 +0000 @@ -0,0 +1,139 @@ +From 1749edba401a182b6c4bb4931441e09cbe4e7f48 Mon Sep 17 00:00:00 2001 +From: beorn7 <beorn@soundcloud.com> +Date: Sat, 5 Jan 2019 21:56:06 +0100 +Subject: [PATCH 10/14] Update Makefile.common to current upstream version + +This should fix the staticcheck test failures with Go 1.10 + +Signed-off-by: beorn7 <beorn@soundcloud.com> +--- + Makefile.common | 56 +++++++++++++++++++++++++++++-------------------- + 1 file changed, 33 insertions(+), 23 deletions(-) + +diff --git a/Makefile.common b/Makefile.common +index 741579e..fff85f9 100644 +--- a/Makefile.common ++++ b/Makefile.common +@@ -29,6 +29,8 @@ GO ?= go + GOFMT ?= $(GO)fmt + FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) + GOOPTS ?= ++GOHOSTOS ?= $(shell $(GO) env GOHOSTOS) ++GOHOSTARCH ?= $(shell $(GO) env GOHOSTARCH) + + GO_VERSION ?= $(shell $(GO) version) + GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) +@@ -62,17 +64,30 @@ PROMU := $(FIRST_GOPATH)/bin/promu + STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck + pkgs = ./... + +-GO_VERSION ?= $(shell $(GO) version) +-GO_BUILD_PLATFORM ?= $(subst /,-,$(lastword $(GO_VERSION))) ++ifeq (arm, $(GOHOSTARCH)) ++ GOHOSTARM ?= $(shell GOARM= $(GO) env GOARM) ++ GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH)v$(GOHOSTARM) ++else ++ GO_BUILD_PLATFORM ?= $(GOHOSTOS)-$(GOHOSTARCH) ++endif + + PROMU_VERSION ?= 0.2.0 + PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz ++STATICCHECK_VERSION ?= 2019.1 ++STATICCHECK_URL := https://github.com/dominikh/go-tools/releases/download/$(STATICCHECK_VERSION)/staticcheck_$(GOHOSTOS)_$(GOHOSTARCH) + + PREFIX ?= $(shell pwd) + BIN_DIR ?= $(shell pwd) + DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) + DOCKER_REPO ?= prom + ++ifeq ($(GOHOSTARCH),amd64) ++ ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux freebsd darwin windows)) ++ # Only supported on amd64 ++ test-flags := -race ++ endif ++endif ++ + .PHONY: all + all: precheck style staticcheck unused build test + +@@ -110,12 +125,12 @@ common-test-short: + .PHONY: common-test + common-test: + @echo ">> running all tests" +- GO111MODULE=$(GO111MODULE) $(GO) test -race $(GOOPTS) $(pkgs) ++ GO111MODULE=$(GO111MODULE) $(GO) test $(test-flags) $(GOOPTS) $(pkgs) + + .PHONY: common-format + common-format: + @echo ">> formatting code" +- GO111MODULE=$(GO111MODULE) $(GO) fmt $(GOOPTS) $(pkgs) ++ GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs) + + .PHONY: common-vet + common-vet: +@@ -125,8 +140,12 @@ common-vet: + .PHONY: common-staticcheck + common-staticcheck: $(STATICCHECK) + @echo ">> running staticcheck" ++ chmod +x $(STATICCHECK) + ifdef GO111MODULE +- GO111MODULE=$(GO111MODULE) $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" -checks "SA*" $(pkgs) ++# 'go list' needs to be executed before staticcheck to prepopulate the modules cache. ++# Otherwise staticcheck might fail randomly for some reason not yet explained. ++ GO111MODULE=$(GO111MODULE) $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null ++ GO111MODULE=$(GO111MODULE) $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs) + else + $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs) + endif +@@ -140,8 +159,9 @@ else + ifdef GO111MODULE + @echo ">> running check for unused/missing packages in go.mod" + GO111MODULE=$(GO111MODULE) $(GO) mod tidy ++ifeq (,$(wildcard vendor)) + @git diff --exit-code -- go.sum go.mod +-ifneq (,$(wildcard vendor)) ++else + @echo ">> running check for unused packages in vendor/" + GO111MODULE=$(GO111MODULE) $(GO) mod vendor + @git diff --exit-code -- go.sum go.mod vendor/ +@@ -175,30 +195,20 @@ common-docker-tag-latest: + promu: $(PROMU) + + $(PROMU): +- curl -s -L $(PROMU_URL) | tar -xvz -C /tmp +- mkdir -v -p $(FIRST_GOPATH)/bin +- cp -v /tmp/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(PROMU) ++ $(eval PROMU_TMP := $(shell mktemp -d)) ++ curl -s -L $(PROMU_URL) | tar -xvzf - -C $(PROMU_TMP) ++ mkdir -p $(FIRST_GOPATH)/bin ++ cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu ++ rm -r $(PROMU_TMP) + + .PHONY: proto + proto: + @echo ">> generating code from proto files" + @./scripts/genproto.sh + +-.PHONY: $(STATICCHECK) + $(STATICCHECK): +-ifdef GO111MODULE +-# Get staticcheck from a temporary directory to avoid modifying the local go.{mod,sum}. +-# See https://github.com/golang/go/issues/27643. +-# For now, we are using the next branch of staticcheck because master isn't compatible yet with Go modules. +- tmpModule=$$(mktemp -d 2>&1) && \ +- mkdir -p $${tmpModule}/staticcheck && \ +- cd "$${tmpModule}"/staticcheck && \ +- GO111MODULE=on $(GO) mod init example.com/staticcheck && \ +- GO111MODULE=on GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck@next && \ +- rm -rf $${tmpModule}; +-else +- GOOS= GOARCH= GO111MODULE=off $(GO) get -u honnef.co/go/tools/cmd/staticcheck +-endif ++ mkdir -p $(FIRST_GOPATH)/bin ++ curl -s -L $(STATICCHECK_URL) > $(STATICCHECK) + + ifdef GOVENDOR + .PHONY: $(GOVENDOR) +-- +2.19.1 +
  7. Download patch debian/patches/0014-prometheus-reword-comment-to-avoid-cursing.patch

    --- 0.9.0-1/debian/patches/0014-prometheus-reword-comment-to-avoid-cursing.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/patches/0014-prometheus-reword-comment-to-avoid-cursing.patch 2019-01-22 14:26:00.000000000 +0000 @@ -0,0 +1,26 @@ +From da7d5640a22352fbb75c57fe8e18f3ab17f06a2b Mon Sep 17 00:00:00 2001 +From: Matt Layher <mdlayher@gmail.com> +Date: Wed, 16 Jan 2019 17:02:02 -0500 +Subject: [PATCH 14/14] prometheus: reword comment to avoid cursing + +Signed-off-by: Matt Layher <mdlayher@gmail.com> +--- + prometheus/summary.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/prometheus/summary.go b/prometheus/summary.go +index 577fd49..e4c8714 100644 +--- a/prometheus/summary.go ++++ b/prometheus/summary.go +@@ -153,7 +153,7 @@ type SummaryOpts struct { + BufCap uint32 + } + +-// Great fuck-up with the sliding-window decay algorithm... The Merge method of ++// Problem with the sliding-window decay algorithm... The Merge method of + // perk/quantile is actually not working as advertised - and it might be + // unfixable, as the underlying algorithm is apparently not capable of merging + // summaries in the first place. To avoid using Merge, we are currently adding +-- +2.19.1 +
  8. Download patch prometheus/registry_test.go
  9. Download patch prometheus/summary.go

    --- 0.9.0-1/prometheus/summary.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/summary.go 2018-12-07 10:51:17.000000000 +0000 @@ -181,7 +181,7 @@ func NewSummary(opts SummaryOpts) Summar func newSummary(desc *Desc, opts SummaryOpts, labelValues ...string) Summary { if len(desc.variableLabels) != len(labelValues) { - panic(errInconsistentCardinality) + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues)) } for _, n := range desc.variableLabels {
  10. Download patch prometheus/registry.go

    --- 0.9.0-1/prometheus/registry.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/registry.go 2018-12-07 10:51:17.000000000 +0000 @@ -16,6 +16,9 @@ package prometheus import ( "bytes" "fmt" + "io/ioutil" + "os" + "path/filepath" "runtime" "sort" "strings" @@ -23,6 +26,7 @@ import ( "unicode/utf8" "github.com/golang/protobuf/proto" + "github.com/prometheus/common/expfmt" dto "github.com/prometheus/client_model/go" @@ -533,6 +537,38 @@ func (r *Registry) Gather() ([]*dto.Metr return internal.NormalizeMetricFamilies(metricFamiliesByName), errs.MaybeUnwrap() } +// WriteToTextfile calls Gather on the provided Gatherer, encodes the result in the +// Prometheus text format, and writes it to a temporary file. Upon success, the +// temporary file is renamed to the provided filename. +// +// This is intended for use with the textfile collector of the node exporter. +// Note that the node exporter expects the filename to be suffixed with ".prom". +func WriteToTextfile(filename string, g Gatherer) error { + tmp, err := ioutil.TempFile(filepath.Dir(filename), filepath.Base(filename)) + if err != nil { + return err + } + defer os.Remove(tmp.Name()) + + mfs, err := g.Gather() + if err != nil { + return err + } + for _, mf := range mfs { + if _, err := expfmt.MetricFamilyToText(tmp, mf); err != nil { + return err + } + } + if err := tmp.Close(); err != nil { + return err + } + + if err := os.Chmod(tmp.Name(), 0644); err != nil { + return err + } + return os.Rename(tmp.Name(), filename) +} + // processMetric is an internal helper method only used by the Gather method. func processMetric( metric Metric, @@ -836,7 +872,13 @@ func checkMetricConsistency( h = hashAddByte(h, separatorByte) // Make sure label pairs are sorted. We depend on it for the consistency // check. - sort.Sort(labelPairSorter(dtoMetric.Label)) + if !sort.IsSorted(labelPairSorter(dtoMetric.Label)) { + // We cannot sort dtoMetric.Label in place as it is immutable by contract. + copiedLabels := make([]*dto.LabelPair, len(dtoMetric.Label)) + copy(copiedLabels, dtoMetric.Label) + sort.Sort(labelPairSorter(copiedLabels)) + dtoMetric.Label = copiedLabels + } for _, lp := range dtoMetric.Label { h = hashAdd(h, lp.GetName()) h = hashAddByte(h, separatorByte) @@ -867,8 +909,8 @@ func checkDescConsistency( } // Is the desc consistent with the content of the metric? - lpsFromDesc := make([]*dto.LabelPair, 0, len(dtoMetric.Label)) - lpsFromDesc = append(lpsFromDesc, desc.constLabelPairs...) + lpsFromDesc := make([]*dto.LabelPair, len(desc.constLabelPairs), len(dtoMetric.Label)) + copy(lpsFromDesc, desc.constLabelPairs) for _, l := range desc.variableLabels { lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{ Name: proto.String(l),
  11. Download patch debian/patches/0013-Add-support-for-fetching-rules-with-API-client-508.patch
  12. Download patch debian/patches/0011-Fix-staticcheck-errors-in-push_test.go.patch

    --- 0.9.0-1/debian/patches/0011-Fix-staticcheck-errors-in-push_test.go.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/patches/0011-Fix-staticcheck-errors-in-push_test.go.patch 2019-01-22 14:26:00.000000000 +0000 @@ -0,0 +1,53 @@ +From 91b385db444376f4309468ee207db596a2f8e56c Mon Sep 17 00:00:00 2001 +From: beorn7 <beorn@soundcloud.com> +Date: Sat, 5 Jan 2019 22:11:07 +0100 +Subject: [PATCH 11/14] Fix staticcheck errors in push_test.go + +Signed-off-by: beorn7 <beorn@soundcloud.com> +--- + prometheus/push/push_test.go | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/prometheus/push/push_test.go b/prometheus/push/push_test.go +index 34ec334..5e19f39 100644 +--- a/prometheus/push/push_test.go ++++ b/prometheus/push/push_test.go +@@ -96,7 +96,7 @@ func TestPush(t *testing.T) { + if lastMethod != "PUT" { + t.Error("want method PUT for Push, got", lastMethod) + } +- if bytes.Compare(lastBody, wantBody) != 0 { ++ if !bytes.Equal(lastBody, wantBody) { + t.Errorf("got body %v, want %v", lastBody, wantBody) + } + if lastPath != "/metrics/job/testjob" { +@@ -113,7 +113,7 @@ func TestPush(t *testing.T) { + if lastMethod != "POST" { + t.Error("want method POST for Add, got", lastMethod) + } +- if bytes.Compare(lastBody, wantBody) != 0 { ++ if !bytes.Equal(lastBody, wantBody) { + t.Errorf("got body %v, want %v", lastBody, wantBody) + } + if lastPath != "/metrics/job/testjob" { +@@ -170,7 +170,7 @@ func TestPush(t *testing.T) { + if lastMethod != "PUT" { + t.Error("want method PUT for Push, got", lastMethod) + } +- if bytes.Compare(lastBody, wantBody) != 0 { ++ if !bytes.Equal(lastBody, wantBody) { + t.Errorf("got body %v, want %v", lastBody, wantBody) + } + +@@ -185,7 +185,7 @@ func TestPush(t *testing.T) { + if lastMethod != "POST" { + t.Error("want method POST for Add, got", lastMethod) + } +- if bytes.Compare(lastBody, wantBody) != 0 { ++ if !bytes.Equal(lastBody, wantBody) { + t.Errorf("got body %v, want %v", lastBody, wantBody) + } + if lastPath != "/metrics/job/testjob/a/x/b/y" && lastPath != "/metrics/job/testjob/b/y/a/x" { +-- +2.19.1 +
  13. Download patch debian/control

    --- 0.9.0-1/debian/control 2018-10-19 15:32:22.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/control 2019-01-22 14:17:32.000000000 +0000 @@ -1,5 +1,6 @@ Source: golang-github-prometheus-client-golang -Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org> Uploaders: Martín Ferrari <tincho@debian.org>, Section: devel Testsuite: autopkgtest-pkg-go @@ -20,7 +21,7 @@ Homepage: https://github.com/prometheus/ XS-Go-Import-Path: github.com/prometheus/client_golang Package: golang-github-prometheus-client-golang-dev -Architecture: all +Architecture: any Depends: golang-github-beorn7-perks-dev, golang-github-prometheus-client-model-dev, golang-github-prometheus-common-dev (>= 0+git20180413), @@ -40,7 +41,7 @@ Description: Prometheus instrumentation client. (The Prometheus server is using that library.) Package: golang-prometheus-client-dev -Architecture: all +Architecture: any Section: oldlibs Priority: optional Depends: golang-github-prometheus-client-golang-dev,
  14. Download patch debian/patches/0012-Improve-testutil-error-messages.patch

    --- 0.9.0-1/debian/patches/0012-Improve-testutil-error-messages.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/patches/0012-Improve-testutil-error-messages.patch 2019-01-22 14:26:00.000000000 +0000 @@ -0,0 +1,67 @@ +From b3d60964321a277b1ab2c18d912f204acc30a7c3 Mon Sep 17 00:00:00 2001 +From: beorn7 <beorn@soundcloud.com> +Date: Sun, 6 Jan 2019 00:22:03 +0100 +Subject: [PATCH 12/14] Improve testutil error messages + +This also satisfy newer staticcheck versions. + +Signed-off-by: beorn7 <beorn@soundcloud.com> +--- + prometheus/testutil/testutil.go | 4 +--- + prometheus/testutil/testutil_test.go | 5 +---- + 2 files changed, 2 insertions(+), 7 deletions(-) + +diff --git a/prometheus/testutil/testutil.go b/prometheus/testutil/testutil.go +index e344cc8..4c72bc6 100644 +--- a/prometheus/testutil/testutil.go ++++ b/prometheus/testutil/testutil.go +@@ -165,11 +165,9 @@ func compare(got, want []*dto.MetricFamily) error { + metric output does not match expectation; want: + + %s +- + got: + +-%s +-`, wantBuf.String(), gotBuf.String()) ++%s`, wantBuf.String(), gotBuf.String()) + + } + return nil +diff --git a/prometheus/testutil/testutil_test.go b/prometheus/testutil/testutil_test.go +index 4812247..e1f7aab 100644 +--- a/prometheus/testutil/testutil_test.go ++++ b/prometheus/testutil/testutil_test.go +@@ -171,7 +171,6 @@ func TestCollectAndCompareHistogram(t *testing.T) { + c prometheus.Collector + metadata string + expect string +- labels []string + observation float64 + }{ + { +@@ -291,13 +290,11 @@ metric output does not match expectation; want: + # TYPE some_other_metric counter + some_other_metric{label1="value1"} 1.0 + +- + got: + + # HELP some_total A value that represents a counter. + # TYPE some_total counter + some_total{label1="value1"} 1.0 +- + ` + + err := CollectAndCompare(c, strings.NewReader(metadata+expected)) +@@ -306,6 +303,6 @@ some_total{label1="value1"} 1.0 + } + + if err.Error() != expectedError { +- t.Errorf("Expected\n%#+v\nGot:\n%#+v\n", expectedError, err.Error()) ++ t.Errorf("Expected\n%#+v\nGot:\n%#+v", expectedError, err.Error()) + } + } +-- +2.19.1 +
  15. Download patch Makefile.common

    --- 0.9.0-1/Makefile.common 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/Makefile.common 2018-12-07 10:51:17.000000000 +0000 @@ -16,7 +16,7 @@ # !!! Open PRs only against the prometheus/prometheus/Makefile.common repository! # Example usage : -# Create the main Makefile in the root project directory. +# Create the main Makefile in the root project directory. # include Makefile.common # customTarget: # @echo ">> Running customTarget" @@ -28,18 +28,53 @@ unexport GOBIN GO ?= go GOFMT ?= $(GO)fmt FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH))) +GOOPTS ?= + +GO_VERSION ?= $(shell $(GO) version) +GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION)) +PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.') + +unexport GOVENDOR +ifeq (, $(PRE_GO_111)) + ifneq (,$(wildcard go.mod)) + # Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI). + GO111MODULE := on + + ifneq (,$(wildcard vendor)) + # Always use the local vendor/ directory to satisfy the dependencies. + GOOPTS := $(GOOPTS) -mod=vendor + endif + endif +else + ifneq (,$(wildcard go.mod)) + ifneq (,$(wildcard vendor)) +$(warning This repository requires Go >= 1.11 because of Go modules) +$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)') + endif + else + # This repository isn't using Go modules (yet). + GOVENDOR := $(FIRST_GOPATH)/bin/govendor + endif + + unexport GO111MODULE +endif PROMU := $(FIRST_GOPATH)/bin/promu STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck -GOVENDOR := $(FIRST_GOPATH)/bin/govendor pkgs = ./... +GO_VERSION ?= $(shell $(GO) version) +GO_BUILD_PLATFORM ?= $(subst /,-,$(lastword $(GO_VERSION))) + +PROMU_VERSION ?= 0.2.0 +PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz + PREFIX ?= $(shell pwd) BIN_DIR ?= $(shell pwd) DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) DOCKER_REPO ?= prom .PHONY: all -all: style staticcheck unused build test +all: precheck style staticcheck unused build test # This rule is used to forward a target like "build" to "common-build". This # allows a new "build" target to be defined in a Makefile which includes this @@ -70,37 +105,54 @@ common-check_license: .PHONY: common-test-short common-test-short: @echo ">> running short tests" - $(GO) test -short $(pkgs) + GO111MODULE=$(GO111MODULE) $(GO) test -short $(GOOPTS) $(pkgs) .PHONY: common-test common-test: @echo ">> running all tests" - $(GO) test -race $(pkgs) + GO111MODULE=$(GO111MODULE) $(GO) test -race $(GOOPTS) $(pkgs) .PHONY: common-format common-format: @echo ">> formatting code" - $(GO) fmt $(pkgs) + GO111MODULE=$(GO111MODULE) $(GO) fmt $(GOOPTS) $(pkgs) .PHONY: common-vet common-vet: @echo ">> vetting code" - $(GO) vet $(pkgs) + GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs) .PHONY: common-staticcheck common-staticcheck: $(STATICCHECK) @echo ">> running staticcheck" +ifdef GO111MODULE + GO111MODULE=$(GO111MODULE) $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" -checks "SA*" $(pkgs) +else $(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs) +endif .PHONY: common-unused common-unused: $(GOVENDOR) +ifdef GOVENDOR @echo ">> running check for unused packages" @$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages' +else +ifdef GO111MODULE + @echo ">> running check for unused/missing packages in go.mod" + GO111MODULE=$(GO111MODULE) $(GO) mod tidy + @git diff --exit-code -- go.sum go.mod +ifneq (,$(wildcard vendor)) + @echo ">> running check for unused packages in vendor/" + GO111MODULE=$(GO111MODULE) $(GO) mod vendor + @git diff --exit-code -- go.sum go.mod vendor/ +endif +endif +endif .PHONY: common-build common-build: promu @echo ">> building binaries" - $(PROMU) build --prefix $(PREFIX) + GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX) .PHONY: common-tarball common-tarball: promu @@ -120,13 +172,52 @@ common-docker-tag-latest: docker tag "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME):latest" .PHONY: promu -promu: - GOOS= GOARCH= $(GO) get -u github.com/prometheus/promu +promu: $(PROMU) + +$(PROMU): + curl -s -L $(PROMU_URL) | tar -xvz -C /tmp + mkdir -v -p $(FIRST_GOPATH)/bin + cp -v /tmp/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(PROMU) + +.PHONY: proto +proto: + @echo ">> generating code from proto files" + @./scripts/genproto.sh .PHONY: $(STATICCHECK) $(STATICCHECK): - GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck +ifdef GO111MODULE +# Get staticcheck from a temporary directory to avoid modifying the local go.{mod,sum}. +# See https://github.com/golang/go/issues/27643. +# For now, we are using the next branch of staticcheck because master isn't compatible yet with Go modules. + tmpModule=$$(mktemp -d 2>&1) && \ + mkdir -p $${tmpModule}/staticcheck && \ + cd "$${tmpModule}"/staticcheck && \ + GO111MODULE=on $(GO) mod init example.com/staticcheck && \ + GO111MODULE=on GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck@next && \ + rm -rf $${tmpModule}; +else + GOOS= GOARCH= GO111MODULE=off $(GO) get -u honnef.co/go/tools/cmd/staticcheck +endif +ifdef GOVENDOR .PHONY: $(GOVENDOR) $(GOVENDOR): GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor +endif + +.PHONY: precheck +precheck:: + +define PRECHECK_COMMAND_template = +precheck:: $(1)_precheck + + +PRECHECK_COMMAND_$(1) ?= $(1) $$(strip $$(PRECHECK_OPTIONS_$(1))) +.PHONY: $(1)_precheck +$(1)_precheck: + @if ! $$(PRECHECK_COMMAND_$(1)) 1>/dev/null 2>&1; then \ + echo "Execution of '$$(PRECHECK_COMMAND_$(1))' command failed. Is $(1) installed?"; \ + exit 1; \ + fi +endef
  16. Download patch api/prometheus/v1/api.go

    --- 0.9.0-1/api/prometheus/v1/api.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/api/prometheus/v1/api.go 2018-12-07 10:51:17.000000000 +0000 @@ -56,10 +56,12 @@ type HealthStatus string const ( // Possible values for ErrorType. ErrBadData ErrorType = "bad_data" - ErrTimeout = "timeout" - ErrCanceled = "canceled" - ErrExec = "execution" - ErrBadResponse = "bad_response" + ErrTimeout ErrorType = "timeout" + ErrCanceled ErrorType = "canceled" + ErrExec ErrorType = "execution" + ErrBadResponse ErrorType = "bad_response" + ErrServer ErrorType = "server_error" + ErrClient ErrorType = "client_error" // Possible values for HealthStatus. HealthGood HealthStatus = "up" @@ -69,8 +71,9 @@ const ( // Error is an error returned by the API. type Error struct { - Type ErrorType - Msg string + Type ErrorType + Msg string + Detail string } func (e *Error) Error() string { @@ -460,6 +463,16 @@ func apiError(code int) bool { return code == statusAPIError || code == http.StatusBadRequest } +func errorTypeAndMsgFor(resp *http.Response) (ErrorType, string) { + switch resp.StatusCode / 100 { + case 4: + return ErrClient, fmt.Sprintf("client error: %d", resp.StatusCode) + case 5: + return ErrServer, fmt.Sprintf("server error: %d", resp.StatusCode) + } + return ErrBadResponse, fmt.Sprintf("bad response code %d", resp.StatusCode) +} + func (c apiClient) Do(ctx context.Context, req *http.Request) (*http.Response, []byte, error) { resp, body, err := c.Client.Do(ctx, req) if err != nil { @@ -469,9 +482,11 @@ func (c apiClient) Do(ctx context.Contex code := resp.StatusCode if code/100 != 2 && !apiError(code) { + errorType, errorMsg := errorTypeAndMsgFor(resp) return resp, body, &Error{ - Type: ErrBadResponse, - Msg: fmt.Sprintf("bad response code %d", resp.StatusCode), + Type: errorType, + Msg: errorMsg, + Detail: string(body), } }
  17. Download patch CHANGELOG.md

    --- 0.9.0-1/CHANGELOG.md 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/CHANGELOG.md 2018-12-07 10:51:17.000000000 +0000 @@ -1,3 +1,23 @@ +## 0.9.2 / 2018-12-06 +* [FEATURE] Support for Go modules. #501 +* [FEATURE] `Timer.ObserveDuration` returns observed duration. #509 +* [ENHANCEMENT] Improved doc comments and error messages. #504 +* [BUGFIX] Fix race condition during metrics gathering. #512 +* [BUGFIX] Fix testutil metric comparison for Histograms and empty labels. #494 + #498 + +## 0.9.1 / 2018-11-03 +* [FEATURE] Add `WriteToTextfile` function to facilitate the creation of + *.prom files for the textfile collector of the node exporter. #489 +* [ENHANCEMENT] More descriptive error messages for inconsistent label + cardinality. #487 +* [ENHANCEMENT] Exposition: Use a GZIP encoder pool to avoid allocations in + high-frequency scrape scenarios. #366 +* [ENHANCEMENT] Exposition: Streaming serving of metrics data while encoding. + #482 +* [ENHANCEMENT] API client: Add a way to return the body of a 5xx response. + #479 + ## 0.9.0 / 2018-10-15 * [CHANGE] Go1.6 is no longer supported. * [CHANGE] More refinements of the `Registry` consistency checks: Duplicated
  18. Download patch debian/patches/series

    --- 0.9.0-1/debian/patches/series 2018-10-19 15:32:22.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/patches/series 2019-05-07 13:48:43.000000000 +0000 @@ -1,3 +1,3 @@ 01-Bug854687-Disable_flaky_test.patch 02-Disable_network_test.patch -03-Avoid_gogo_dependency.patch +bf1f4e4a246d1094eb9bf44b48b8793fb1df9413.patch
  19. Download patch prometheus/gauge.go

    --- 0.9.0-1/prometheus/gauge.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/gauge.go 2018-12-07 10:51:17.000000000 +0000 @@ -147,7 +147,7 @@ func NewGaugeVec(opts GaugeOpts, labelNa return &GaugeVec{ metricVec: newMetricVec(desc, func(lvs ...string) Metric { if len(lvs) != len(desc.variableLabels) { - panic(errInconsistentCardinality) + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs)) } result := &gauge{desc: desc, labelPairs: makeLabelPairs(desc, lvs)} result.init(result) // Init self-collection.
  20. Download patch api/prometheus/v1/api_test.go
  21. Download patch prometheus/desc.go

    --- 0.9.0-1/prometheus/desc.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/desc.go 2018-12-07 10:51:17.000000000 +0000 @@ -93,7 +93,7 @@ func NewDesc(fqName, help string, variab // First add only the const label names and sort them... for labelName := range constLabels { if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) + d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName) return d } labelNames = append(labelNames, labelName) @@ -115,7 +115,7 @@ func NewDesc(fqName, help string, variab // dimension with a different mix between preset and variable labels. for _, labelName := range variableLabels { if !checkLabelName(labelName) { - d.err = fmt.Errorf("%q is not a valid label name", labelName) + d.err = fmt.Errorf("%q is not a valid label name for metric %q", labelName, fqName) return d } labelNames = append(labelNames, "$"+labelName)
  22. Download patch prometheus/counter.go

    --- 0.9.0-1/prometheus/counter.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/counter.go 2018-12-07 10:51:17.000000000 +0000 @@ -136,7 +136,7 @@ func NewCounterVec(opts CounterOpts, lab return &CounterVec{ metricVec: newMetricVec(desc, func(lvs ...string) Metric { if len(lvs) != len(desc.variableLabels) { - panic(errInconsistentCardinality) + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, lvs)) } result := &counter{desc: desc, labelPairs: makeLabelPairs(desc, lvs)} result.init(result) // Init self-collection.
  23. Download patch prometheus/http.go

    --- 0.9.0-1/prometheus/http.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/http.go 2018-12-07 10:51:17.000000000 +0000 @@ -15,9 +15,7 @@ package prometheus import ( "bufio" - "bytes" "compress/gzip" - "fmt" "io" "net" "net/http" @@ -41,19 +39,10 @@ const ( acceptEncodingHeader = "Accept-Encoding" ) -var bufPool sync.Pool - -func getBuf() *bytes.Buffer { - buf := bufPool.Get() - if buf == nil { - return &bytes.Buffer{} - } - return buf.(*bytes.Buffer) -} - -func giveBuf(buf *bytes.Buffer) { - buf.Reset() - bufPool.Put(buf) +var gzipPool = sync.Pool{ + New: func() interface{} { + return gzip.NewWriter(nil) + }, } // Handler returns an HTTP handler for the DefaultGatherer. It is @@ -71,58 +60,40 @@ func Handler() http.Handler { // Deprecated: Use promhttp.HandlerFor(DefaultGatherer, promhttp.HandlerOpts{}) // instead. See there for further documentation. func UninstrumentedHandler() http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + return http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) { mfs, err := DefaultGatherer.Gather() if err != nil { - http.Error(w, "An error has occurred during metrics collection:\n\n"+err.Error(), http.StatusInternalServerError) + httpError(rsp, err) return } contentType := expfmt.Negotiate(req.Header) - buf := getBuf() - defer giveBuf(buf) - writer, encoding := decorateWriter(req, buf) - enc := expfmt.NewEncoder(writer, contentType) - var lastErr error + header := rsp.Header() + header.Set(contentTypeHeader, string(contentType)) + + w := io.Writer(rsp) + if gzipAccepted(req.Header) { + header.Set(contentEncodingHeader, "gzip") + gz := gzipPool.Get().(*gzip.Writer) + defer gzipPool.Put(gz) + + gz.Reset(w) + defer gz.Close() + + w = gz + } + + enc := expfmt.NewEncoder(w, contentType) + for _, mf := range mfs { if err := enc.Encode(mf); err != nil { - lastErr = err - http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError) + httpError(rsp, err) return } } - if closer, ok := writer.(io.Closer); ok { - closer.Close() - } - if lastErr != nil && buf.Len() == 0 { - http.Error(w, "No metrics encoded, last error:\n\n"+lastErr.Error(), http.StatusInternalServerError) - return - } - header := w.Header() - header.Set(contentTypeHeader, string(contentType)) - header.Set(contentLengthHeader, fmt.Sprint(buf.Len())) - if encoding != "" { - header.Set(contentEncodingHeader, encoding) - } - w.Write(buf.Bytes()) }) } -// decorateWriter wraps a writer to handle gzip compression if requested. It -// returns the decorated writer and the appropriate "Content-Encoding" header -// (which is empty if no compression is enabled). -func decorateWriter(request *http.Request, writer io.Writer) (io.Writer, string) { - header := request.Header.Get(acceptEncodingHeader) - parts := strings.Split(header, ",") - for _, part := range parts { - part = strings.TrimSpace(part) - if part == "gzip" || strings.HasPrefix(part, "gzip;") { - return gzip.NewWriter(writer), "gzip" - } - } - return writer, "" -} - var instLabels = []string{"method", "code"} type nower interface { @@ -503,3 +474,31 @@ func sanitizeCode(s int) string { return strconv.Itoa(s) } } + +// gzipAccepted returns whether the client will accept gzip-encoded content. +func gzipAccepted(header http.Header) bool { + a := header.Get(acceptEncodingHeader) + parts := strings.Split(a, ",") + for _, part := range parts { + part = strings.TrimSpace(part) + if part == "gzip" || strings.HasPrefix(part, "gzip;") { + return true + } + } + return false +} + +// httpError removes any content-encoding header and then calls http.Error with +// the provided error and http.StatusInternalServerErrer. Error contents is +// supposed to be uncompressed plain text. However, same as with a plain +// http.Error, any header settings will be void if the header has already been +// sent. The error message will still be written to the writer, but it will +// probably be of limited use. +func httpError(rsp http.ResponseWriter, err error) { + rsp.Header().Del(contentEncodingHeader) + http.Error( + rsp, + "An error has occurred while serving metrics:\n\n"+err.Error(), + http.StatusInternalServerError, + ) +}
  24. Download patch go.mod

    --- 0.9.0-1/go.mod 1970-01-01 00:00:00.000000000 +0000 +++ 0.9.2-0ubuntu3/go.mod 2018-12-07 10:51:17.000000000 +0000 @@ -0,0 +1,12 @@ +module github.com/prometheus/client_golang + +require ( + github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 + github.com/golang/protobuf v1.2.0 + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect + github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 + github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 + github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a + golang.org/x/net v0.0.0-20181201002055-351d144fa1fc + golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect +)
  25. Download patch VERSION

    --- 0.9.0-1/VERSION 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/VERSION 2018-12-07 10:51:17.000000000 +0000 @@ -1 +1 @@ -0.9.0 +0.9.2
  26. Download patch prometheus/wrap_test.go

    --- 0.9.0-1/prometheus/wrap_test.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/wrap_test.go 2018-12-07 10:51:17.000000000 +0000 @@ -19,7 +19,7 @@ import ( "strings" "testing" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" )
  27. Download patch prometheus/testutil/testutil_test.go

    --- 0.9.0-1/prometheus/testutil/testutil_test.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/testutil/testutil_test.go 2018-12-07 10:51:17.000000000 +0000 @@ -143,6 +143,104 @@ func TestCollectAndCompare(t *testing.T) } } +func TestCollectAndCompareNoLabel(t *testing.T) { + const metadata = ` + # HELP some_total A value that represents a counter. + # TYPE some_total counter + ` + + c := prometheus.NewCounter(prometheus.CounterOpts{ + Name: "some_total", + Help: "A value that represents a counter.", + }) + c.Inc() + + expected := ` + + some_total 1 + ` + + if err := CollectAndCompare(c, strings.NewReader(metadata+expected), "some_total"); err != nil { + t.Errorf("unexpected collecting result:\n%s", err) + } +} + +func TestCollectAndCompareHistogram(t *testing.T) { + inputs := []struct { + name string + c prometheus.Collector + metadata string + expect string + labels []string + observation float64 + }{ + { + name: "Testing Histogram Collector", + c: prometheus.NewHistogram(prometheus.HistogramOpts{ + Name: "some_histogram", + Help: "An example of a histogram", + Buckets: []float64{1, 2, 3}, + }), + metadata: ` + # HELP some_histogram An example of a histogram + # TYPE some_histogram histogram + `, + expect: ` + some_histogram{le="1"} 0 + some_histogram{le="2"} 0 + some_histogram{le="3"} 1 + some_histogram_bucket{le="+Inf"} 1 + some_histogram_sum 2.5 + some_histogram_count 1 + + `, + observation: 2.5, + }, + { + name: "Testing HistogramVec Collector", + c: prometheus.NewHistogramVec(prometheus.HistogramOpts{ + Name: "some_histogram", + Help: "An example of a histogram", + Buckets: []float64{1, 2, 3}, + }, []string{"test"}), + + metadata: ` + # HELP some_histogram An example of a histogram + # TYPE some_histogram histogram + `, + expect: ` + some_histogram_bucket{test="test",le="1"} 0 + some_histogram_bucket{test="test",le="2"} 0 + some_histogram_bucket{test="test",le="3"} 1 + some_histogram_bucket{test="test",le="+Inf"} 1 + some_histogram_sum{test="test"} 2.5 + some_histogram_count{test="test"} 1 + + `, + observation: 2.5, + }, + } + + for _, input := range inputs { + switch collector := input.c.(type) { + case prometheus.Histogram: + collector.Observe(input.observation) + case *prometheus.HistogramVec: + collector.WithLabelValues("test").Observe(input.observation) + default: + t.Fatalf("unsuported collector tested") + + } + + t.Run(input.name, func(t *testing.T) { + if err := CollectAndCompare(input.c, strings.NewReader(input.metadata+input.expect)); err != nil { + t.Errorf("unexpected collecting result:\n%s", err) + } + }) + + } +} + func TestNoMetricFilter(t *testing.T) { const metadata = ` # HELP some_total A value that represents a counter.
  28. Download patch debian/patches/bf1f4e4a246d1094eb9bf44b48b8793fb1df9413.patch

    --- 0.9.0-1/debian/patches/bf1f4e4a246d1094eb9bf44b48b8793fb1df9413.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/patches/bf1f4e4a246d1094eb9bf44b48b8793fb1df9413.patch 2019-05-07 13:48:43.000000000 +0000 @@ -0,0 +1,35 @@ +From bf1f4e4a246d1094eb9bf44b48b8793fb1df9413 Mon Sep 17 00:00:00 2001 +From: Bjoern Rabenstein <bjoern@rabenste.in> +Date: Fri, 3 May 2019 22:25:32 +0200 +Subject: [PATCH] Make TestCounterAddLarge more robust + +The previous `float64(math.MaxUint64 + 1)` is too close to +`float64(math.MaxUint64)` to actually overflow as indended. + +The counter code is actually converting forward and backward and +compare the original and twice-converted value. On most platform, this +will create a deviation and thus trigger the expected behavior. By +sheer "luck", one might end up with the same value and thus still use +the uint64 representation. Which is OK within the precision we can +expect. But it breaks the test. With this change, the next +representable floating point value greater than the floating point +value used to represent math.MaxUint64 is used. + +Signed-off-by: Bjoern Rabenstein <bjoern@rabenste.in> +--- + prometheus/counter_test.go | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/prometheus/counter_test.go b/prometheus/counter_test.go +index 5062f51a..fd98fb1c 100644 +--- a/prometheus/counter_test.go ++++ b/prometheus/counter_test.go +@@ -172,7 +172,7 @@ func TestCounterAddLarge(t *testing.T) { + }).(*counter) + + // large overflows the underlying type and should therefore be stored in valBits. +- large := float64(math.MaxUint64 + 1) ++ large := math.Nextafter(float64(math.MaxUint64), 1e20) + counter.Add(large) + if expected, got := large, math.Float64frombits(counter.valBits); expected != got { + t.Errorf("valBits expected %f, got %f.", expected, got)
  29. Download patch prometheus/histogram.go

    --- 0.9.0-1/prometheus/histogram.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/histogram.go 2018-12-07 10:51:17.000000000 +0000 @@ -165,7 +165,7 @@ func NewHistogram(opts HistogramOpts) Hi func newHistogram(desc *Desc, opts HistogramOpts, labelValues ...string) Histogram { if len(desc.variableLabels) != len(labelValues) { - panic(errInconsistentCardinality) + panic(makeInconsistentCardinalityError(desc.fqName, desc.variableLabels, labelValues)) } for _, n := range desc.variableLabels {
  30. Download patch prometheus/promhttp/http.go

    --- 0.9.0-1/prometheus/promhttp/http.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/promhttp/http.go 2018-12-07 10:51:17.000000000 +0000 @@ -32,7 +32,6 @@ package promhttp import ( - "bytes" "compress/gzip" "fmt" "io" @@ -53,19 +52,10 @@ const ( acceptEncodingHeader = "Accept-Encoding" ) -var bufPool sync.Pool - -func getBuf() *bytes.Buffer { - buf := bufPool.Get() - if buf == nil { - return &bytes.Buffer{} - } - return buf.(*bytes.Buffer) -} - -func giveBuf(buf *bytes.Buffer) { - buf.Reset() - bufPool.Put(buf) +var gzipPool = sync.Pool{ + New: func() interface{} { + return gzip.NewWriter(nil) + }, } // Handler returns an http.Handler for the prometheus.DefaultGatherer, using @@ -100,19 +90,18 @@ func HandlerFor(reg prometheus.Gatherer, inFlightSem = make(chan struct{}, opts.MaxRequestsInFlight) } - h := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + h := http.HandlerFunc(func(rsp http.ResponseWriter, req *http.Request) { if inFlightSem != nil { select { case inFlightSem <- struct{}{}: // All good, carry on. defer func() { <-inFlightSem }() default: - http.Error(w, fmt.Sprintf( + http.Error(rsp, fmt.Sprintf( "Limit of concurrent requests reached (%d), try again later.", opts.MaxRequestsInFlight, ), http.StatusServiceUnavailable) return } } - mfs, err := reg.Gather() if err != nil { if opts.ErrorLog != nil { @@ -123,26 +112,40 @@ func HandlerFor(reg prometheus.Gatherer, panic(err) case ContinueOnError: if len(mfs) == 0 { - http.Error(w, "No metrics gathered, last error:\n\n"+err.Error(), http.StatusInternalServerError) + // Still report the error if no metrics have been gathered. + httpError(rsp, err) return } case HTTPErrorOnError: - http.Error(w, "An error has occurred during metrics gathering:\n\n"+err.Error(), http.StatusInternalServerError) + httpError(rsp, err) return } } contentType := expfmt.Negotiate(req.Header) - buf := getBuf() - defer giveBuf(buf) - writer, encoding := decorateWriter(req, buf, opts.DisableCompression) - enc := expfmt.NewEncoder(writer, contentType) + header := rsp.Header() + header.Set(contentTypeHeader, string(contentType)) + + w := io.Writer(rsp) + if !opts.DisableCompression && gzipAccepted(req.Header) { + header.Set(contentEncodingHeader, "gzip") + gz := gzipPool.Get().(*gzip.Writer) + defer gzipPool.Put(gz) + + gz.Reset(w) + defer gz.Close() + + w = gz + } + + enc := expfmt.NewEncoder(w, contentType) + var lastErr error for _, mf := range mfs { if err := enc.Encode(mf); err != nil { lastErr = err if opts.ErrorLog != nil { - opts.ErrorLog.Println("error encoding metric family:", err) + opts.ErrorLog.Println("error encoding and sending metric family:", err) } switch opts.ErrorHandling { case PanicOnError: @@ -150,28 +153,15 @@ func HandlerFor(reg prometheus.Gatherer, case ContinueOnError: // Handled later. case HTTPErrorOnError: - http.Error(w, "An error has occurred during metrics encoding:\n\n"+err.Error(), http.StatusInternalServerError) + httpError(rsp, err) return } } } - if closer, ok := writer.(io.Closer); ok { - closer.Close() - } - if lastErr != nil && buf.Len() == 0 { - http.Error(w, "No metrics encoded, last error:\n\n"+lastErr.Error(), http.StatusInternalServerError) - return - } - header := w.Header() - header.Set(contentTypeHeader, string(contentType)) - header.Set(contentLengthHeader, fmt.Sprint(buf.Len())) - if encoding != "" { - header.Set(contentEncodingHeader, encoding) - } - if _, err := w.Write(buf.Bytes()); err != nil && opts.ErrorLog != nil { - opts.ErrorLog.Println("error while sending encoded metrics:", err) + + if lastErr != nil { + httpError(rsp, lastErr) } - // TODO(beorn7): Consider streaming serving of metrics. }) if opts.Timeout <= 0 { @@ -292,20 +282,30 @@ type HandlerOpts struct { Timeout time.Duration } -// decorateWriter wraps a writer to handle gzip compression if requested. It -// returns the decorated writer and the appropriate "Content-Encoding" header -// (which is empty if no compression is enabled). -func decorateWriter(request *http.Request, writer io.Writer, compressionDisabled bool) (io.Writer, string) { - if compressionDisabled { - return writer, "" - } - header := request.Header.Get(acceptEncodingHeader) - parts := strings.Split(header, ",") +// gzipAccepted returns whether the client will accept gzip-encoded content. +func gzipAccepted(header http.Header) bool { + a := header.Get(acceptEncodingHeader) + parts := strings.Split(a, ",") for _, part := range parts { part = strings.TrimSpace(part) if part == "gzip" || strings.HasPrefix(part, "gzip;") { - return gzip.NewWriter(writer), "gzip" + return true } } - return writer, "" + return false +} + +// httpError removes any content-encoding header and then calls http.Error with +// the provided error and http.StatusInternalServerErrer. Error contents is +// supposed to be uncompressed plain text. However, same as with a plain +// http.Error, any header settings will be void if the header has already been +// sent. The error message will still be written to the writer, but it will +// probably be of limited use. +func httpError(rsp http.ResponseWriter, err error) { + rsp.Header().Del(contentEncodingHeader) + http.Error( + rsp, + "An error has occurred while serving metrics:\n\n"+err.Error(), + http.StatusInternalServerError, + ) }
  31. Download patch debian/patches/03-Avoid_gogo_dependency.patch

    --- 0.9.0-1/debian/patches/03-Avoid_gogo_dependency.patch 2018-10-19 15:32:22.000000000 +0000 +++ 0.9.2-0ubuntu3/debian/patches/03-Avoid_gogo_dependency.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -Description: Avoid a spurious dependency on a second protobuf library. - ---- a/prometheus/wrap_test.go -+++ b/prometheus/wrap_test.go -@@ -19,7 +19,7 @@ - "strings" - "testing" - -- "github.com/gogo/protobuf/proto" -+ "github.com/golang/protobuf/proto" - - dto "github.com/prometheus/client_model/go" - )
  32. Download patch prometheus/labels.go

    --- 0.9.0-1/prometheus/labels.go 2018-10-15 14:52:39.000000000 +0000 +++ 0.9.2-0ubuntu3/prometheus/labels.go 2018-12-07 10:51:17.000000000 +0000 @@ -37,9 +37,22 @@ const reservedLabelPrefix = "__" var errInconsistentCardinality = errors.New("inconsistent label cardinality") +func makeInconsistentCardinalityError(fqName string, labels, labelValues []string) error { + return fmt.Errorf( + "%s: %q has %d variable labels named %q but %d values %q were provided", + errInconsistentCardinality, fqName, + len(labels), labels, + len(labelValues), labelValues, + ) +} + func validateValuesInLabels(labels Labels, expectedNumberOfValues int) error { if len(labels) != expectedNumberOfValues { - return errInconsistentCardinality + return fmt.Errorf( + "%s: expected %d label values but got %d in %#v", + errInconsistentCardinality, expectedNumberOfValues, + len(labels), labels, + ) } for name, val := range labels { @@ -53,7 +66,11 @@ func validateValuesInLabels(labels Label func validateLabelValues(vals []string, expectedNumberOfValues int) error { if len(vals) != expectedNumberOfValues { - return errInconsistentCardinality + return fmt.Errorf( + "%s: expected %d label values but got %d in %#v", + errInconsistentCardinality, expectedNumberOfValues, + len(vals), vals, + ) } for _, val := range vals {
  33. Download patch go.sum

    --- 0.9.0-1/go.sum 1970-01-01 00:00:00.000000000 +0000 +++ 0.9.2-0ubuntu3/go.sum 2018-12-07 10:51:17.000000000 +0000 @@ -0,0 +1,16 @@ +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275 h1:PnBWHBf+6L0jOqq0gIVUe6Yk0/QMZ640k6NvkxcBf+8= +github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= +github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0= +golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

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

Source: golang-golang-x-sys

golang-golang-x-sys (0.0~git20190726.fc99dfb-1ubuntu2) eoan; urgency=medium * No-change upload with strops.h and sys/strops.h removed in glibc. -- Matthias Klose <doko@ubuntu.com> Thu, 05 Sep 2019 13:38:12 +0200 golang-golang-x-sys (0.0~git20190726.fc99dfb-1ubuntu1) eoan; urgency=medium * Ignore a new test result for now, it fails in debian chroots in the very same way, also in ubuntu chroots (pbuilder). Might be some chroot configuration -- Gianfranco Costamagna <locutusofborg@debian.org> Wed, 28 Aug 2019 08:54:27 +0200

Modifications :
  1. Download patch debian/patches/series

    --- 0.0~git20190726.fc99dfb-1/debian/patches/series 2018-03-02 06:23:30.000000000 +0000 +++ 0.0~git20190726.fc99dfb-1ubuntu2/debian/patches/series 2019-08-28 06:54:27.000000000 +0000 @@ -1 +1,2 @@ 01-Fix-mips-build-issues.patch +ignore-failing-test-chroots.patch
  2. Download patch debian/patches/ignore-failing-test-chroots.patch

    --- 0.0~git20190726.fc99dfb-1/debian/patches/ignore-failing-test-chroots.patch 1970-01-01 00:00:00.000000000 +0000 +++ 0.0~git20190726.fc99dfb-1ubuntu2/debian/patches/ignore-failing-test-chroots.patch 2019-08-28 06:54:27.000000000 +0000 @@ -0,0 +1,18 @@ +Description: + Ignore test results for now, they fail in debian chroot in the very same + way, also in ubuntu chroots (pbuilder). Might be some chroot configuration + Note: in Debian this test is not run because of missing CAP_* capabilities. + This is a new test, so not a regression in Ubuntu toolchain +Author: Gianfranco Costamagna <locutusofborg@debian.org> +Last-Update: 2019-08-28 + +--- golang-golang-x-sys-0.0~git20190726.fc99dfb.orig/unix/syscall_linux_test.go ++++ golang-golang-x-sys-0.0~git20190726.fc99dfb/unix/syscall_linux_test.go +@@ -539,6 +539,7 @@ func TestClockNanosleep(t *testing.T) { + } + + func TestOpenByHandleAt(t *testing.T) { ++ t.Skip("cannot parse correctly /proc/self/mountinfo on chroots, ignoring test") + skipIfNotSupported := func(t *testing.T, name string, err error) { + if err == unix.EPERM { + t.Skipf("skipping %s test without CAP_DAC_READ_SEARCH", name)

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

Source: golang-google-grpc

golang-google-grpc (1.22.1-1ubuntu1) eoan; urgency=medium * Backport my patch from upstream to fix autopkgtests on ppc64el and s390x. -- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Tue, 27 Aug 2019 14:04:33 +1200

Modifications :
  1. Download patch debian/control

    --- 1.22.1-1/debian/control 2019-08-02 00:12:41.000000000 +0000 +++ 1.22.1-1ubuntu1/debian/control 2019-08-27 02:04:33.000000000 +0000 @@ -1,5 +1,6 @@ Source: golang-google-grpc -Maintainer: Debian Go Packaging Team <team+pkg-go@tracker.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Debian Go Packaging Team <team+pkg-go@tracker.debian.org> Uploaders: Dmitry Smirnov <onlyjob@debian.org>, Martín Ferrari <tincho@debian.org>, Tim Potter <tpot@hpe.com>,
  2. Download patch debian/patches/0001-credentials-alts-Assume-not-running-on-GCP-if-DMI-no.patch

    --- 1.22.1-1/debian/patches/0001-credentials-alts-Assume-not-running-on-GCP-if-DMI-no.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.22.1-1ubuntu1/debian/patches/0001-credentials-alts-Assume-not-running-on-GCP-if-DMI-no.patch 2019-08-27 02:04:33.000000000 +0000 @@ -0,0 +1,102 @@ +From d5a36f00e624a524866a651b9ed3e21282271e98 Mon Sep 17 00:00:00 2001 +From: Michael Hudson-Doyle <michael.hudson@canonical.com> +Date: Tue, 27 Aug 2019 12:06:13 +1200 +Subject: [PATCH] credentials/alts: Assume not running on GCP if DMI not + present (#2996) + +fixes #2995 +--- + credentials/alts/utils.go | 3 +++ + credentials/alts/utils_test.go | 47 ++++++++++++++++++++++++---------- + 2 files changed, 37 insertions(+), 13 deletions(-) + +diff --git a/credentials/alts/utils.go b/credentials/alts/utils.go +index 4ed27c60..f13aeef1 100644 +--- a/credentials/alts/utils.go ++++ b/credentials/alts/utils.go +@@ -83,6 +83,9 @@ var ( + // running on GCP. + func isRunningOnGCP() bool { + manufacturer, err := readManufacturer() ++ if os.IsNotExist(err) { ++ return false ++ } + if err != nil { + log.Fatalf("failure to read manufacturer information: %v", err) + } +diff --git a/credentials/alts/utils_test.go b/credentials/alts/utils_test.go +index 3c7e43db..8935c5fb 100644 +--- a/credentials/alts/utils_test.go ++++ b/credentials/alts/utils_test.go +@@ -21,6 +21,7 @@ package alts + import ( + "context" + "io" ++ "os" + "strings" + "testing" + +@@ -28,6 +29,34 @@ import ( + "google.golang.org/grpc/peer" + ) + ++func setupManufacturerReader(testOS string, reader func() (io.Reader, error)) func() { ++ tmpOS := runningOS ++ tmpReader := manufacturerReader ++ ++ // Set test OS and reader function. ++ runningOS = testOS ++ manufacturerReader = reader ++ return func() { ++ runningOS = tmpOS ++ manufacturerReader = tmpReader ++ } ++ ++} ++ ++func setup(testOS string, testReader io.Reader) func() { ++ reader := func() (io.Reader, error) { ++ return testReader, nil ++ } ++ return setupManufacturerReader(testOS, reader) ++} ++ ++func setupError(testOS string, err error) func() { ++ reader := func() (io.Reader, error) { ++ return nil, err ++ } ++ return setupManufacturerReader(testOS, reader) ++} ++ + func TestIsRunningOnGCP(t *testing.T) { + for _, tc := range []struct { + description string +@@ -53,20 +82,12 @@ func TestIsRunningOnGCP(t *testing.T) { + } + } + +-func setup(testOS string, testReader io.Reader) func() { +- tmpOS := runningOS +- tmpReader := manufacturerReader +- +- // Set test OS and reader function. +- runningOS = testOS +- manufacturerReader = func() (io.Reader, error) { +- return testReader, nil +- } +- +- return func() { +- runningOS = tmpOS +- manufacturerReader = tmpReader ++func TestIsRunningOnGCPNoProductNameFile(t *testing.T) { ++ reverseFunc := setupError("linux", os.ErrNotExist) ++ if isRunningOnGCP() { ++ t.Errorf("ErrNotExist: isRunningOnGCP()=true, want false") + } ++ reverseFunc() + } + + func TestAuthInfoFromContext(t *testing.T) { +-- +2.17.1 +
  3. Download patch debian/patches/series

    --- 1.22.1-1/debian/patches/series 2019-08-01 14:59:11.000000000 +0000 +++ 1.22.1-1ubuntu1/debian/patches/series 2019-08-27 02:04:33.000000000 +0000 @@ -1 +1,2 @@ +0001-credentials-alts-Assume-not-running-on-GCP-if-DMI-no.patch 01-Add-NewContext-and-FromContext-back-to-metadata-pack.patch

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

Source: libpoe-component-client-dns-perl

libpoe-component-client-dns-perl (1:1.054-1ubuntu1) yakkety; urgency=medium * Restore delta from 1:1.053-1ubuntu1, which apparently is still necessary (although it built properly without it in my pbuilder without network access). - debian/rules: Delete test 06, as it requires internet connectivity. -- Logan Rosen <logan@ubuntu.com> Fri, 24 Jun 2016 22:21:13 -0400

Modifications :
  1. Download patch debian/rules

    --- 1:1.054-1/debian/rules 2011-12-13 22:26:14.000000000 +0000 +++ 1:1.054-1ubuntu1/debian/rules 2016-06-25 02:21:10.000000000 +0000 @@ -2,3 +2,7 @@ %: dh $@ + +override_dh_auto_clean: + dh_auto_clean + rm -f t/06_hosts.t #delete test 06 as it requires internet connectivity
  2. Download patch debian/control

    --- 1:1.054-1/debian/control 2015-11-13 21:35:11.000000000 +0000 +++ 1:1.054-1ubuntu1/debian/control 2016-06-25 02:22:28.000000000 +0000 @@ -1,5 +1,6 @@ Source: libpoe-component-client-dns-perl -Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org> Uploaders: Jonathan Yu <jawnsy@cpan.org>, Antonio Radici <antonio@dyne.org>, Jose Luis Rivas <ghostbar38@gmail.com>,

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

Source: mtail

mtail (3.0.0~rc16-1ubuntu1) disco; urgency=medium * Build-depend on golang-race-detector-runtime on amd64 to fix FTBFS. -- Logan Rosen <logan@ubuntu.com> Sat, 17 Nov 2018 23:02:22 -0500

Modifications :
  1. Download patch debian/control

    --- 3.0.0~rc16-1/debian/control 2018-10-08 19:14:01.000000000 +0000 +++ 3.0.0~rc16-1ubuntu1/debian/control 2018-11-18 04:02:22.000000000 +0000 @@ -1,5 +1,6 @@ Source: mtail -Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: Debian Go Packaging Team <pkg-go-maintainers@lists.alioth.debian.org> Uploaders: Martín Ferrari <tincho@debian.org>, Section: net Testsuite: autopkgtest-pkg-go @@ -13,6 +14,7 @@ Build-Depends: debhelper (>= 11), golang-github-spf13-afero-dev (>= 0.0~git20170901), golang-glog-dev, golang-golang-x-tools, + golang-race-detector-runtime [amd64], tzdata, Standards-Version: 4.2.1 Vcs-Browser: https://salsa.debian.org/go-team/packages/mtail

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

Source: net-tools

net-tools (1.60+git20180626.aebd88e-1ubuntu1) disco; urgency=low * Merge from Debian unstable. Remaining changes: - Ubuntu_unit_conversion.patch: + Ubuntu Policy: output using standard SI unit multiples: KB (10^3), MB (10^6), GB (10^9), TB (10^12) and PB (10^15). Includes manpage update to remove comment about IEC units. -- Steve Langasek <steve.langasek@ubuntu.com> Fri, 01 Feb 2019 10:07:53 -0800

Modifications :
  1. Download patch debian/control

    --- 1.60+git20180626.aebd88e-1/debian/control 2018-09-24 19:08:57.000000000 +0000 +++ 1.60+git20180626.aebd88e-1ubuntu1/debian/control 2019-02-01 18:07:53.000000000 +0000 @@ -1,5 +1,6 @@ Source: net-tools -Maintainer: net-tools Team <team+net-tools@tracker.debian.org> +Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com> +XSBC-Original-Maintainer: net-tools Team <team+net-tools@tracker.debian.org> Uploaders: Martín Ferrari <tincho@debian.org>, Section: net Priority: important
  2. Download patch debian/patches/series

    --- 1.60+git20180626.aebd88e-1/debian/patches/series 2018-09-24 19:08:57.000000000 +0000 +++ 1.60+git20180626.aebd88e-1ubuntu1/debian/patches/series 2019-02-01 18:07:53.000000000 +0000 @@ -5,4 +5,5 @@ translations.patch Add_missing_headers.patch Bug_443075-ifconfig.c-pointtopoint_spelling.patch Bug_500913-man-en_US-route.8-EXAMPLES-Add-single-route-del.patch +Ubuntu_unit_conversion.patch Bug_900962-man-de-typos.patch
  3. Download patch debian/patches/Ubuntu_unit_conversion.patch

    --- 1.60+git20180626.aebd88e-1/debian/patches/Ubuntu_unit_conversion.patch 1970-01-01 00:00:00.000000000 +0000 +++ 1.60+git20180626.aebd88e-1ubuntu1/debian/patches/Ubuntu_unit_conversion.patch 2019-02-01 18:07:53.000000000 +0000 @@ -0,0 +1,98 @@ +Index: net-tools-1.60+git20180626.aebd88e-1ubuntu1/lib/interface.c +=================================================================== +--- net-tools-1.60+git20180626.aebd88e-1ubuntu1.orig/lib/interface.c ++++ net-tools-1.60+git20180626.aebd88e-1ubuntu1/lib/interface.c +@@ -866,45 +866,45 @@ + */ + rx = ptr->stats.rx_bytes; + short_rx = rx * 10; +- if (rx > 1125899906842624ull) { ++ if (rx > 1000000000000000ull) { + if (rx > (9223372036854775807ull / 10)) +- short_rx = rx / 112589990684262ull; ++ short_rx = rx / 1000000000000000ull; + else +- short_rx /= 1125899906842624ull; +- Rext = "PiB"; +- } else if (rx > 1099511627776ull) { +- short_rx /= 1099511627776ull; +- Rext = "TiB"; +- } else if (rx > 1073741824ull) { +- short_rx /= 1073741824ull; +- Rext = "GiB"; +- } else if (rx > 1048576) { +- short_rx /= 1048576; +- Rext = "MiB"; +- } else if (rx > 1024) { +- short_rx /= 1024; +- Rext = "KiB"; ++ short_rx /= 1000000000000000ull; ++ Rext = "PB"; ++ } else if (rx > 1000000000000ull) { ++ short_rx /= 1000000000000ull; ++ Rext = "TB"; ++ } else if (rx > 1000000000ull) { ++ short_rx /= 1000000000ull; ++ Rext = "GB"; ++ } else if (rx > 1000000) { ++ short_rx /= 1000000; ++ Rext = "MB"; ++ } else if (rx > 1000) { ++ short_rx /= 1000; ++ Rext = "KB"; + } + tx = ptr->stats.tx_bytes; + short_tx = tx * 10; +- if (tx > 1125899906842624ull) { ++ if (tx > 1000000000000000ull) { + if (tx > (9223372036854775807ull / 10)) +- short_tx = tx / 112589990684262ull; ++ short_tx = tx / 1000000000000000ull; + else +- short_tx /= 1125899906842624ull; +- Text = "PiB"; +- } else if (tx > 1099511627776ull) { +- short_tx /= 1099511627776ull; +- Text = "TiB"; +- } else if (tx > 1073741824ull) { +- short_tx /= 1073741824ull; +- Text = "GiB"; +- } else if (tx > 1048576) { +- short_tx /= 1048576; +- Text = "MiB"; +- } else if (tx > 1024) { +- short_tx /= 1024; +- Text = "KiB"; ++ short_tx /= 1000000000000000ull; ++ Text = "PB"; ++ } else if (tx > 1000000000000ull) { ++ short_tx /= 1000000000000ull; ++ Text = "TB"; ++ } else if (tx > 1000000000ull) { ++ short_tx /= 1000000000ull; ++ Text = "GB"; ++ } else if (tx > 1000000) { ++ short_tx /= 1000000; ++ Text = "MB"; ++ } else if (tx > 1000) { ++ short_tx /= 1000; ++ Text = "KB"; + } + + printf(" "); +Index: net-tools-1.60+git20180626.aebd88e-1ubuntu1/man/en_US/ifconfig.8 +=================================================================== +--- net-tools-1.60+git20180626.aebd88e-1ubuntu1.orig/man/en_US/ifconfig.8 ++++ net-tools-1.60+git20180626.aebd88e-1ubuntu1/man/en_US/ifconfig.8 +@@ -200,11 +200,6 @@ + .BR iptables (8) + command. + .LP +-Since net\-tools 1.60\-4 ifconfig is printing byte counters and human readable +-counters with IEC 60027-2 units. So 1 KiB are 2^10 byte. Note, the numbers +-are truncated to one decimal (which can by quite a large error if you +-consider 0.1 PiB is 112.589.990.684.262 bytes :) +-.LP + Interrupt problems with Ethernet device drivers fail with EAGAIN + .I (SIOCSIIFLAGS: Resource temporarily unavailable) + it is most likely a interrupt conflict. See
  1. consul
  2. golang-defaults
  3. golang-github-miekg-dns
  4. golang-github-prometheus-client-golang
  5. golang-golang-x-sys
  6. golang-google-grpc
  7. libpoe-component-client-dns-perl
  8. mtail
  9. net-tools