Skip to content

Broken symlinks in libraries results in linter panic #680

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

Closed
3 tasks done
cmaglie opened this issue Jan 9, 2024 · 1 comment
Closed
3 tasks done

Broken symlinks in libraries results in linter panic #680

cmaglie opened this issue Jan 9, 2024 · 1 comment
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@cmaglie
Copy link
Member

cmaglie commented Jan 9, 2024

Describe the problem

If there is a broken symlink in a library the linter panics.

To reproduce

Try to lint this library: eloquent_edgeimpulse.tar.gz

cmaglie:~$ tar xfv eloquent_edgeimpulse.tar.gz 
eloquent_edgeimpulse/
eloquent_edgeimpulse/library.properties
eloquent_edgeimpulse/examples/
eloquent_edgeimpulse/examples/EdgeImpulse_Serial/
eloquent_edgeimpulse/examples/EdgeImpulse_Serial/EdgeImpulse_Serial.ino
eloquent_edgeimpulse/LICENSE
eloquent_edgeimpulse/README.md
eloquent_edgeimpulse/src/
eloquent_edgeimpulse/src/eloquent_edgeimpulse.h
eloquent_edgeimpulse/src/eloquent_edgeimpulse/
eloquent_edgeimpulse/src/eloquent_edgeimpulse/impulse.h
eloquent_edgeimpulse/src/eloquent_edgeimpulse/math.h
eloquent_edgeimpulse/src/eloquent_edgeimpulse/exception.h
eloquent_edgeimpulse/src/eloquent_edgeimpulse/circular_buffer.h

cmaglie:~$ cd eloquent_edgeimpulse/
cmaglie:~/eloquent_edgeimpulse$ ../Software/arduino-lint 
Linting library in /home/cmaglie/eloquent_edgeimpulse
panic: stat /home/cmaglie/eloquent_edgeimpulse/src/eloquent_edgeimpulse/circular_buffer.h: no such file or directory

goroutine 1 [running]:
github.com/arduino/arduino-lint/internal/rule/rulefunction.LibraryContainsSymlinks()
	/home/build/internal/rule/rulefunction/library.go:90 +0x1f6
github.com/arduino/arduino-lint/internal/rule.Runner({0xc0002ff270, 0x1633db8, 0x0})
	/home/build/internal/rule/rule.go:53 +0x24a
github.com/arduino/arduino-lint/internal/command.ArduinoLint(0xc000034900, {0x1633db8, 0x0, 0x0})
	/home/build/internal/command/command.go:77 +0x645
github.com/spf13/cobra.(*Command).execute(0xc000034900, {0xc0000321e0, 0x0, 0x0})
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:987 +0xa87
github.com/spf13/cobra.(*Command).ExecuteC(0xc000034900)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x41e
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
main.main()
	/home/build/main.go:33 +0x1e

cmaglie:~/eloquent_edgeimpulse$ ls -l /home/cmaglie/eloquent_edgeimpulse/src/eloquent_edgeimpulse/circular_buffer.h
lrwxrwxrwx 1 cmaglie cmaglie 76 gen  9 16:24 /home/cmaglie/eloquent_edgeimpulse/src/eloquent_edgeimpulse/circular_buffer.h -> /Users/simone/Documents/Arduino/libraries/eloquent_commons/circular_buffer.h

Expected behavior

Do not panic, and output an error about broken symlinks.
It should also output an error if the symlink points outside the library.

Arduino Lint version

nightly

Operating system

Linux

Operating system version

Ubuntu 23.02

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest version
  • My report contains all necessary details
@cmaglie cmaglie added the type: imperfection Perceived defect in any part of project label Jan 9, 2024
@per1234 per1234 added the topic: code Related to content of the project itself label Jan 9, 2024
@per1234 per1234 self-assigned this Jan 18, 2024
@per1234 per1234 added the status: in progress Work is in progress on this label Jan 18, 2024
@per1234
Copy link
Contributor

per1234 commented Jan 18, 2024

Fixed by #685

Thanks for your report and for the fix via arduino/go-paths-helper#30 as well!

@per1234 per1234 closed this as completed Jan 18, 2024
@per1234 per1234 added conclusion: resolved Issue was resolved and removed status: in progress Work is in progress on this labels Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants