Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error (panic) when flattening an included Taskfile with a default task defined #1777

Closed
mgbowman opened this issue Aug 31, 2024 · 1 comment · Fixed by #1778
Closed
Assignees
Labels
type: bug Something not working as intended.

Comments

@mgbowman
Copy link

I'm excited for the new flatten feature that was recently merged to main and wanted to give it a try and came across this SIGSEGV panic...

# Taskfile.yml
version: '3'
includes:
  base: 
    taskfile: Taskfile.base.yml
    flatten: true

tasks:
  foo:
    - echo "foo"
---
# Taskfile.base.yml
version: '3'
tasks:
  default: # <-- this appears to be the culprit
    - echo "bar"

This panics ...

$ task -a
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x98 pc=0x865a21]

goroutine 6 [running]:
github.com/go-task/task/v3/taskfile/ast.(*Tasks).Merge(0xc00018c5a8, {{{0xc00011c740, 0x1, 0x1}, 0xc0001fa780}}, 0xc0001b25b0, 0xc00005e700?)
        /home/vscode/go/pkg/mod/github.com/go-task/task/[email protected]/taskfile/ast/tasks.go:122 +0x221
github.com/go-task/task/v3/taskfile/ast.(*Taskfile).Merge(0xc00018c500, 0xc00018cf00, 0xc0001b25b0)
        /home/vscode/go/pkg/mod/github.com/go-task/task/[email protected]/taskfile/ast/taskfile.go:58 +0x1eb
github.com/go-task/task/v3/taskfile/ast.(*TaskfileGraph).Merge.func1()
        /home/vscode/go/pkg/mod/github.com/go-task/task/[email protected]/taskfile/ast/graph.go:92 +0xdc
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /home/vscode/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
        /home/vscode/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x96

Looks like a nil pointer at taskfiles/ast/tasks.go:122


If I change the included task to bar ...

# Taskfile.base.yml
version: '3'
tasks:
  bar:
    - echo "bar"

...everything works as expected...

$ task -a
task: Available tasks for this project:
* bar:       
* foo: 

  • Task version: v3.38.1-0.20240826211905-a72b65b3b23c (h1:01ZCV3qmpxFkx17tDEDO4qQ/2uzXorCUl3lDtl56nVk=)
  • Operating system: Linux colima 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 9 17:03:36 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Experiments enabled: none
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Aug 31, 2024
@vmaerten vmaerten added type: bug Something not working as intended. and removed state: needs triage Waiting to be triaged by a maintainer. labels Aug 31, 2024
@vmaerten vmaerten self-assigned this Aug 31, 2024
@vmaerten
Copy link
Member

Hi!
Thanks for testing new features 🚀 and reporting this
I'll be fixed soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something not working as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants