detect recursive hardlinks in file search

Please report only one bug per message!

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
xrmb
Junior Member
Junior Member
Posts: 63
Joined: 2003-04-05, 16:54 UTC

detect recursive hardlinks in file search

Post by *xrmb »

In windows 7 Mircosoft started adding hardlinks/junctions all over the home directory. Every time I search some files in there TC gets caught up in an "endless loop" and finds the same file many many times.

Eg
c:\Documents and Settings\username\Local Settings\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\Application Data\

...The folder is linked to the parent.

It would be nice to have an option not to follow junctions, or even better if TC could detect these kind of self-referencing links.
I was born with Norton Commander, grew up with DCC, after school I played with Windows Commander, graduated, married and had kids with Total Commander and will die using whatever its called then Commander.
umbra
Power Member
Power Member
Posts: 871
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

TC can detect junctions and it does not end up in a loop when you search in them. However, TC can not properly detect the recursion, if it has to deal with symbolic links to directories. (they are not the same thing)

So yes, TC could be improved to handle such links as well.

But it should not happen with the example you have given:
1. Such path should not exist (if I'm not mistaken)
2. Windows uses junctions by default and (as noted above) they should already be handled properly
Windows 7 Pro x64, Windows 10 Pro x64
User avatar
xrmb
Junior Member
Junior Member
Posts: 63
Joined: 2003-04-05, 16:54 UTC

Post by *xrmb »

Well, I'm confused now. It works in TC 8.0 at home, it works on TC 8.01 x64 on my server, it does not work on TC 8.01 x64 at work.

Is there a hidden setting I'm missing?

Image: http://i.imgur.com/ivtafmm.png

Edit: img link fix
I was born with Norton Commander, grew up with DCC, after school I played with Windows Commander, graduated, married and had kids with Total Commander and will die using whatever its called then Commander.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

xrmb,
It seems that you've edited Application Data's permissions (which are special ones by default btw for all Microsoft compatibility links: forbid listing directory contents). So I see two ways here:
1. You can change permissions back (properties, Security tab, forbid mentioned action).
2. You can add Application Data to TC ignore list to prevent TC to enter it during search.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Actually TC can detect recursions with the standard user rights of these symbolic links. But in order to do this, TC has to read the target of the link. If user rights prohibit this, then TC has no chance to know whether it's a recursive link or not.
Author of Total Commander
https://www.ghisler.com
umbra
Power Member
Power Member
Posts: 871
Joined: 2012-01-14, 20:41 UTC

Post by *umbra »

2ghisler(Author)
I know it works for junctions (mklink /J). But with symbolic links to directories (mklink /D) the TC cannot detect a recursion. Could you add that check for such links too?
Windows 7 Pro x64, Windows 10 Pro x64
User avatar
xrmb
Junior Member
Junior Member
Posts: 63
Joined: 2003-04-05, 16:54 UTC

Post by *xrmb »

The only thing I did is encrypt my home directory. And I did that recursive on my home folder.

I just checked a folder I for sure never touched, same problem...
Image: http://i.imgur.com/cSgzFKp.png

Guess its something on this computer. I can not reproduce it anywhere else. But it is a standard Win7 64bit, fully patched, nothing special.
I was born with Norton Commander, grew up with DCC, after school I played with Windows Commander, graduated, married and had kids with Total Commander and will die using whatever its called then Commander.
moongazer
New Member
New Member
Posts: 1
Joined: 2013-08-13, 00:04 UTC

Post by *moongazer »

I agree with MVV. The problem described by the thread starter, xrmb, occurs when you meddle with the permissions for those links. However, I recommend using MVV's first suggested solution, not the second, because the problem (recursive folder expansion) is not limited to Total Commander.

I use a different but similar file manager, ZTree, but it will also occur in Windows Explorer or any other file manager that has an "expand all" function. (In ZTree and in Windows Explorer, you press numpad * on the relevant folder (or link) to expand the entire sub-tree from that point downwards.) If any folder in that sub-tree contains a link that points back to its own containing folder or to its parent, or if you use the "expand all" function on such a link itself, you will get runaway recursion in the resulting expansion, whatever file manager you use, if permissions for the link allow listing of the contents it points to.

I have documented the problem and the solution to it in this (pdf) article: tiny.cc/recursivefolderexpansion

The same problem also occurs in OSX (at least in Snow Leopard, which was the last version I used before my Mac died). It was worse than the Windows problem because in that case it did not manifest itself as a result of user meddling (from tampering with permissions). There was a folder (called, IIRC, "vol" or "vols"), which listed all mounted volumes, including the one in which it itself resided. Need I tell you what happened when I used the file manager's "expand all" function on that folder?

P.S. This reply was originally posted yesterday, but it seems to have gotten lost (as did my forum registration) in the server crash and subsequent restoration from backups mentioned here: ghisler.ch/board/viewtopic.php?t=37680
Post Reply