go-task / task

A task runner / simpler Make alternative written in Go
https://taskfile.dev
MIT License
11.04k stars 587 forks source link

Task 3.22.0 test fails on Fedora 37 #1050

Closed mefuller closed 1 year ago

mefuller commented 1 year ago

Failing to build new package on Fedora due to a failed test:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.KPOjfc
+ umask 022
+ cd /builddir/build/BUILD
+ cd task-3.22.0
+ LDFLAGS=' -X github.com/go-task/task/version=3.22.0'
+ GO_TEST_FLAGS='-buildmode pie -compiler gc'
+ GO_TEST_EXT_LD_FLAGS='-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '
+ go-rpm-integration check -i github.com/go-task/task -b /builddir/build/BUILD/task-3.22.0/_build/bin -s /builddir/build/BUILD/task-3.22.0/_build -V 3.22.0-1.fc39 -p /builddir/build/BUILDROOT/golang-github-task-3.22.0-1.fc39.x86_64 -g /usr/share/gocode -r '.*example.*'
Testing    in: /builddir/build/BUILD/task-3.22.0/_build/src
         PATH: /builddir/build/BUILD/task-3.22.0/_build/bin:/builddir/.local/bin:/builddir/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/task-3.22.0/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags " -X github.com/go-task/task/version=3.22.0 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes  '"
      testing: github.com/go-task/task
github.com/go-task/task
--- FAIL: TestEmptyTask (0.00s)
    task_test.go:75: 
                Error Trace:    /builddir/build/BUILD/task-3.22.0/_build/src/github.com/go-task/task/task_test.go:75
                Error:          Received unexpected error:
                                task: Failed to parse testdata/empty_task/Taskfile.yml:
                                yaml: unmarshal errors:
                                  line 1: cannot unmarshal !!str `3` into semver.Version
                Test:           TestEmptyTask
                Messages:       e.Setup()
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa0 pc=0x55c7f5ec2071]

goroutine 6 [running]:
testing.tRunner.func1.2({0x55c7f60a2540, 0x55c7f631de20})
        /usr/lib/golang/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
        /usr/lib/golang/src/testing/testing.go:1529 +0x39f
panic({0x55c7f60a2540, 0x55c7f631de20})
        /usr/lib/golang/src/runtime/panic.go:884 +0x213
github.com/go-task/task.(*Executor).GetTask(0xc000148b40, {{0x55c7f5f2880a?, 0x55c7f5bdab08?}, 0x0?})
        /builddir/build/BUILD/task-3.22.0/_build/src/github.com/go-task/task/task.go:360 +0x51
github.com/go-task/task.(*Executor).Run(0xc000148b40, {0x55c7f60fe350, 0xc00001a0b8}, {0xc0000122d0, 0x1, 0x1})
        /builddir/build/BUILD/task-3.22.0/_build/src/github.com/go-task/task/task.go:78 +0x11e
github.com/go-task/task_test.TestEmptyTask(0x0?)
        /builddir/build/BUILD/task-3.22.0/_build/src/github.com/go-task/task/task_test.go:76 +0x129
testing.tRunner(0xc00014c9c0, 0x55c7f60f91b8)
        /usr/lib/golang/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
        /usr/lib/golang/src/testing/testing.go:1629 +0x3ea
exit status 2
FAIL    github.com/go-task/task 0.006s
error: Bad exit status from /var/tmp/rpm-tmp.KPOjfc (%check)
    Bad exit status from /var/tmp/rpm-tmp.KPOjfc (%check)
andreynering commented 1 year ago

Hi @mefuller,

It's curious that you have this failing test because on our machines and on CI it passed.

We indeed reintroduced the Masterminds/semver package as a dependency this release, which seems to be the cause of the fail for you.

Can you check that you're properly updating your dependencies according to go.mod? It seems to me that you may be trying to compile having an older version of this package.

mefuller commented 1 year ago

I'm downloading a clean tarball from github for the build The SHA256 checksum is: 9abe03f06bac507bc8a153bd94ccbe5cde324ee120da7d596b1845ae4e8e3d53 task-3.22.0.tar.gz

The go.mod file:

module github.com/go-task/task/v3

go 1.19

require (
        github.com/Masterminds/semver/v3 v3.2.0
        github.com/fatih/color v1.14.1
        github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0
        github.com/golang/mock v1.6.0
        github.com/joho/godotenv v1.5.1
        github.com/mattn/go-zglob v0.0.4
        github.com/mitchellh/hashstructure/v2 v2.0.2
        github.com/radovskyb/watcher v1.0.7
        github.com/sajari/fuzzy v1.0.0
        github.com/spf13/pflag v1.0.5
        github.com/stretchr/testify v1.8.1
        golang.org/x/exp v0.0.0-20230212135524-a684f29349b6
        golang.org/x/sync v0.1.0
        gopkg.in/yaml.v3 v3.0.1
        mvdan.cc/sh/v3 v3.6.0
)

require (
        github.com/davecgh/go-spew v1.1.1 // indirect
        github.com/mattn/go-colorable v0.1.13 // indirect
        github.com/mattn/go-isatty v0.0.17 // indirect
        github.com/pmezard/go-difflib v1.0.0 // indirect
        golang.org/x/sys v0.3.0 // indirect
        golang.org/x/term v0.3.0 // indirect
        gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)

The Fedora golang-github-masterminds-semver is v3.1.1 - perhaps this is the issue.

I will investigate further.

andreynering commented 1 year ago

The Fedora golang-github-masterminds-semver is v3.1.1 - perhaps this is the issue.

I believe so. It should be using v3.2.0 as pinned in the go.mod file.

I don't know how packaging works on Fedora, or why you seems not to be using Go modules, but I would recommend you to use Go modules to build if possible. This should guarantee that you're using the right version of each dependency.

mefuller commented 1 year ago

I'll check the buildlog again to see if any warning about the version showed up, but Fedora and Debian both (and I started the packaging process for Debian) unbundle dependencies. GitHub.com/Masterminds/semver/v3 is its own package that is maintained separately. I opened a PR to update our package and will rebuild once available.