Skip to content

Fix panic in extractDataFolderFromArduinoCLI #175

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

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

n-peugnet
Copy link
Contributor

@n-peugnet n-peugnet commented Jan 17, 2024

Please check if the PR fulfills these requirements

  • What kind of change does this PR introduce?

Fix a panic when starting the server with a recent version of arduino-cli.

  • What is the current behavior?

The server panics:

18:02:35.912080 \27[96mINIT --- : Arduino Data Dir -> \27[0m
18:02:35.912117 Panic: runtime error: invalid memory address or nil pointer dereference

goroutine 34 [running]:
runtime/debug.Stack()
	/usr/lib/go-1.21/src/runtime/debug/stack.go:24 +0x5e
github.com/arduino/arduino-language-server/streams.CatchAndLogPanic()
	/home/nicolas/Sources/arduino-language-server/streams/panics.go:29 +0x74
panic({0xa10660?, 0xffdd50?})
	/usr/lib/go-1.21/src/runtime/panic.go:920 +0x270
github.com/arduino/go-paths-helper.(*Path).Clone(...)
	/home/nicolas/go/pkg/mod/github.com/arduino/[email protected]/paths.go:79
github.com/arduino/go-paths-helper.(*Path).Canonical(0xc000269b80?)
	/home/nicolas/go/pkg/mod/github.com/arduino/[email protected]/paths.go:543 +0x19
github.com/arduino/arduino-language-server/ls.(*INOLanguageServer).extractDataFolderFromArduinoCLI(0xc000213680, {0xbc9b80, 0xc00019ed20})
	/home/nicolas/Sources/arduino-language-server/ls/ls.go:1487 +0xa25
github.com/arduino/arduino-language-server/ls.(*INOLanguageServer).initializeReqFromIDE.func1()
	/home/nicolas/Sources/arduino-language-server/ls/ls.go:214 +0x36a
created by github.com/arduino/arduino-language-server/ls.(*INOLanguageServer).initializeReqFromIDE in goroutine 21
	/home/nicolas/Sources/arduino-language-server/ls/ls.go:188 +0x205
  • What is the new behavior?

The server runs nicely.

  • Other information:

When using the latest arduino CLI (nightly-20240102 Commit: db53f81) the
return of arduino-cli config dump looks like:

{
  "config": {
    "directories": {
      "data": "/home/nicolas/.arduino15",
      "downloads": "/home/nicolas/.arduino15/staging",
      "user": "/home/nicolas/Arduino"
    }
  }
}

Related to arduino/arduino-cli#2407


When using the latest arduino CLI (nightly-20240102 Commit: db53f81) the
return of `arduino-cli config dump` looks like:

	{
	  "config": {
	    "directories": {
	      "data": "/home/nicolas/.arduino15",
	      "downloads": "/home/nicolas/.arduino15/staging",
	      "user": "/home/nicolas/Arduino"
	    }
	  }
	}
@CLAassistant
Copy link

CLAassistant commented Jan 17, 2024

CLA assistant check
All committers have signed the CLA.

@n-peugnet
Copy link
Contributor Author

Please consider adding to the CLA a clause like in Signal's one that explicitly says the contribution will always be available under an open-source license:

  1. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Open Whisper Systems and to recipients of software distributed by Signal Messenger a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute Your Contributions and such derivative works, as well as the right to sublicense and have sublicensed all of the foregoing rights, through multiple tiers of sublicensees, provided that in all cases, Signal Messenger will make Your Contributions available under an OSI-approved open source license.

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Jan 17, 2024
Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch! 👍🏼

@cmaglie cmaglie merged commit 87bb2c8 into arduino:main Jan 25, 2024
@cmaglie
Copy link
Member

cmaglie commented Jan 25, 2024

Please consider adding to the CLA a clause like in Signal's one that explicitly says the contribution will always be available under an open-source license:

AFAIU this should already be true because a hypothetical license change is not retroactive. If Arduino decides to do a license change at time T, the code already released before T will keep the existing license. At least this is my interpretation, but I don't see how it could be otherwise. :-)

@cmaglie cmaglie self-assigned this Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants