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

Error while merge files with Russian letters in comment #368

Closed
il1yaz opened this issue Feb 25, 2020 · 3 comments
Closed

Error while merge files with Russian letters in comment #368

il1yaz opened this issue Feb 25, 2020 · 3 comments
Labels

Comments

@il1yaz
Copy link

il1yaz commented Feb 25, 2020

Describe the bug
Error while merging yaml files

Input Yaml
data1.yml:

value: newValue  

data2.yml:

value: newValue #проверить

Command
The command you ran:

yq m -x data1.yaml data2.yaml

Actual behavior

panic: runtime error: index out of range [10] with length 10 [recovered]
        panic: runtime error: index out of range [10] with length 10

goroutine 1 [running]:
gopkg.in/yaml%2ev3.handleErr(0xc000071878)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/yaml.go:276 +0xa1
panic(0x65b080, 0xc0000be660)
        /usr/local/Cellar/go/1.13.3/libexec/src/runtime/panic.go:679 +0x1c0
gopkg.in/yaml%2ev3.write(0xc000040380, 0xc0000c0730, 0xa, 0x10, 0xc000070528, 0x525f01)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/emitterc.go:93 +0x210
gopkg.in/yaml%2ev3.yaml_emitter_write_comment(0xc000040380, 0xc0000c0730, 0xa, 0x10, 0x1)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/emitterc.go:1978 +0xd2
gopkg.in/yaml%2ev3.yaml_emitter_process_line_comment(0xc000040380, 0xc00011c440)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/emitterc.go:1128 +0x71
gopkg.in/yaml%2ev3.yaml_emitter_emit_block_mapping_value(0xc000040380, 0xc00011c440, 0xc000070601, 0x1)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/emitterc.go:817 +0xeb
gopkg.in/yaml%2ev3.yaml_emitter_state_machine(0xc000040380, 0xc00011c440, 0xc0000be401)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/emitterc.go:303 +0x424
gopkg.in/yaml%2ev3.yaml_emitter_emit(0xc000040380, 0xc0000405c0, 0x85d020)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/emitterc.go:153 +0x14e
gopkg.in/yaml%2ev3.(*encoder).emit(0xc000040380)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/encode.go:81 +0x40
gopkg.in/yaml%2ev3.(*encoder).node(0xc000040380, 0xc0000f3a40, 0x0, 0x0)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/encode.go:504 +0xd32
gopkg.in/yaml%2ev3.(*encoder).node(0xc000040380, 0xc0000f3900, 0x0, 0x0)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/encode.go:448 +0x224
gopkg.in/yaml%2ev3.(*encoder).nodev(0xc000040380, 0x64a640, 0xc0000f3900, 0x16)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/encode.go:406 +0x80
gopkg.in/yaml%2ev3.(*encoder).marshalDoc(0xc000040380, 0x0, 0x0, 0x64a640, 0xc0000f3900, 0x16)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/encode.go:101 +0x22f
gopkg.in/yaml%2ev3.(*Encoder).Encode(0xc0001060a0, 0x64a640, 0xc0000f3900, 0x0, 0x0)
        /Users/mikefarah/dev/go/pkg/mod/gopkg.in/yaml.v3@v3.0.0-20200121175148-a6ecf24a6d71/yaml.go:251 +0x105
github.com/mikefarah/yq/v3/pkg/yqlib.(*yamlEncoder).Encode(0xc0001060a8, 0xc0000f3900, 0x0, 0x0)
        /Users/mikefarah/dev/go/src/github.com/mikefarah/yq/pkg/yqlib/encoder.go:28 +0x4b
github.com/mikefarah/yq/v3/cmd.mapYamlDecoder.func1(0xc0000d08e0, 0xc0000d08e0, 0x600)
        /Users/mikefarah/dev/go/src/github.com/mikefarah/yq/cmd/utils.go:249 +0x280
github.com/mikefarah/yq/v3/cmd.readStream(0xc00000c2a0, 0x2b, 0xc0000ce560, 0x0, 0x0)
        /Users/mikefarah/dev/go/src/github.com/mikefarah/yq/cmd/utils.go:457 +0x25a
github.com/mikefarah/yq/v3/cmd.readAndUpdate(0x6c5da0, 0xc000006018, 0xc00000c2a0, 0x2b, 0xc0000d2e70, 0x0, 0x0)
        /Users/mikefarah/dev/go/src/github.com/mikefarah/yq/cmd/utils.go:337 +0x263
github.com/mikefarah/yq/v3/cmd.updateDoc(0xc00000c2a0, 0x2b, 0xc0000d2e40, 0x1, 0x1, 0x6c5da0, 0xc000006018, 0x1, 0x0)
        /Users/mikefarah/dev/go/src/github.com/mikefarah/yq/cmd/utils.go:296 +0xdd
github.com/mikefarah/yq/v3/cmd.mergeProperties(0xc0000f1680, 0xc0000d2b10, 0x2, 0x3, 0x0, 0x0)
        /Users/mikefarah/dev/go/src/github.com/mikefarah/yq/cmd/merge.go:73 +0x426
github.com/spf13/cobra.(*Command).execute(0xc0000f1680, 0xc0000d29f0, 0x3, 0x3, 0xc0000f1680, 0xc0000d29f0)
        /Users/mikefarah/dev/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826 +0x467
github.com/spf13/cobra.(*Command).ExecuteC(0xc0000f0280, 0x2, 0xc0000d29c0, 0xc000046058)
        /Users/mikefarah/dev/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x302
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/mikefarah/dev/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
main.main()
        /Users/mikefarah/dev/go/src/github.com/mikefarah/yq/yq.go:13 +0x67

Expected behavior

value: newValue #проверить

Additional context
Exception apperars because i am using Russian letters in comments
yq verision 2.4.1 works fine ( maybe because it's ignoring comments)

@il1yaz il1yaz added the bug label Feb 25, 2020
@mikefarah
Copy link
Owner

Appears to be a bug in the underlying yaml.v3 parser I'm using

go-yaml/yaml#538

@mikefarah
Copy link
Owner

I also raised this which appears to be related: go-yaml/yaml#578

@mikefarah
Copy link
Owner

This has been fixed in 3.3.2

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