HashCheck icon indicating copy to clipboard operation
HashCheck copied to clipboard

we need infinite recursion detection or option to skip NTFS Junctions/symlinks for folders

Open R-Adrian opened this issue 8 years ago • 9 comments

on modern Windows systems some folder paths from %USERPROFILE% are actually NTFS junction points to other folders under the same tree root...

this causes an infinite loop situation that is only broken when the constructed the file path name exceeds the maximum possible path length (256-ish characters)

for example: %USERPROFILE%\Local Settings is actually a NTFS Junction to %USERPROFILE%\AppData\Local

in this folder we have another junction... and this is where the problem starts: %USERPROFILE%\AppData\Local\Application Data is a NTFS junction that points back to ... %USERPROFILE%\AppData\Local (yes.. a junction that points back to the parent of the junction... blame Microsoft.) My OS here is Windows 10 1703, fully updated but the same OS behaviour is present on Windows 7 too.

Please add an option to skip NTFS Junctions/symlinks or add some recursive path loop detection logic when creating/verifying checksums.

I think an option to skip NTFS Junctions and NTFS symlinks (for folders only) would be much simpler.

R-Adrian avatar May 09 '17 12:05 R-Adrian

I haven't encountered this problem, but am using Windows 10 v1703 (latest build). I echo that this potential issue should be addressed in some form.

ZPNRG avatar May 10 '17 18:05 ZPNRG

even Win 10 1703 has this... it's done by design by Microsoft for compatibility with older programs that expect a different structure of the user profile folder.

please check the user profile folder on your computer and try to create a recursive checksum file for it.

HashCheck will "find" a lot more files than there are actually on disk because it follows NTFS folder junctions and symlinks.

R-Adrian avatar May 11 '17 06:05 R-Adrian

I think it should skip NTFS junctions and Symlink folders by default.

surfasb avatar Jul 07 '17 23:07 surfasb

Having the option to allow / disallow following junctions would be most beneficial, IMO, with the caveat that by default it is disallowed.

JohnLGalt avatar Apr 05 '18 16:04 JohnLGalt

update: i have noticed that Microsoft has introduced a new group policy for Win10 in recent years that significantly alters the maximum possible file path length:

gpedit.msc -> computer -> administrative templates -> system -> filesystem -> Enable Win32 long paths

this policy, if enabled, coupled with HashCheck's bug of blindly traversing paths recursively means that the recursion depth is increased by a few orders of magnitude.... basically it becomes an (almost) never-ending loop (not quite infinite, but high enough to feel like an infinite loop)

image

R-Adrian avatar Jul 29 '19 15:07 R-Adrian

Yummy. As if my ancient system doesn't have enough issues.

Seriously, though, I just cleanly installed 1903, and then joined the Insider Program and took the Skip Ahead build 18945 - and that setting is currently set to Not configured.

But it can be enabled - and with near disastrous effects with HC also installed.

JohnLGalt avatar Jul 30 '19 03:07 JohnLGalt

Junctions should probably be skipped in general unless you override and force to follow them.. Why would you want to follow junctions when there is an actual folder taking you in most cases.. junctions are sometimes (typically?) for compatibility w/ previous (legacy) paths for compatibility.. For example, the \Users[username]\AppData\Local\Application Data\ folder links back to \Users[username]\AppData\Local\ <- This example is also recursing.

RchGrav avatar Sep 07 '19 10:09 RchGrav

Well, I don't like accessing things like .ISOs in folders that are several layers down the chain - so I have those locations that I use often (for example, the folders where I store newly created Windows 10 Insider Preview .ISOs from UUPDUMP.ml) junctioned back to a single F:\ISOs\ folder for easy access.

As the contents of the folder F:\Storage\ISOs\OSs\Windows\10\ changes on a nearly weekly basis....

Yes, I know - I'm the exception to the rule - but as you can probably bet, those (and other files in a similar situation, whose parent folder I've junctioned to a shallow location) are also exactly the files that I will need to verify hashes on.....

JohnLGalt avatar Sep 08 '19 00:09 JohnLGalt

There are soft and hard links, and also shared folders.

superbonaci avatar Apr 25 '20 22:04 superbonaci