Skip to content

Incorrect libraries installed by first run installation #1526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
per1234 opened this issue Oct 5, 2022 · 0 comments · Fixed by #1531
Closed
3 tasks done

Incorrect libraries installed by first run installation #1526

per1234 opened this issue Oct 5, 2022 · 0 comments · Fixed by #1531
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Oct 5, 2022

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

await this.libraryService.search({ query: 'Arduino_BuiltIn' })

Then the result of that search is fed into the library installation code:

await this.libraryService.install({
item: builtInLibrary,

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

  1. Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus if it is running.

  2. Replace the bundled Arduino CLI binary from the Arduino IDE installation:

    resources/app/node_modules/arduino-ide-extension/build/
    

    with the version that has the new fuzzy search system (e404a3ba1012c39b8ef18de0e658f1cb3917fea9 or later):
    https://github.com/arduino/arduino-cli/actions/runs/3143931031

  3. Rename or delete the following folder to trigger the first run installations:

    • Windows:
      C:\Users\<username>\AppData\Roaming\arduino-ide\
      
      (where <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".
    • Linux:
      /home/<username>/.config/arduino-ide/
      
      (where <username> is your Linux username)
      ❗ The .config folder may be hidden by default in your file manager and terminal.
    • macOS:
      /Users/<username>/Library/Application Support/arduino-ide/
      
      (where <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!

  4. Start Arduino IDE.

  5. 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:

  • EasyButtonAtInt01
  • LedBlinky
  • MyDelay
Platform arduino:[email protected] already installed
Downloading [email protected]
[email protected]
Installing [email protected]
Installed [email protected]

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

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Oct 5, 2022
@kittaakos kittaakos self-assigned this Oct 5, 2022
kittaakos pushed a commit that referenced this issue Oct 5, 2022
on the first IDE2 startup.

Closes #1526

Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit that referenced this issue Oct 5, 2022
on the first IDE2 startup.

Closes #1526

Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit that referenced this issue Oct 7, 2022
on the first IDE2 startup.

Closes #1526

Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit that referenced this issue Oct 7, 2022
on the first IDE2 startup.

Closes #1526

Signed-off-by: Akos Kitta <[email protected]>
@per1234 per1234 added the conclusion: resolved Issue was resolved label Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
2 participants