WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Should not crash on parse errors #177

@birbilis

Description

@birbilis
  1. at "boss dependencies" command:

If one forgets a "," in dependencies list (if I remember well what the issue was there), they get error like the following one. Similar errors occur if one misses "," in JSON at other places.

Also similar errors (instead of some useful message pointing to where the parsing problem is) occur if one places Javascript comments in JSON (seems the spec doesn't support that thing at all, whereas XML files can have comments) from what I remember

[INFO ] Updating cache of dependency readcom.core.delphi
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x98 pc=0x12891f3]

goroutine 1 [running]:
github.com/hashload/boss/models.(*Package).GetParsedDependencies(...)
/home/runner/work/boss/boss/models/package.go:55
github.com/hashload/boss/cmd.printDeps(0x12f8700, {0xc0000c08c0, 0x8, 0xc0000a6340}, {{0xc0001d34a0, 0x46}, {0xc0001e4360, 0x20}, {0xc1cf822cc8cd901c, 0xa80f3e1, ...}, ...}, ...)
/home/runner/work/boss/boss/cmd/dependencies.go:83 +0x1f3
github.com/hashload/boss/cmd.printDependencies(0x0)
/home/runner/work/boss/boss/cmd/dependencies.go:65 +0x272
github.com/hashload/boss/cmd.glob..func1(0x180e300, {0x13912aa, 0x0, 0x0})
/home/runner/work/boss/boss/cmd/dependencies.go:44 +0x25
github.com/spf13/cobra.(*Command).execute(0x180e300, {0x1884170, 0x0, 0x0})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0x180f480)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/hashload/boss/cmd.Execute()
/home/runner/work/boss/boss/cmd/root.go:45 +0x151
main.main()
/home/runner/work/boss/boss/app.go:8 +0x17

  1. at "boss update" command (the case here was either a missing "," in a JSON array, or that in some packages I had an outer wrapping "package" node in the JSON (had found that from the web and discussing with copilot since I don't see any JSON Schema available for boss.json files to be able to validate them [and learn their syntax by checking out the schema - for examples I had tried searching for boss.json on github repos, but had found various syntaxes being used and also some other boss.json unrelated files [from other s/w])

[INFO ] Processing module zoomicon.helpers.rtl.delphi
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x90 pc=0xb5bc06]

goroutine 1 [running]:
github.com/hashload/boss/core/installer.EnsureDependencies({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0xc00002c270, 0x0)
/home/runner/work/boss/boss/core/installer/core.go:41 +0x66
github.com/hashload/boss/core/installer.processOthers({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0x68)
/home/runner/work/boss/boss/core/installer/core.go:95 +0x7f4
github.com/hashload/boss/core/installer.EnsureDependencies({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0xc0002602a0, 0x0)
/home/runner/work/boss/boss/core/installer/core.go:50 +0x19b
github.com/hashload/boss/core/installer.processOthers({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0x68)
/home/runner/work/boss/boss/core/installer/core.go:95 +0x7f4
github.com/hashload/boss/core/installer.EnsureDependencies({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0xc0002601c0, 0x0)
/home/runner/work/boss/boss/core/installer/core.go:50 +0x19b
github.com/hashload/boss/core/installer.processOthers({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0x68)
/home/runner/work/boss/boss/core/installer/core.go:95 +0x7f4
github.com/hashload/boss/core/installer.EnsureDependencies({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0xc000260000, 0x0)
/home/runner/work/boss/boss/core/installer/core.go:50 +0x19b
github.com/hashload/boss/core/installer.processOthers({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0x68)
/home/runner/work/boss/boss/core/installer/core.go:95 +0x7f4
github.com/hashload/boss/core/installer.EnsureDependencies({{0xc00026c500, 0x46}, {0xc00024e740, 0x20}, {0xc1cf7d9777f0c468, 0xa05afa1, 0x119ed80}, 0xc0001fbbc0}, 0xc0002600e0, 0x0)
/home/runner/work/boss/boss/core/installer/core.go:50 +0x19b
github.com/hashload/boss/core/installer.DoInstall(0xc0002600e0, 0x70)
/home/runner/work/boss/boss/core/installer/core.go:27 +0x114
github.com/hashload/boss/core/installer.LocalInstall({0x11f4170, 0xc0000c1d10, 0xb6ae83}, 0xc0002600e0, 0x3, 0x0)
/home/runner/work/boss/boss/core/installer/local.go:11 +0x67
github.com/hashload/boss/core.InstallModules({0x11f4170, 0x0, 0x0}, 0x0, 0x0)
/home/runner/work/boss/boss/core/installer.go:26 +0x192
github.com/hashload/boss/cmd.glob..func8(0x117e580, {0x11f4170, 0x0, 0x0})
/home/runner/work/boss/boss/cmd/update.go:14 +0x2b
github.com/spf13/cobra.(*Command).execute(0x117e580, {0x11f4170, 0x0, 0x0})
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:860 +0x5f8
github.com/spf13/cobra.(*Command).ExecuteC(0x117f480)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:974 +0x3bc
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:902
github.com/hashload/boss/cmd.Execute()
/home/runner/work/boss/boss/cmd/root.go:45 +0x151
main.main()
/home/runner/work/boss/boss/app.go:8 +0x17

in any case need more robust JSON parsing with detailed info on where error is. Or create a JSON schema (useful by itself anyway) and include a validation step (assuming there are json-schema libraries for Go) before trying to parse it with the current "quick & dirty" way)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions