Skip to content

Platform versions incompatible with host architecture are offered unnecessarily #1889

Closed
@per1234

Description

@per1234

Describe the problem

Although board platforms are not host architecture-specific, their tool dependencies must be built for each target host architecture.

The available archives for a given tool release are listed in packages[*].tools[*].systems[] field of the packager's package index file, with the target host architecture specified by the archive object's host field.

This information is used by the arduino-cli core commands to install tool dependencies along with a board platform. In the event a tool dependency is not available for the host architecture, the platform installation fails with an error message in the form:

Error during install: Error downloading tool <tool name>@<tool version>: no versions available for the current OS

🐛 Platform releases which are incompatible with the user's host architecture are offered for installation and update even though the process will inevitably fail. Previous releases which are compatible are not directly offered.

To reproduce

Set up

I have prepared a package index file which contains two platform releases:

  • foo_vendor:avr@1.0.0 - has a dependency on the foo_vendor:some_tool@1.0.0 tool, which is available for your host architecture
  • foo_vendor:avr@1.0.1 - has a dependency on the foo_vendor:some_tool@2.0.0 tool, which is not available for your host architecture
  1. Download this demonstration package index file:
    package_1888_index.json.txt
  2. Rename the downloaded file package_1888_index.json
  3. Add the path to the downloaded file to the board_manager.additional_urls configuration:
    export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS="file://<download path>/package_1888_index.json"
    
    (where <download path> is the path of the package_1888_index.json file you downloaded in the first step)

Steps

  1. Run the following command:
    arduino-cli core list --all
    
    🐛 The "Latest" column shows a version of the platform that is not compatible with your host architecture:
    ID                    Installed Latest    Name
    [...]
    foo_vendor:avr                  1.0.1     Foo Boards
    
  2. Run the following command:
    arduino-cli core install foo_vendor:avr
    
    🐛 The command failed because Arduino CLI selected the incompatible version of the platform:
    Error during install: Error downloading tool foo_vendor:some_tool@2.0.0: no versions available for the current OS
    
  3. Run the following command:
    arduino-cli core install foo_vendor:avr@1.0.0
    
  4. Run the following command:
    arduino-cli core list
    
    🐛 The "Latest" column shows a version of the platform that is not compatible with your host architecture:
    ID             Installed Latest Name      
    [...]
    foo_vendor:avr 1.0.0     1.0.1  Foo Boards
    
  5. Run the following command:
    arduino-cli core list --updatable
    
    🐛 The platform is listed as updatable even though the newer version is not compatible with your host architecture:
    ID             Installed Latest Name      
    foo_vendor:avr 1.0.0     1.0.1  Foo Boards
    
  6. Run the following command:
    arduino-cli core search --all
    
    🐛 The platform is listed as updatable even though the newer version is not compatible with your host architecture:
    ID             Installed Latest Name      
    foo_vendor:avr 1.0.0     1.0.1  Foo Boards
    
  7. Run the following command:
    arduino-cli core search --all --format json foo
    
    🐛 There is no indication that foo_vendor:avr@1.0.1 is not compatible with your host architecture:
    [
      {
        "id": "foo_vendor:avr",
        "latest": "1.0.0",
        "name": "Foo Boards",
        "maintainer": "Foo Developer",
        "website": "http://example.com",
        "email": "foo@example.com",
        "boards": [
          {
            "name": "ATtiny",
            "fqbn": "foo_vendor:avr:attiny"
          }
        ],
        "type": [
          "Contributed"
        ]
      },
      {
        "id": "foo_vendor:avr",
        "latest": "1.0.1",
        "name": "Foo Boards",
        "maintainer": "Foo Developer",
        "website": "http://example.com",
        "email": "foo@example.com",
        "type": [
          "Contributed"
        ]
      }
    ]
  8. Run the following command:
    arduino-cli core upgrade foo_vendor:avr
    
    🐛 The command failed because Arduino CLI attempted to upgrade to an incompatible version of the platform:
    Error during install: Error downloading tool foo_vendor:some_tool@2.0.0: no versions available for the current OS
    

Expected behavior

  • Incompatible platform versions are not automatically offered or selected for update or installation when a compatible version is available
  • Incompatible platform versions are identified as such in listings

The current behavior of failing the platform installation with an error is reasonable in the following cases:

  • No compatible version is available
  • The user has explicitly specified the incompatible version via the command. For example:
    arduino-cli core install foo_vendor:avr@1.0.1
    

Arduino CLI version

5730e2e

Operating system

Windows

Operating system version

10

Additional context

Originally reported by @PaulStoffregen at https://forum.pjrc.com/threads/53548-Arduino-CLI-And-IDE-now-Released-Teensy-Supported!?p=313206#post313206


This subject was previously discussed at #1626, but that discussion centered around the error message more clearly communicating about the problem to the user, while this issue is about Arduino CLI avoiding the error altogether when that is possible.

Issue checklist

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

Metadata

Metadata

Labels

topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions