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

closed stdin leads to runtime error: invalid memory address or nil pointer dereference #1868

Closed
aleskandro opened this issue Nov 17, 2023 · 0 comments · Fixed by #1867
Closed
Labels

Comments

@aleskandro
Copy link
Contributor

Describe the bug
When the stdin fd is closed in the env where yq runs, yq panics.

Version of yq: Since v4.26.1
Operating system: linux (at least)
Installed via: docker/binary

Input Yaml
data1.yml:

this: should really work

Command
The command you ran:

yq e data1.yaml <&-

Actual behavior

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x7028bb]

goroutine 1 [running]:
github.com/mikefarah/yq/v4/cmd.processStdInArgs({0xc000070700?, 0x2, 0x2})
        /home/runner/work/yq/yq/cmd/utils.go:131 +0x3b
github.com/mikefarah/yq/v4/cmd.processArgs({0xc000070700?, 0x0?, 0xc0001bdc68?})
        /home/runner/work/yq/yq/cmd/utils.go:163 +0xb5
github.com/mikefarah/yq/v4/cmd.initCommand(0x6fcaa6?, {0xc000070700, 0x2, 0x2})
        /home/runner/work/yq/yq/cmd/utils.go:22 +0x7f
github.com/mikefarah/yq/v4/cmd.evaluateSequence(0xc00011f900?, {0xc000070700, 0x2, 0x2})
        /home/runner/work/yq/yq/cmd/evalute_sequence_command.go:65 +0x9b
github.com/spf13/cobra.(*Command).execute(0xc00011f900, {0xc0000706a0, 0x2, 0x2})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc00011f680)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:990 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.5.0/command.go:918
main.main()
        /home/runner/work/yq/yq/yq.go:22 +0x1f1

Expected behavior

this: should really work

Additional context
Proposed PR #1867

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant