Calling IOExtensions.SafeGetFiles with SearchOption.AllDirectories results in infinite loop on disc with folder that symlinks to itself #2

Closed
opened 2026-01-29 17:29:44 +00:00 by claunia · 2 comments
Owner

Originally created by @HeroponRikiBestest on GitHub (Jan 20, 2026).

http://redump.org/disc/130441/ features a set of folders in the directory /Install Leisure Suit Larry - Wet Dreams Don't Dry.app/Contents/Resources/EULA.pkg/Contents/Resources/, each of which contain a folder named License.rtf which symlinks to the directory it's in. Attempting to read any directory at or above this directory results in IOExtensions.SafeGetFiles getting stuck in an infinite loop due to there not being any protection against this with Directory.GetFiles(path, searchPattern, searchOption). I'm opening an issue rather than a PR because I'm not sure how to solve this using functions available for all supported dotnet versions.

Originally created by @HeroponRikiBestest on GitHub (Jan 20, 2026). http://redump.org/disc/130441/ features a set of folders in the directory /Install Leisure Suit Larry - Wet Dreams Don't Dry.app/Contents/Resources/EULA.pkg/Contents/Resources/, each of which contain a folder named License.rtf which symlinks to the directory it's in. Attempting to read any directory at or above this directory results in IOExtensions.SafeGetFiles getting stuck in an infinite loop due to there not being any protection against this with Directory.GetFiles(path, searchPattern, searchOption). I'm opening an issue rather than a PR because I'm not sure how to solve this using functions available for all supported dotnet versions.
Author
Owner

@Deterous commented on GitHub (Jan 20, 2026):

Could be related to https://github.com/SabreTools/BinaryObjectScanner/issues/276

@Deterous commented on GitHub (Jan 20, 2026): Could be related to https://github.com/SabreTools/BinaryObjectScanner/issues/276
Author
Owner

@HeroponRikiBestest commented on GitHub (Jan 20, 2026):

Ah, yeah, you're right. Closing since it seems like there's no reasonable fix for this.

$  ls -l .
total 2
lrwxrwxrwx 1 bestest bestest 0 Oct 15  2018 License.rtf -> ''
@HeroponRikiBestest commented on GitHub (Jan 20, 2026): Ah, yeah, you're right. Closing since it seems like there's no reasonable fix for this. ```bash $ ls -l . total 2 lrwxrwxrwx 1 bestest bestest 0 Oct 15 2018 License.rtf -> '' ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SabreTools/SabreTools.IO#2