Skip to content

Commit b665b89

Browse files
authored
Merge pull request #685 from arduino/dependabot/go_modules/github.com/arduino/go-paths-helper-1.12.0
Bump github.com/arduino/go-paths-helper from 1.11.0 to 1.12.0
2 parents 372c2a5 + e0f6019 commit b665b89

File tree

13 files changed

+78
-14
lines changed

13 files changed

+78
-14
lines changed

.licenses/arduino-lint/go/github.com/arduino/go-paths-helper.dep.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: github.com/arduino/go-paths-helper
3-
version: v1.11.0
3+
version: v1.12.0
44
type: go
55
summary:
66
homepage: https://pkg.go.dev/github.com/arduino/go-paths-helper

.licenses/docsgen/go/github.com/arduino/go-paths-helper.dep.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: github.com/arduino/go-paths-helper
3-
version: v1.11.0
3+
version: v1.12.0
44
type: go
55
summary:
66
homepage: https://pkg.go.dev/github.com/arduino/go-paths-helper

.licenses/ruledocsgen/go/github.com/arduino/go-paths-helper.dep.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: github.com/arduino/go-paths-helper
3-
version: v1.11.0
3+
version: v1.12.0
44
type: go
55
summary:
66
homepage: https://pkg.go.dev/github.com/arduino/go-paths-helper

