Search via circular links

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

mkobylan
Junior Member
Junior Member
Posts: 12
Joined: 2012-01-01, 22:31 UTC

Search via circular links

Post by *mkobylan »

When searching on entire disk in Windows 7 and in TC8.0beta14 (also in TC7.56a) Total commander is trapped in circular links like e.g. c:\Users\%username%\AppData\Local\Application Data\ (which points to parent c:\Users\%username%\AppData\Local\) and it finds many duplicated files/folders which are in fact same files/folders. It is currently only stopped by MAX_PATH. Anyway it is uncomfortably few times slower and result has to be manually filtered for duplicates.
I recommend testing if folder is actually link and pass through it only once (or 0 times - could be an option because it usually points to other folder on the same disk which is passed anyway). As number of links is relatively small (<20) it may not slow down searching at all.
In the future you should consider Total commander to contain builtin support for these links (creating, deleting, modifying target) and correct handling in all batch operations (copying, moving, deleting files inside linked folders) as well as for other advanced features of NTFS (e.g. permissions - see my other message).
Thanks
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You may add unwanted links to ignore list so TC will just skip them while searching.
mkobylan
Junior Member
Junior Member
Posts: 12
Joined: 2012-01-01, 22:31 UTC

ignore list doesn't help in all cases

Post by *mkobylan »

Though ignore list seems to be a good workaround it doesn't help here in general. Having multiple users either all users' Application data folders have to be included in ignore list (when using absolute paths) or Application data is not visible in any other situations any more (when using relative paths).
Anyway, thanks for suggestion of workaround till it gets fixed with universal solution.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50548
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

This is a known problem which CANNOT be fixed. It happens only with links where Total Commander isn't allowed to read the target location, but is allowed to list the files inside. To avoid the problem, you need to give yourself the right to read from the link.
Author of Total Commander
https://www.ghisler.com
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

2mkobylan
Could you please check using cmd.exe and dir if the target location actually cannot be read and report?
If dir can read the target than the problem is a TC problem.
mkobylan
Junior Member
Junior Member
Posts: 12
Joined: 2012-01-01, 22:31 UTC

Post by *mkobylan »

Here's screenshot of "dir /aH" - it has target location:
Image: http://01.sk/tcmd-junctions1.png
Same result with NL_Info content plugin (https://plugins.ghisler.com/content/wdx_nl_info.zip):
Image: http://01.sk/tcmd-junctions2.png
The only junction without target location is c:\Users\All Users\ (readable in "dir" but not in NL_Info):
Image: http://01.sk/tcmd-junctions3.png
Image: http://01.sk/tcmd-junctions4.png
User avatar
Lefteous
Power Member
Power Member
Posts: 9537
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

Well so far I don't see which target should be unreadable...

NL_Info doesn't seem to support symbolic links completely.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50548
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

2mkobylan
It looks like you checked the permissions in the wrong directory. Please check them in
c:\Users\%username%\AppData\Local

According to your first post, the link "Application Data" seems to have that problem.
Author of Total Commander
https://www.ghisler.com
User avatar
Flint
Power Member
Power Member
Posts: 3506
Joined: 2003-10-27, 09:25 UTC
Location: Belgrade, Serbia
Contact:

Post by *Flint »

mkobylan
Symbolic links are supported since NL_info 1.20. You are probably using an older version.

ghisler(Author)
It seems that this problem occurs in some specific configuration of links/junctions. I cannot reproduce the problem with AppData, but I have a self-made link in Documents\Incoming that points to Documents, and when I'm searching TC starts an endless loop, going deeper and deeper, though all the link targets are readable. However, when I tried to construct a simplified structure of folders/links for posting it here, I failed to make TC cycle.

So, either there are some specific permissions that do not prevent reading the link targets but nonetheless affect TC behaviour somehow, or some other links (that are already present in the directory) produce unpredicted influence. I'll try to find out how to duplicate a problematic directory tree.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 11.03 / Win10 x64
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

However, when I tried to construct a simplified structure of folders/links for posting it here, I failed to make TC cycle.
It is quite easy. E.g.:
1. Folder F:\TEMP\0\1
2. Junction F:\TEMP\0\1\2 that points to F:\TEMP\0
3. Put some files to folder F:\TEMP\0.
4. Use search in F:\TEMP\0:

Code: Select all

F:\TEMP\0\1\
F:\TEMP\0\1\2\
F:\TEMP\0\1\2\0\
F:\TEMP\0\1\2\0\1\
F:\TEMP\0\1\2\0\1\2\
F:\TEMP\0\1\2\0\1\2\0\
F:\TEMP\0\1\2\0\1\2\0\1\
F:\TEMP\0\1\2\0\1\2\0\1\2\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\0\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\0\1\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\0\1\2\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\0\1\2\0\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\0\1\2\0\1\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\0\1\2\0\1\2\
F:\TEMP\0\1\2\0\1\2\0\1\2\0\1\2\0\1\2\0\1\2\0\
...
But I can't get loop with C:\Users\User\AppData\Local\Application Data link. It has special permissions: it is forbidden to list folder contents for all users (permissions, advanced, all users, the only item that is checked is mentioned one in 'forbid' column). So, TC can't list folder contents => can't search in it => skips it. If your folder has wrong permissions, it seems that someone has changed them.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50548
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I just checked it - the infinite loop detection code is there, but it isn't called (because the reparse point flag isn't stored when reading the directory). I will fix it. The code works correctly for example in branch view (Ctrl+B) or when using SPACEBAR to count the size.
Author of Total Commander
https://www.ghisler.com
mkobylan
Junior Member
Junior Member
Posts: 12
Joined: 2012-01-01, 22:31 UTC

Post by *mkobylan »

I have set all permissions on entire C:\ to Everyone Full control (from outside) because I had some issues with default settings. It seems that better way would be to switch to FAT32 :(.
=>Permissions are same for my account as well as for Default user account. I just thought it would be simpler to not erase my user name from screenshot in so many places so I posted Default user screenshot.
Though special folder permissions or 'infinite loop detection' fallback are useful for unknown problems, we may need to implement special handling for reparse points in the future.

I have installed NL_Info 1.02 which was linked from TCMD addons page. After installing 1.11 from http://flint-inc.ru/files/mlang/nlinfo_1.11.rar however it didn't tell me more about reparse point target of c:\Users\All Users.

SPACEBAR and CTRL+B also enters this 'almost infinite' loop in my case.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

You may try my NTLinks, it supports symlinks too.

But the reason of your problem is that you messed all permissions up. It is not safe to do this, default settings forbid writes to system folders for regular users, only admins can do it (UAC forbids such writes even for regular admin apps that are not elevated for further security).

And, now you know how to resolve your problem - just forbid to list folder contents for theese reparse points for special user Everyone, they are left for compatibility only (they allow old programs to open files via old-style paths), you shouldn't use them at all.
User avatar
Flint
Power Member
Power Member
Posts: 3506
Joined: 2003-10-27, 09:25 UTC
Location: Belgrade, Serbia
Contact:

Post by *Flint »

mkobylan wrote:I have installed NL_Info 1.02 which was linked from TCMD addons page. After installing 1.11 from http://flint-inc.ru/files/mlang/nlinfo_1.11.rar however it didn't tell me more about reparse point target of c:\Users\All Users.
The homepage is not up-to-date yet. The latest version is 1.20, can be taken from totalcmd.net.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 11.03 / Win10 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50548
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Could someone test whether this works correctly now, please?
Author of Total Commander
https://www.ghisler.com
Post Reply