eranif / codelite

A multi purpose IDE specialized in C/C++/Rust/Python/PHP and Node.js. Written in C++
https://codelite.org
GNU General Public License v2.0
2.08k stars 444 forks source link

Check for looping symlinks when building PHP projects #3401

Closed AJenbo closed 3 weeks ago

AJenbo commented 3 weeks ago

Fixes https://github.com/eranif/codelite/issues/3396

Finally located the issue for the IDE getting stuck on some project, this has brought so much pain over the last few years :sob: (I had gotten used to removing the vendor folder before starting CodeLite, or loading a different project and adding search paths)

The solution here is to resolve each folder before scanning it and then keeping track of the resolved paths, if we encounter a real path we have already seen previously we do not visit the symlink. The alternative could be to simply not follow symlinks, but this feels like a better solution as it supports cases where the symlinks are relevant, but avoids cases where they are self nesting.

eranif commented 3 weeks ago

Actually, a more correct fix would be to switch to the general purpose clFilesScanner (in file clFilesCollector.cpp) class which already keep tracks of visited folders and resolves symbolic links

AJenbo commented 3 weeks ago

Actually, a more correct fix would be to switch to the general purpose clFilesScanner (in file clFilesCollector.cpp) class which already keep tracks of visited folders and resolves symbolic links

I took a quick stab at this, one thing I noticed is that clFilesScanner does not have support for empty folders. Another thing that I noticed is that the progress bar stopped around 33% after the switch, but I'm not sure why that is, could just be my implementation.

I'm not sure what the best way to add folder support to the general scanner would be... and I still have a few modern PHP features that I would like to focus on adding support for first :)