task 2.8.1 panic with empty task

Created on 5 Jun 2020  路  5Comments  路  Source: go-task/task

Both these Taskfiles cause task to panic:

version: '2'

tasks:
  foo:

and (so default is not a special case)

version: '2'

tasks:
  default:

Panic is:

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

goroutine 1 [running]:
github.com/go-task/task/v2/internal/taskfile/read.Taskfile(0x0, 0x0, 0x139e0cb, 0xc, 0xc000060460, 0x5, 0x5)
        /home/runner/work/task/task/internal/taskfile/read/taskfile.go:64 +0x5c1
github.com/go-task/task/v2.(*Executor).Setup(0xc00007c2c0, 0xc00007c2c0, 0x0)
        /home/runner/work/task/task/task.go:109 +0x89
main.main()
        /home/runner/work/task/task/cmd/task/task.go:135 +0x989

Happening with task 2.8.1 on macOS.

bug good first issue

Most helpful comment

I'm not sure why someone would write an empty task.

By mistake :-)

I had a partially commented-out task, which resulted in the equivalent of the reproduction case I added in the issue.

To me, any crash, especially with a so simple input, deserves an attempt to be fixed :-)

All 5 comments

I'm not sure why someone would write an empty task.

Seems worth fixing it though, since it'd be pretty easy.

I'm not sure why someone would write an empty task.

By mistake :-)

I had a partially commented-out task, which resulted in the equivalent of the reproduction case I added in the issue.

To me, any crash, especially with a so simple input, deserves an attempt to be fixed :-)

I can work on this :)

Fixed on d78f78bb5cdd94fec59244121bdc1130547beb2b

thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fj picture fj  路  4Comments

andreynering picture andreynering  路  7Comments

smyrman picture smyrman  路  8Comments

stelcheck picture stelcheck  路  10Comments

antonmarin picture antonmarin  路  8Comments