Skip to content
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

Fix bogus "wrong file size" error in some rare cases #1810

Merged
merged 2 commits into from
Jul 22, 2022

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Jul 21, 2022

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)

What kind of change does this PR introduce?
Package indexes are loaded after the installed platforms.

The reason for this change is that the installed packages keep an extract of the original package_XXX_index.json, at the moment of the installation, inside a file named installed.json. This extract turns out useful if the original package_XXX_index.json is lost or removed to keep the platform functional.

On the other hand, if the original package_XXX_index.json is modified the information kept in the
installed.json may be outdated and should be replaced by the upstream index: this is the reason why it's loaded after the hardware platforms.

What is the current behavior?
In some rare cases, the tool installation may fail due to an inconsistency in checksums and file size stored in the index and in the installed.json.

What is the new behavior?
The checksums and file size in the index will always take precedence.

Does this PR introduce a breaking change, and is titled accordingly?
No

…aded file

This will help identify the problem:
- if the file is corrupted
- if the package_index is wrong
- if there is a bug in the CLI (more rare... but actually possible :-)
The installed packages keeps an extract of the original
package_index.json, at the moment of the installation, inside
a file named installed.json. This extract may turn out useful
if the original package_XXX_index.json is lost or removed to keep the
platform functional. On the other hand, if the original
package_XXX_index.json is modified the information kept in the
installed.json may be outdated and should be replaced by the upstream
index: this is the reason why it's loaded after the hardware platforms.
@cmaglie cmaglie self-assigned this Jul 21, 2022
@cmaglie cmaglie added type: imperfection Perceived defect in any part of project topic: CLI Related to the command line interface criticality: high Of high impact criticality: highest Of highest impact labels Jul 21, 2022
@cmaglie cmaglie merged commit 4c539b9 into arduino:master Jul 22, 2022
@cmaglie cmaglie deleted the fix_package_loading branch July 22, 2022 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
criticality: high Of high impact criticality: highest Of highest impact topic: CLI Related to the command line interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants