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 detecting format from filename ending with . #1994

Closed
Zash opened this issue Mar 29, 2024 · 2 comments
Closed

runtime error detecting format from filename ending with . #1994

Zash opened this issue Mar 29, 2024 · 2 comments
Labels

Comments

@Zash
Copy link
Contributor

Zash commented Mar 29, 2024

Describe the bug
Crash when given a filename that ends with a period ..

Version of yq: v4.43.1
Operating system: Debian 12
Installed via: Download from Github releases

~$ yq . some-file.
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x84fee0]

goroutine 1 [running]:
github.com/mikefarah/yq/v4/cmd.configureDecoder(0x0)
	/home/runner/work/yq/yq/cmd/utils.go:118 +0x40
github.com/mikefarah/yq/v4/cmd.evaluateSequence(0xc000200308, {0xc00003caa0, 0x2, 0x2})
	/home/runner/work/yq/yq/cmd/evaluate_sequence_command.go:112 +0x35d
github.com/spf13/cobra.(*Command).execute(0xc000200308, {0xc00003ca40, 0x2, 0x2})
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc000200008)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0xc000032720?)
	/home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13
main.main()
	/home/runner/work/yq/yq/yq.go:22 +0x1a8

Discovered because I had two files with similar names, differing only in file extension and autocomplete stopped at the ..

@mikefarah
Copy link
Owner

Thanks for raising, will fix in next release

@mikefarah
Copy link
Owner

Fixed in 4.44.1

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

No branches or pull requests

2 participants