Skip to content

Fwupload crash if the tools for the current OS are missing #211

Closed
@cmaglie

Description

@cmaglie

Describe the problem

This is the panic as reported by an user of the Arduino Create Agent:

  "Msg": "panic: runtime error: invalid memory address or nil pointer dereference",
  "Msg": "[signal 0xc0000005 code=0x0 addr=0x20 pc=0x90475d]",
  "Msg": "",
  "Msg": "goroutine 1 [running]:",
  "Msg": "github.com/arduino/arduino-cli/arduino/resources.(*DownloadResource).ArchivePath(0x0, 0x125125c0)",
  "Msg": "    /home/runner/go/pkg/mod/github.com/arduino/arduino-cli@v0.0.0-20230613145607-5725c0273235/arduino/resources/helpers.go:27 +0x2d",
  "Msg": "github.com/arduino/arduino-fwuploader/indexes/download.DownloadTool(0x1281a0c0)",
  "Msg": "    /home/runner/work/arduino-fwuploader/arduino-fwuploader/indexes/download/download.go:57 +0x295",
  "Msg": "github.com/arduino/arduino-fwuploader/cli/common.downloadTool(0x126e3450, {0x1265e1e0, 0x16})",
  "Msg": "    /home/runner/work/arduino-fwuploader/arduino-fwuploader/cli/common/common.go:129 +0xd1",
  "Msg": "github.com/arduino/arduino-fwuploader/cli/common.DownloadRequiredToolsForBoard(0x126e3450, 0x127d6870)",
  "Msg": "    /home/runner/work/arduino-fwuploader/arduino-fwuploader/cli/common/common.go:118 +0x9f",
  "Msg": "github.com/arduino/arduino-fwuploader/cli/firmware.runFlash(0x1246fce0, {0x125468c0, 0x0, 0x7})",
  "Msg": "    /home/runner/work/arduino-fwuploader/arduino-fwuploader/cli/firmware/flash.go:81 +0xfc",
  "Msg": "github.com/spf13/cobra.(*Command).execute(0x1246fce0, {0x12546880, 0x7, 0x8})",
  "Msg": "    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:860 +0x645",
  "Msg": "github.com/spf13/cobra.(*Command).ExecuteC(0x1246f8c0)",
  "Msg": "    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:974 +0x403",
  "Msg": "github.com/spf13/cobra.(*Command).Execute(...)",
  "Msg": "    /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.2.1/command.go:902",
  "Msg": "main.main()",
  "Msg": "    /home/runner/work/arduino-fwuploader/arduino-fwuploader/main.go:34 +0x47",
  "Msg": "Executing command: exit status 2",

To reproduce

Try to run the fw flash using an OS for which the required tools are unavailable.

Expected behavior

fwupload should exit clleanly with an error message like: "Tool xxxx is not available for you OS yyyy"

Arduino Firmware Uploader version

nightly

Operating system

N/A

Operating system version

N/A

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest version
  • My report contains all necessary details

Metadata

Metadata

Labels

type: 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