FileWatcherEx icon indicating copy to clipboard operation
FileWatcherEx copied to clipboard

RegisterAdditionalFileWatchersForSymLinkDirs fails on cyclical symlinks

Open PhantomGamers opened this issue 2 years ago • 0 comments

When there are cyclical symlinks (symlinks that contain symlinks pointing back to themselves) in a directory RegisterAdditionalFileWatchersForSymLinkDirs either hangs or throws this error:

System.IO.IOException: Too many levels of symbolic links : '/home/pgamers/.steam/steam/ubuntu12_32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/bin32/ubuntu12_32/ubuntu12_32/bin32/bin32/bin32/ubuntu12_32/steam-runtime.old/amd64/usr/libexec/steam-runtime-tools-0/x86_64-linux-gnu/haswell'
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String, Boolean )
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerableFactory.DirectoryInfos(String, String, EnumerationOptions, Boolean)
   at System.IO.DirectoryInfo.InternalEnumerateInfos(String, String, SearchTarget, EnumerationOptions)
   at System.IO.DirectoryInfo.GetDirectories()
   at FileWatcherEx.Helpers.SymlinkAwareFileWatcher.RegisterAdditionalFileWatchersForSymLinkDirs(String path)
   + 28 more RegisterAdditionalFileWatchersForSymLinkDirs calls

Sometimes it fails and errors out like this, other times it runs indefinitely until the program is exited without a crash but without ever succeeding. Not sure what causes it to crash vs hang, it seems to change run to run without any changes to the environment.

I'm unsure how exactly go to about fixing this but Steam on Linux is a good application to reliably reproduce this issue with as the ~/.steam folder is chock-full of cyclical symlinks.

(Reposting from comments of #15 as #16 does not fix this issue)

PhantomGamers avatar May 27 '23 03:05 PhantomGamers