@@ -24,7 +24,7 @@ import (
2424 "regexp"
2525 "strings"
2626
27- "github.com/sirupsen/logrus "
27+ "github.com/arduino/arduino-cli/cli/feedback "
2828
2929 "github.com/arduino/arduino-cli/arduino/globals"
3030 "github.com/arduino/arduino-cli/arduino/sketch"
@@ -62,6 +62,7 @@ func SketchSaveItemCpp(item *sketch.Item, destPath string) error {
6262}
6363
6464// SimpleLocalWalk locally replaces filepath.Walk and/but goes through symlinks
65+ // detecting and skipping symlink loops
6566func SimpleLocalWalk (root string , walkFn func (path string , info os.FileInfo , err error ) error ) error {
6667 info , err := os .Stat (root )
6768
@@ -78,12 +79,13 @@ func SimpleLocalWalk(root string, walkFn func(path string, info os.FileInfo, err
7879 files , err := ioutil .ReadDir (root )
7980 if err == nil {
8081 for _ , file := range files {
81- dirFileInfo , _ := os .Lstat (filepath .Join (root + file .Name ()))
82+ filePath := filepath .Join (root , file .Name ())
83+ dirFileInfo , _ := os .Lstat (filePath )
8284 if (dirFileInfo .Mode ()& os .ModeSymlink == os .ModeSymlink ) && ! shouldTraverse (root , dirFileInfo ) {
83- logrus . Warnf ("Symlink loop detected in %s %s " , root , file . Name () )
85+ feedback . Printf ("Symlink loop detected and skipped in %s" , filePath )
8486 continue
8587 }
86- err = SimpleLocalWalk (filepath . Join ( root + file . Name ()) , walkFn )
88+ err = SimpleLocalWalk (filePath , walkFn )
8789 if err == filepath .SkipDir {
8890 return nil
8991 }
0 commit comments