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

Don't fail installation on mismatch with size fields of index #2332

Open
3 tasks done
per1234 opened this issue Sep 22, 2023 · 0 comments
Open
3 tasks done

Don't fail installation on mismatch with size fields of index #2332

per1234 opened this issue Sep 22, 2023 · 0 comments
Assignees
Labels
criticality: high Of high impact topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented Sep 22, 2023

Describe the request

Do not error if the downloaded file size doesn't match the size value in the index.

A mismatch should only generate a warning. This warning will serve two purposes:

  • Give the user information that can be used in troubleshooting a failed installation due to checksum mismatch
  • Communicate to the package developer that they made a mistake (which will have the minor harmful effect of throwing off the download progress indicator)

If there is actually a problem with the downloaded file, the checksum validation will still fail.

🙂 Users will no longer suffer when package developers fail to correctly set a size value.

Describe the current behavior

Arduino CLI performs two operations in order to validate downloaded files

If the file size doesn't match the size value in the index, installation fails:

$ ./arduino-cli version

arduino-cli.exe  Version: git-snapshot Commit: dde30647 Date: 2023-09-22T02:26:41Z

$ arduino-cli --additional-urls https://raw.githubusercontent.com/geolink/opentracker-arduino-board/bf6158ebab0402db217bfb02ea61461ddc6f2940/package_opentracker_index.json core update-index

[...]

$ arduino-cli --additional-urls https://raw.githubusercontent.com/geolink/opentracker-arduino-board/bf6158ebab0402db217bfb02ea61461ddc6f2940/package_opentracker_index.json core install opentracker:[email protected]

[...]

Installing opentracker:[email protected]...
Error during install: Cannot install tool opentracker:[email protected]: testing local archive integrity: testing archive size: fetched archive size differs from size specified in index: 218874 != 218849

The installation will also fail if the file's checksum doesn't match the size value in the index. A SHA-256 checksum is entirely sufficient on its own to validate a file, so a size check is completely superfluous for the purpose of validating the file.

The other use Arduino CLI makes of the size value is indicating the progress of the download. Although this is a nice convenience feature, an incorrect size field value will only result in a minor inaccuracy in the progress indicator, which is not sufficient grounds on its own to fail the installation.

Package developers sometimes fumble the creation of package index entries. These include the size fields:

Since an incorrect size field value doesn't cause any visible problems when using Arduino IDE 1.x, developers who have not migrated to Arduino CLI or Arduino IDE 2.x won't notice the problem while testing the index. This means the users who are often not able to do anything to fix the problem are the ones punished by Arduino CLI unnecessarily failing the platform installation under these conditions.

Arduino CLI version

dde3064

Operating system

All

Operating system version

Any

Additional context

This proposal might appear similar to #1468. However, that proposal is to make it possible to skip all validation, while this proposal is only about removing a superfluous validation requirement, leaving the entirely sufficient validation via checksum intact.


Examples of users suffering from Arduino CLI unnecessarily failing the platform installation due to an incorrect size value:

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details
@per1234 per1234 added criticality: high Of high impact topic: code Related to content of the project itself type: enhancement Proposed improvement labels Sep 22, 2023
@per1234 per1234 changed the title Don't fail platform installation on mismatch with size fields of package index Don't fail installation on mismatch with size fields of index Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
criticality: high Of high impact topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

2 participants