-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Endless tree with System.IO.Directory.GetFiles #50247
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
According to the docs this is an expected behavior: https://docs.microsoft.com/en-us/dotnet/api/system.io.searchoption?view=net-5.0#remarks |
MSDN states this is expected behaviour, granted it would be nice to have a |
PowerShell has this many years. You can explicitly set FollowSymlink switch to follow symlinks in So if we want SearchOption.IgnoreSymLinks we should discuss SearchOption.CheckCycles too. |
This should be addressed with #52666. |
Description
when using Directory.GetFiles ( with all directories flag ) on a folder that contains subfolder and one of those holds a symbolic link
to the parent folder, the result will be an endless tree.
run this at terminal:
mkdir ~/test
mkdir ~/test/test1
mkdir ~/test/test1/test2
ln -s ~/test ~/test/test1/test2
then run this code:
namespace Tests { class Program { static void Main(string[] args) { var res = Directory.GetFiles("/Users/{youruser}/test","", SearchOption.AllDirectories); } } }
result: endless tree.
expected behavior: skip symbolic link
Configuration
.net core version: 3.1
OS: mac OS 11.2.1 Big Sur
Regression?
Other information
The text was updated successfully, but these errors were encountered: