Bug#952188: golang-github-mendersoftware-scopestack: FTBFS: dh_auto_test: error: cd obj-x86_64-linux-gnu && go test -vet=off -v -p 4 github.com/mendersoftware/scopestack returned exit code 1
On Mon, Mar 02, 2020 at 09:38:00AM +0100, Lluis Campos wrote: > Hello, > > The patch looks good to us. Thanks Andreas for following up! > > Side note. We have discussed internally and decided that we will remove > both scopestack and log[1] dependencies from the mender-client code. > This will ease maintenance of the Debian package :) Thanks for the feedback on the patch and the future roadmap! I'll upload the patched scopestack for now and will be looking forward to being able to request package removal later once new releases are out and we have everything updated. Regards, Andreas Henriksson
Bug#952188: golang-github-mendersoftware-scopestack: FTBFS: dh_auto_test: error: cd obj-x86_64-linux-gnu && go test -vet=off -v -p 4 github.com/mendersoftware/scopestack returned exit code 1
Hello, On Mon, 2020-03-02 at 02:39 +0100, Andreas Henriksson wrote: > Hello, > > On Sun, Feb 23, 2020 at 02:08:07PM +0100, Lucas Nussbaum wrote: > > Source: golang-github-mendersoftware-scopestack > > Version: 0.0~git20180403.c2f5599-2 > [...] > > > === RUN TestPushPopNotInSameFunction > > > --- FAIL: TestPushPopNotInSameFunction (0.00s) > > > scope_stack_test.go:57: Should never get here > > > scope_stack_test.go:52: Pop() should have panicked when used > > > in a different function than Push() > > > === RUN TestDifferentScopeDistance > > > --- FAIL: TestDifferentScopeDistance (0.00s) > > > scope_stack_test.go:95: Should never get here > > > scope_stack_test.go:89: Should have panicked because scope > > > stack distance should point to this function > [...] > > I assume the problem is caused by newer golang. It appears that > atleast > nowadays (with go1.13.8) an inlined (anonymous) function will have > the same Func(tion) Entry(point) as the parent function it was > inlined > into, eg. as used in the TestPushPopNotInSameFunction testcase. > > The two Func(tions) however will have different Name()s, so simply > adding those to the Entry() comparisons will make the test-suite pass > again. See attached patch. > > I'm not quite sure if this is the most robust fix, so would be great > to > have some feedback from upstream (hopefully via Lluis in CC). The patch looks good to us. Thanks Andreas for following up! Side note. We have discussed internally and decided that we will remove both scopestack and log[1] dependencies from the mender-client code. This will ease maintenance of the Debian package :) [1] https://tracker.debian.org/pkg/golang-github-mendersoftware-log -- LluĂs | mender.io > > Some semi-relevant discussion is available at: > https://github.com/golang/go/issues/29582 > ... where it's discussed that rather than runtime.Caller and > FuncForPC > it's better to use runtime.Callers and runtime.CallersFrames which is > supposed to deal properly with inlining, whatever that means. > > Regards, > Andreas Henriksson
Bug#952188: golang-github-mendersoftware-scopestack: FTBFS: dh_auto_test: error: cd obj-x86_64-linux-gnu && go test -vet=off -v -p 4 github.com/mendersoftware/scopestack returned exit code 1
Hello, On Sun, Feb 23, 2020 at 02:08:07PM +0100, Lucas Nussbaum wrote: > Source: golang-github-mendersoftware-scopestack > Version: 0.0~git20180403.c2f5599-2 [...] > > === RUN TestPushPopNotInSameFunction > > --- FAIL: TestPushPopNotInSameFunction (0.00s) > > scope_stack_test.go:57: Should never get here > > scope_stack_test.go:52: Pop() should have panicked when used in a > > different function than Push() > > === RUN TestDifferentScopeDistance > > --- FAIL: TestDifferentScopeDistance (0.00s) > > scope_stack_test.go:95: Should never get here > > scope_stack_test.go:89: Should have panicked because scope stack > > distance should point to this function [...] I assume the problem is caused by newer golang. It appears that atleast nowadays (with go1.13.8) an inlined (anonymous) function will have the same Func(tion) Entry(point) as the parent function it was inlined into, eg. as used in the TestPushPopNotInSameFunction testcase. The two Func(tions) however will have different Name()s, so simply adding those to the Entry() comparisons will make the test-suite pass again. See attached patch. I'm not quite sure if this is the most robust fix, so would be great to have some feedback from upstream (hopefully via Lluis in CC). Some semi-relevant discussion is available at: https://github.com/golang/go/issues/29582 ... where it's discussed that rather than runtime.Caller and FuncForPC it's better to use runtime.Callers and runtime.CallersFrames which is supposed to deal properly with inlining, whatever that means. Regards, Andreas Henriksson >From fd8f4d2fcd0ee6e541d7e7dd3e66a94b570a93ad Mon Sep 17 00:00:00 2001 From: Andreas Henriksson Date: Mon, 2 Mar 2020 02:21:35 +0100 Subject: [PATCH] Also compare function names to catch inlined funcs Inlined Func will have the same Entry value as the parent Func it was inlined into. It will however have a different Name(), so compare that as well. --- scope_stack.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scope_stack.go b/scope_stack.go index bf68c81..f900752 100644 --- a/scope_stack.go +++ b/scope_stack.go @@ -17,6 +17,7 @@ package scopestack import "fmt" import "container/list" import "runtime" +import "strings" // A stack type that tries to verify that each push and pop happens in the same // function. @@ -82,7 +83,7 @@ func (self *ScopeStack) Pop() interface{} { oldFunc := runtime.FuncForPC(*oldFrame) newFunc := runtime.FuncForPC(newFrame) - if oldFunc.Entry() != newFunc.Entry() { + if oldFunc.Entry() != newFunc.Entry() || strings.Compare(oldFunc.Name(), newFunc.Name()) != 0 { oldFile, oldLine := oldFunc.FileLine(*oldFrame) newFile, newLine := newFunc.FileLine(newFrame) msg := fmt.Sprintf("Unbalanced ScopeStack.Pop(). "+ -- 2.20.1
Bug#952188: golang-github-mendersoftware-scopestack: FTBFS: dh_auto_test: error: cd obj-x86_64-linux-gnu && go test -vet=off -v -p 4 github.com/mendersoftware/scopestack returned exit code 1
Source: golang-github-mendersoftware-scopestack Version: 0.0~git20180403.c2f5599-2 Severity: serious Justification: FTBFS on amd64 Tags: bullseye sid ftbfs Usertags: ftbfs-20200222 ftbfs-bullseye Hi, During a rebuild of all packages in sid, your package failed to build on amd64. Relevant part (hopefully): > debian/rules build > dh build --buildsystem=golang --with=golang >dh_update_autotools_config -O--buildsystem=golang >dh_autoreconf -O--buildsystem=golang >dh_auto_configure -O--buildsystem=golang >dh_auto_build -O--buildsystem=golang > cd obj-x86_64-linux-gnu && go install -trimpath -v -p 4 > github.com/mendersoftware/scopestack > container/list > runtime/internal/atomic > internal/cpu > runtime/internal/sys > runtime/internal/math > math/bits > unicode/utf8 > internal/race > sync/atomic > unicode > internal/bytealg > math > internal/testlog > runtime > internal/reflectlite > sync > errors > sort > io > strconv > internal/oserror > syscall > reflect > internal/syscall/unix > time > internal/poll > internal/fmtsort > os > fmt > github.com/mendersoftware/scopestack >dh_auto_test -O--buildsystem=golang > cd obj-x86_64-linux-gnu && go test -vet=off -v -p 4 > github.com/mendersoftware/scopestack > === RUN TestLicenses > --- PASS: TestLicenses (0.00s) > === RUN TestPushPop > --- PASS: TestPushPop (0.00s) > === RUN TestTooMuchPopping > --- PASS: TestTooMuchPopping (0.00s) > === RUN TestPopInDefer > --- PASS: TestPopInDefer (0.00s) > === RUN TestPushPopNotInSameFunction > --- FAIL: TestPushPopNotInSameFunction (0.00s) > scope_stack_test.go:57: Should never get here > scope_stack_test.go:52: Pop() should have panicked when used in a > different function than Push() > === RUN TestDifferentScopeDistance > --- FAIL: TestDifferentScopeDistance (0.00s) > scope_stack_test.go:95: Should never get here > scope_stack_test.go:89: Should have panicked because scope stack distance > should point to this function > FAIL > FAIL github.com/mendersoftware/scopestack0.002s > FAIL > dh_auto_test: error: cd obj-x86_64-linux-gnu && go test -vet=off -v -p 4 > github.com/mendersoftware/scopestack returned exit code 1 The full build log is available from: http://qa-logs.debian.net/2020/02/22/golang-github-mendersoftware-scopestack_0.0~git20180403.c2f5599-2_unstable.log A list of current common problems and possible solutions is available at http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute! About the archive rebuild: The rebuild was done on EC2 VM instances from Amazon Web Services, using a clean, minimal and up-to-date chroot. Every failed build was retried once to eliminate random failures.