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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arduino/resources/checksums.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (r *DownloadResource) TestLocalArchiveSize(downloadDir *paths.Path) (bool,
return false, fmt.Errorf(tr("getting archive info: %s"), err)
}
if info.Size() != r.Size {
return false, fmt.Errorf(tr("fetched archive size differs from size specified in index"))
return false, fmt.Errorf("%s: %d != %d", tr("fetched archive size differs from size specified in index"), info.Size(), r.Size)
}

return true, nil
Expand Down
41 changes: 21 additions & 20 deletions commands/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,27 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro
return pm.LoadToolsFromPackageDir(builtinPackage, pm.PackagesDir.Join("builtin", "tools"))
}

// Load Platforms
if profile == nil {
for _, err := range pm.LoadHardware() {
s := &arduino.PlatformLoadingError{Cause: err}
responseError(s.ToRPCStatus())
}
} else {
// Load platforms from profile
errs := pm.LoadHardwareForProfile(
profile, true, downloadCallback, taskCallback,
)
for _, err := range errs {
s := &arduino.PlatformLoadingError{Cause: err}
responseError(s.ToRPCStatus())
}

// Load "builtin" tools
_ = loadBuiltinTools()
}

// Load packages index
urls := []string{globals.DefaultIndexURL}
if profile == nil {
urls = append(urls, configuration.Settings.GetStringSlice("board_manager.additional_urls")...)
Expand Down Expand Up @@ -265,26 +286,6 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro
}
}

// Load Platforms
if profile == nil {
for _, err := range pm.LoadHardware() {
s := &arduino.PlatformLoadingError{Cause: err}
responseError(s.ToRPCStatus())
}
} else {
// Load platforms from profile
errs := pm.LoadHardwareForProfile(
profile, true, downloadCallback, taskCallback,
)
for _, err := range errs {
s := &arduino.PlatformLoadingError{Cause: err}
responseError(s.ToRPCStatus())
}

// Load "builtin" tools
_ = loadBuiltinTools()
}

// We load hardware before verifying builtin tools are installed
// otherwise we wouldn't find them and reinstall them each time
// and they would never get reloaded.
Expand Down