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

v3.39 - panic when using dynamic vars #1867

Closed
antonosmond opened this issue Oct 17, 2024 · 2 comments
Closed

v3.39 - panic when using dynamic vars #1867

antonosmond opened this issue Oct 17, 2024 · 2 comments
Labels
state: can't repro Not enough information was given to reproduce the issue described.

Comments

@antonosmond
Copy link

In some cases, dynamic vars that worked in <= v3.38.0 result in a go panic in >= v3.39.0.

Version Info

  • Task version:
    • v3.39.0
    • v.3.39.1
    • v3.39.2
  • Operating system: MacOS Sonoma 14.6.1

To Reproduce

# create test yaml file
echo 'name: foobar' > example.yaml

# create taskfile
cat <<EOF > Taskfile.yaml
version: '3'
vars:
  NAME:
    sh: yq .name example.yaml
tasks:
  default: echo {{.NAME}}
EOF

The above works fine in version v3.38.0 - the NAME variable is dynamically populated with the result of the yq command and the task prints foobar as expected:

$ task --version
Task version: v3.38.0 (h1:O7kgA6BfwktXHPrheByQO46p3teKtRuq1EpGnFxNzbo=)
$ task
task: [default] echo foobar
foobar

In version v3.39.0 and greater, it panics:

$ task --version
Task version: v3.39.0 (h1:Loe6ppP1x38Puv1M2wigp91bH/garCt0vLWkJsiTWNI=)
$ task
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x28 pc=0x1007a06ec]

goroutine 1 [running]:
github.com/mikefarah/yq/v4/cmd.processStdInArgs({0x140000649c0?, 0x2, 0x2})
        github.com/mikefarah/yq/v4/cmd/utils.go:224 +0x3c
github.com/mikefarah/yq/v4/cmd.processArgs({0x140000649c0?, 0x23?, 0x0?})
        github.com/mikefarah/yq/v4/cmd/utils.go:256 +0x90
github.com/mikefarah/yq/v4/cmd.initCommand(0x14000127a68?, {0x140000649c0, 0x2, 0x2})
        github.com/mikefarah/yq/v4/cmd/utils.go:26 +0xa0
github.com/mikefarah/yq/v4/cmd.evaluateSequence(0x14000012900?, {0x140000649c0, 0x2, 0x2})
        github.com/mikefarah/yq/v4/cmd/evalute_sequence_command.go:65 +0x74
github.com/spf13/cobra.(*Command).execute(0x14000012900, {0x14000064960, 0x2, 0x2})
        github.com/spf13/[email protected]/command.go:940 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x14000012600)
        github.com/spf13/[email protected]/command.go:1068 +0x35c
github.com/spf13/cobra.(*Command).Execute(0x1400005b450?)
        github.com/spf13/[email protected]/command.go:992 +0x1c
main.main()
        github.com/mikefarah/yq/v4/yq.go:22 +0x1b0
task: Command "yq .name example.yaml" failed: exit status 2

Although the panic is from the yq binary, it must be something to do with the way the args are passed to the binary from go-task or the way the binary is invoked.

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Oct 17, 2024
@vmaerten
Copy link
Member

Hi!

I cannot reproduce :

image
You can try to run task -v to enable the verbose mode

@vmaerten vmaerten added state: can't repro Not enough information was given to reproduce the issue described. and removed state: needs triage Waiting to be triaged by a maintainer. labels Oct 17, 2024
@antonosmond
Copy link
Author

I upgraded to the same version of yq as you and now it's fine. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: can't repro Not enough information was given to reproduce the issue described.
Projects
None yet
Development

No branches or pull requests

3 participants