docsgen/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ require (
1919
github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect
2020
github.com/acomagu/bufpipe v1.0.4 // indirect
2121
github.com/arduino/arduino-cli v0.0.0-20201210103408-bf7a3194bb63 // indirect
22-
github.com/arduino/go-paths-helper v1.11.0 // indirect
22+
github.com/arduino/go-paths-helper v1.12.0 // indirect
2323
github.com/arduino/go-properties-orderedmap v1.8.0 // indirect
2424
github.com/cespare/xxhash v1.1.0 // indirect
2525
github.com/client9/misspell v0.3.4 // indirect

docsgen/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:
6060
github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
6161
github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
6262
github.com/arduino/go-paths-helper v1.3.2/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
63-
github.com/arduino/go-paths-helper v1.11.0 h1:hkpGb9AtCTByTj2FKutuHWb3klDf4kAKL10hW+fN+oE=
64-
github.com/arduino/go-paths-helper v1.11.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
63+
github.com/arduino/go-paths-helper v1.12.0 h1:xizOQtI9iHdl19qXd1EmWg5i9W//2bOCOYwlNv8F61E=
64+
github.com/arduino/go-paths-helper v1.12.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
6565
github.com/arduino/go-properties-orderedmap v1.3.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
6666
github.com/arduino/go-properties-orderedmap v1.8.0 h1:wEfa6hHdpezrVOh787OmClsf/Kd8qB+zE3P2Xbrn0CQ=
6767
github.com/arduino/go-properties-orderedmap v1.8.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ replace github.com/oleiade/reflections => github.com/oleiade/reflections v1.0.1
88

99
require (
1010
github.com/arduino/arduino-cli v0.0.0-20201210103408-bf7a3194bb63
11-
github.com/arduino/go-paths-helper v1.11.0
11+
github.com/arduino/go-paths-helper v1.12.0
1212
github.com/arduino/go-properties-orderedmap v1.8.0
1313
github.com/client9/misspell v0.3.4
1414
github.com/go-git/go-git/v5 v5.7.0

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:
6161
github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
6262
github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
6363
github.com/arduino/go-paths-helper v1.3.2/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
64-
github.com/arduino/go-paths-helper v1.11.0 h1:hkpGb9AtCTByTj2FKutuHWb3klDf4kAKL10hW+fN+oE=
65-
github.com/arduino/go-paths-helper v1.11.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
64+
github.com/arduino/go-paths-helper v1.12.0 h1:xizOQtI9iHdl19qXd1EmWg5i9W//2bOCOYwlNv8F61E=
65+
github.com/arduino/go-paths-helper v1.12.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
6666
github.com/arduino/go-properties-orderedmap v1.3.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
6767
github.com/arduino/go-properties-orderedmap v1.8.0 h1:wEfa6hHdpezrVOh787OmClsf/Kd8qB+zE3P2Xbrn0CQ=
6868
github.com/arduino/go-properties-orderedmap v1.8.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=

internal/project/project.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func findProjectsUnderPath(targetPath *paths.Path, projectTypeFilter projecttype
146146
// It is possible for a combination of symlinks to parent paths to cause project discovery to get stuck in
147147
// an endless loop of recursion. This is avoided by keeping count of the depth of symlinks and discontinuing
148148
// recursion when it exceeds reason.
149-
pathStat, err := os.Lstat(potentialProjectDirectory.String())
149+
pathStat, err := potentialProjectDirectory.Lstat()
150150
if err != nil {
151151
panic(err)
152152
}

internal/project/project_test.go

+51
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,57 @@ func TestSymlinkLoop(t *testing.T) {
6363
assert.Panics(t, func() { FindProjects() }, "Infinite symlink loop encountered during project discovery")
6464
}
6565

66+
func TestBrokenSymlink(t *testing.T) {
67+
projectsPath := testDataPath.Join("Projects")
68+
symlinkPath := projectsPath.Join("test-symlink")
69+
symlinkTargetPath := projectsPath.Join("nonexistent")
70+
// The broken symlink must have the attributes of a folder in order to be effective in this test, so the target must
71+
// exist at the time the symlink is created.
72+
err := symlinkTargetPath.Mkdir()
73+
require.Nil(t, err)
74+
// Create a folder symlink in the projects folder.
75+
// It's probably most friendly to developers using Windows to create the symlink needed for the test on demand.
76+
err = os.Symlink(projectsPath.Join("nonexistent").String(), symlinkPath.String())
77+
require.Nil(t, err, "This test must be run as administrator on Windows to have symlink creation privilege.")
78+
defer symlinkPath.RemoveAll() // Clean up.
79+
80+
// Break the symlink.
81+
err = symlinkTargetPath.Remove()
82+
require.Nil(t, err)
83+
84+
flags := test.ConfigurationFlags()
85+
flags.Set("project-type", "all")
86+
flags.Set("recursive", "true")
87+
configuration.Initialize(flags, []string{projectsPath.String()})
88+
89+
foundProjects, err := FindProjects()
90+
require.Nil(t, err)
91+
assert.True(
92+
t,
93+
reflect.DeepEqual(
94+
foundProjects,
95+
[]Type{
96+
{
97+
Path: testDataPath.Join("Projects", "Library"),
98+
ProjectType: projecttype.Library,
99+
SuperprojectType: projecttype.Library,
100+
},
101+
{
102+
Path: testDataPath.Join("Projects", "Library", "examples", "Example"),
103+
ProjectType: projecttype.Sketch,
104+
SuperprojectType: projecttype.Library,
105+
},
106+
{
107+
Path: testDataPath.Join("Projects", "Sketch"),
108+
ProjectType: projecttype.Sketch,
109+
SuperprojectType: projecttype.Sketch,
110+
},
111+
},
112+
),
113+
"Broken symlink encountered during project discovery",
114+
)
115+
}
116+
66117
func TestFindProjects(t *testing.T) {
67118
sketchPath := testDataPath.Join("Sketch")
68119
libraryPath := testDataPath.Join("Library")

internal/rule/rulefunction/library.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func LibraryContainsSymlinks() (result ruleresult.Type, output string) {
9292

9393
symlinkPaths := []string{}
9494
for _, projectPathItem := range projectPathListing {
95-
projectPathItemStat, err := os.Lstat(projectPathItem.String())
95+
projectPathItemStat, err := projectPathItem.Lstat()
9696
if err != nil {
9797
panic(err)
9898
}

internal/rule/rulefunction/library_test.go

+13
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ func TestLibraryContainsSymlinks(t *testing.T) {
135135
err = symlinkPath.RemoveAll()
136136
require.Nil(t, err)
137137

138+
// Set up a library with a broken symlink.
139+
err = os.Symlink(librariesTestDataPath.Join(testLibrary, "nonexistent").String(), symlinkPath.String())
140+
require.Nil(t, err)
141+
142+
testTables = []libraryRuleFunctionTestTable{
143+
{"Has broken symlink", testLibrary, ruleresult.Fail, ""},
144+
}
145+
146+
checkLibraryRuleFunction(LibraryContainsSymlinks, testTables, t)
147+
148+
err = symlinkPath.RemoveAll()
149+
require.Nil(t, err)
150+
138151
testTables = []libraryRuleFunctionTestTable{
139152
{"No symlink", testLibrary, ruleresult.Pass, ""},
140153
}

ruledocsgen/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ replace github.com/jandelgado/gcov2lcov => github.com/jandelgado/gcov2lcov v1.0.
99
require (
1010
github.com/JohannesKaufmann/html-to-markdown v1.4.0
1111
github.com/arduino/arduino-lint v0.0.0
12-
github.com/arduino/go-paths-helper v1.11.0
12+
github.com/arduino/go-paths-helper v1.12.0
1313
github.com/olekukonko/tablewriter v0.0.5
1414
github.com/stretchr/testify v1.8.4
1515
)

ruledocsgen/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:
6464
github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
6565
github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
6666
github.com/arduino/go-paths-helper v1.3.2/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck=
67-
github.com/arduino/go-paths-helper v1.11.0 h1:hkpGb9AtCTByTj2FKutuHWb3klDf4kAKL10hW+fN+oE=
68-
github.com/arduino/go-paths-helper v1.11.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
67+
github.com/arduino/go-paths-helper v1.12.0 h1:xizOQtI9iHdl19qXd1EmWg5i9W//2bOCOYwlNv8F61E=
68+
github.com/arduino/go-paths-helper v1.12.0/go.mod h1:jcpW4wr0u69GlXhTYydsdsqAjLaYK5n7oWHfKqOG6LM=
6969
github.com/arduino/go-properties-orderedmap v1.3.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=
7070
github.com/arduino/go-properties-orderedmap v1.8.0 h1:wEfa6hHdpezrVOh787OmClsf/Kd8qB+zE3P2Xbrn0CQ=
7171
github.com/arduino/go-properties-orderedmap v1.8.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk=

0 commit comments

Comments
 (0)