arduino-cli icon indicating copy to clipboard operation
arduino-cli copied to clipboard

The board order is not deterministic in `core search`

Open kittaakos opened this issue 1 year ago • 0 comments
trafficstars

Describe the problem

core search --format json provides different output for the same args. The boards item per platform differs.

To reproduce

./arduino-cli version  
arduino-cli  Version: 0.35.0-rc.7 Commit: 77222ecd Date: 2023-12-04T12:29:09Z
./arduino-cli core list
ID               Installed Latest Name
arduino:avr      1.8.6     1.8.6  Arduino AVR Boards
arduino:esp32    2.0.13    2.0.13 Arduino ESP32 Boards
arduino-git:samd 1.8.13    1.8.13 Arduino SAMD (32-bits ARM Cortex-M0+) Boards
pico:rp2040      3.6.0     3.6.0  Raspberry Pi RP2040 Boards

(prints the name + FQBN of the first boards item of the arduino:avr core):

./arduino-cli core search "arduino:avr" --format json | jq '. | map((.id, .name, .boards[0])) | select(.[0] == "arduino:avr")'
[
  "arduino:avr",
  "Arduino AVR Boards",
  {
    "name": "Arduino BT",
    "fqbn": "arduino:avr:bt"
  }
]

Run the same command twice (or sometimes the third time):

./arduino-cli core search "arduino:avr" --format json | jq '. | map((.id, .name, .boards[0])) | select(.[0] == "arduino:avr")'
[
  "arduino:avr",
  "Arduino AVR Boards",
  {
    "name": "Arduino Robot Motor",
    "fqbn": "arduino:avr:robotMotor"
  }
]

Expected behavior

The core search --format json output is deterministic

Arduino CLI version

0.35.0-rc.7 Commit: 77222ecd

Operating system

macOS

Operating system version

14.1

Additional context

I remember we had this problem, which was solved, but I could not find the corresponding issue/PR. Please close if it's a duplicate.

Issue checklist

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

kittaakos avatar Dec 14 '23 16:12 kittaakos