We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Parsing CSVs with empty fields fails with invalid memory address or nil pointer dereference in v4.29.1, not in v4.28.2.
invalid memory address or nil pointer dereference
v4.29.1
v4.28.2
Version of yq: 4.29.1 Operating system: linux/arm64 Installed via: GitHub release binary
Input CSV data1.yml:
col1,col2,col3,col4 field1,field2,,field4
data2.csv
col1,col2,col3,col4 field1,field2,x,field4
If the third field above is filled with anything, it works.
Command The command you ran:
./yq4.29.1 -p csv data1.csv
Actual behavior
$ ./yq4.29.1 -p csv data1.csv panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x3282bc] goroutine 1 [running]: github.com/mikefarah/yq/v4/pkg/yqlib.parseSnippet({0x400023c408, 0x0}) /home/runner/work/yq/yq/pkg/yqlib/lib.go:258 +0xdc github.com/mikefarah/yq/v4/pkg/yqlib.(*csvObjectDecoder).convertToYamlNode(0x408140?, {0x400023c408, 0x0}) /home/runner/work/yq/yq/pkg/yqlib/decoder_csv_object.go:32 +0x2c github.com/mikefarah/yq/v4/pkg/yqlib.(*csvObjectDecoder).createObject(0x4000214690?, {0x40002216c0, 0x4, 0x15?}, {0x4000221700, 0x4, 0x1?}) /home/runner/work/yq/yq/pkg/yqlib/decoder_csv_object.go:46 +0x160 github.com/mikefarah/yq/v4/pkg/yqlib.(*csvObjectDecoder).Decode(0x400026e300) /home/runner/work/yq/yq/pkg/yqlib/decoder_csv_object.go:67 +0x250 github.com/mikefarah/yq/v4/pkg/yqlib.(*streamEvaluator).Evaluate(0x4000369c70, {0xffffec7ff67e, 0x5}, {0x4fcaf8?, 0x400021a5a0?}, 0x2?, {0x4fed18, 0x400021a480}, {0x4fdee8, 0x400026e300}) /home/runner/work/yq/yq/pkg/yqlib/stream_evaluator.go:93 +0x9c github.com/mikefarah/yq/v4/pkg/yqlib.(*streamEvaluator).EvaluateFiles(0x42f900?, {0x0, 0x0}, {0x400023ea80, 0x1, 0x4000369b28?}, {0x4fed18, 0x400021a480}, {0x4fdee8, 0x400026e300}) /home/runner/work/yq/yq/pkg/yqlib/stream_evaluator.go:65 +0x144 github.com/mikefarah/yq/v4/cmd.evaluateSequence(0x4000244300?, {0x400023ea80, 0x1, 0x3}) /home/runner/work/yq/yq/cmd/evalute_sequence_command.go:132 +0x6e4 github.com/spf13/cobra.(*Command).execute(0x4000244300, {0x400023ea20, 0x3, 0x3}) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:916 +0x5e0 github.com/spf13/cobra.(*Command).ExecuteC(0x4000244000) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:1044 +0x368 github.com/spf13/cobra.(*Command).Execute(...) /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.6.1/command.go:968 main.main() /home/runner/work/yq/yq/yq.go:22 +0x1f0
Expected behavior
$ ./yq4.28.2 -p csv data1.csv - col1: field1 col2: field2 col3: "" col4: field4
The text was updated successfully, but these errors were encountered:
Argh! Yep that's def a bug, will try to get it fixed soon
Sorry, something went wrong.
Fixing null csv bug #1404
c887042
Fixed in 4.29.2
No branches or pull requests
Describe the bug
Parsing CSVs with empty fields fails with
invalid memory address or nil pointer dereference
inv4.29.1
, not inv4.28.2
.Version of yq: 4.29.1
Operating system: linux/arm64
Installed via: GitHub release binary
Input CSV
data1.yml:
data2.csv
If the third field above is filled with anything, it works.
Command
The command you ran:
Actual behavior
Expected behavior
$ ./yq4.28.2 -p csv data1.csv - col1: field1 col2: field2 col3: "" col4: field4
The text was updated successfully, but these errors were encountered: