Incorrect libraries installed by first run installation #1526
Labels
conclusion: resolved
Issue was resolved
topic: code
Related to content of the project itself
type: imperfection
Perceived defect in any part of project
Describe the problem
In order to allow users to get started with Arduino with the minimum amount of complexity, the Arduino IDE installs a collection of fundamental libraries automatically on the first run of a new installation.
This is done by installing the "Arduino_BuiltIn" library via the Library Manager infrastructure. That library serves as a container for a list of dependencies on "built-in" libraries that should be installed.
A pointlessly convoluted and fragile approach was chosen for this installation:
A search is done of the Library Manager index for the keyword "
Arduino_BuiltIn
":arduino-ide/arduino-ide-extension/src/browser/contributions/first-startup-installer.ts
Line 28 in 945a8f4
Then the result of that search is fed into the library installation code:
arduino-ide/arduino-ide-extension/src/browser/contributions/first-startup-installer.ts
Lines 60 to 61 in 945a8f4
That approach worked as intended only because the search for "
Arduino_BuiltIn
" happened to return only a single result. But that fact could have changed at any moment as new libraries and new releases of the existing >5000 libraries are added constantly, with any arbitrary keywords in their metadata. The moment came through a change to the library search system, which causes_
characters in search queries to be treated as a space: arduino/arduino-cli#1896🐛 The code intended to install the "Arduino_BuiltIn" library may now install any other library that has the keywords "arduino" and "builtin" in its metadata.
To reproduce
Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus if it is running.
Replace the bundled Arduino CLI binary from the Arduino IDE installation:
with the version that has the new fuzzy search system (e404a3ba1012c39b8ef18de0e658f1cb3917fea9 or later):
https://github.com/arduino/arduino-cli/actions/runs/3143931031
Rename or delete the following folder to trigger the first run installations:
<username>
is your Windows username)❗ If looking for it with your file manager or command line, note that the
AppData
folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".<username>
is your Linux username)❗ The
.config
folder may be hidden by default in your file manager and terminal.<username>
is your macOS username)❗ The
Library
folder is hidden by default. You can make it visible by pressing the Command+Shift+. keyboard shortcut.⚠ Please be very careful when deleting things from your computer. When in doubt, back up!
Start Arduino IDE.
Watch the process of the first run installations in the "Output" panel.
The behavior is nondeterministic, so the intended "Arduino_BuiltIn" library will sometimes be installed. If so, select File > Quit from the Arduino IDE menus and repeat the instructions from step (3).
🐛 One of the following libraries is installed incorrectly:
Expected behavior
"Arduino_BuiltIn" library to be installed reliably by the IDE.
Don't use a search to get the library information used for the installation. The only information needed is already known: the library name "Arduino_BuiltIn" is the unique identifier of the library.
Arduino IDE version
2.0.1-snapshot-945a8f4
Arduino CLI version
test-e404a3ba1012c39b8ef18de0e658f1cb3917fea9-git-snapshot
Operating system
Windows, Linux
Operating system version
Windows 10, Ubuntu 20.04
Issue checklist
The text was updated successfully, but these errors were encountered: