Skip to content

Package index filename is truncated if it contains . #2345

Closed

Description

Describe the problem

If the filename of a package index contains the character ., Arduino CLI truncates the downloaded filename

To reproduce

$ arduino-cli version

arduino-cli.exe  Version: git-snapshot Commit: 6aa1be03 Date: 2023-09-28T08:02:22Z

$ export ARDUINO_DIRECTORIES_DATA="/tmp/arduino-cli-directories/data"  # Use a throwaway directories.data for the demo

$ arduino-cli  --additional-urls http://drazzy.com/package_drazzy.com_index.json core update-index

[...]
Downloading index: package_drazzy.com_index.json downloaded
Error initializing instance: Loading index file: loading json index file C:\Users\per\AppData\Local\Temp\arduino-cli-directories\data\package_drazzy.com_index.json: open C:\Users\per\AppData\Local\Temp\arduino-cli-directories\data\package_drazzy.com_index.json: The system cannot find the file specified.
[...]

$ ls "$ARDUINO_DIRECTORIES_DATA"/package_drazzy*.*

/tmp/arduino-cli-directories/data/package_drazzy.json

$ arduino-cli  --additional-urls http://drazzy.com/package_drazzy.com_index.json core install ATTinyCore:avr
Error initializing instance: Loading index file: loading json index file C:\Users\per\AppData\Local\Temp\arduino-cli-directories\data\package_drazzy.com_index.json: open C:\Users\per\AppData\Local\Temp\arduino-cli-directories\data\package_drazzy.com_index.json: The system cannot find the file specified.
Error initializing instance: Loading index file: loading json index file C:\Users\per\AppData\Local\Temp\arduino-cli-directories\data\package_drazzy.com_index.json: open C:\Users\per\AppData\Local\Temp\arduino-cli-directories\data\package_drazzy.com_index.json: The system cannot find the file specified.
Invalid argument passed: Platform 'ATTinyCore:avr' not found

🐛 The downloaded package index was named package_drazzy.json instead of the correct name package_drazzy.com_index.json

🐛 The platforms from the package index can't be installed because the truncation caused the file to no longer have the required filename format (package_<differentiator>_index.json).

Expected behavior

The filenames of package index files are not changed on download.

Arduino CLI version

6aa1be0

Operating system

  • Windows
  • Linux

Operating system version

  • Windows 11
  • Ubuntu 22.04

Additional context

I bisected the regression to 82e6f5d (doesn't occur when using the build from the previous commit 1877431).


The use of a full domain name in the package index filename is explicitly recommended in the Arduino Package Index Specification:

https://arduino.github.io/arduino-cli/dev/package_index_json-specification/#naming-of-the-json-index-file

We suggest using a domain name owned by the packager. For example:

package_arduino.cc_index.json


Originally reported at SpenceKonde/ATTinyCore#803 (comment)

Additional reports

Related

Issue checklist

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions