Skip to content

Calling a command with an FQBN with unexisting package or architecture causes a panic #1531

Closed
@silvanocerza

Description

@silvanocerza

Bug Report

Current behavior

$ arduino-cli compile -b aduino:avr:uno ~/Documents/Arduino/Blink/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x10128f424]

goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*Platform).String(...)
	/Users/alien/workspace/arduino-cli/arduino/cores/cores.go:262
github.com/arduino/arduino-cli/commands/compile.Compile(0x1016a14a0, 0x1400003c0c8, 0x140001c5c58, 0x10168e3a8, 0x14000010018, 0x10168e3a8, 0x14000010020, 0x14000412d00, 0x0, 0x0, ...)
	/Users/alien/workspace/arduino-cli/commands/compile/compile.go:127 +0xa44
github.com/arduino/arduino-cli/cli/compile.run(0x140003faf00, 0x140004124e0, 0x1, 0x3)
	/Users/alien/workspace/arduino-cli/cli/compile/compile.go:194 +0x41c
github.com/spf13/cobra.(*Command).execute(0x140003faf00, 0x140004124b0, 0x3, 0x3, 0x140003faf00, 0x140004124b0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x1d0
github.com/spf13/cobra.(*Command).ExecuteC(0x14000301680, 0x1, 0x1, 0x0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x264
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
	/Users/alien/workspace/arduino-cli/main.go:31 +0xd4
$ arduino-cli compile -b arduino:av:uno ~/Documents/Arduino/Blink/
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x38 pc=0x1032df424]

goroutine 1 [running]:
github.com/arduino/arduino-cli/arduino/cores.(*Platform).String(...)
	/Users/alien/workspace/arduino-cli/arduino/cores/cores.go:262
github.com/arduino/arduino-cli/commands/compile.Compile(0x1036f14a0, 0x140001a4008, 0x1400009bc58, 0x1036de3a8, 0x140001b0008, 0x1036de3a8, 0x140001b0010, 0x1400043cd00, 0x0, 0x0, ...)
	/Users/alien/workspace/arduino-cli/commands/compile/compile.go:127 +0xa44
github.com/arduino/arduino-cli/cli/compile.run(0x14000426f00, 0x1400043c4e0, 0x1, 0x3)
	/Users/alien/workspace/arduino-cli/cli/compile/compile.go:194 +0x41c
github.com/spf13/cobra.(*Command).execute(0x14000426f00, 0x1400043c4b0, 0x3, 0x3, 0x14000426f00, 0x1400043c4b0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x1d0
github.com/spf13/cobra.(*Command).ExecuteC(0x1400032d680, 0x1, 0x1, 0x0)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x264
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/alien/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902
main.main()
	/Users/alien/workspace/arduino-cli/main.go:31 +0xd4

Expected behavior

A clear message must tell the user that the package or architecture doesn't exist. A similar error to the one shown when specifying an FQBN with a non existing board ID.

$ arduino-cli compile -b arduino:avr:uo ~/Documents/Arduino/Blink/

Error during build: Error resolving FQBN: board arduino:avr:uo not found

Environment

  • CLI version (output of arduino-cli version): arduino-cli alpha Version: git-snapshot Commit: 4ce87fe7 Date: 2021-10-22T10:26:14Z
  • OS and platform: Doesn't matter

Additional context

None.

Metadata

Metadata

Assignees

Labels

conclusion: resolvedIssue was resolvedtopic: CLIRelated to the command line interfacetopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions