robocopy.exe: Error 1921, Recursive Junctions (Reparse Points) - by SurroundedByChaos

Status : 


Sign in
to vote
ID 776397 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 1/12/2013 9:01:36 AM
Access Restriction Public


Since the introduction of reparse points, one type being a junction point, in Windows 2000, the Directed Acyclic Graph (DAC) that was once the NTFS file system, can now contain loops.   A loop in this situation refers to a subdirectory created as reparse point, that targets one of its parent directories.  For tools, such as robocopy, that recursively walk the file system directory structure, a child directory implemented as a looping reparse point will either directly or indirectly cause the program to revisit one of its parent directories, thus restarting the tool's recursive decent, over, and over, and over....  So why has this bug been neglected for over a decade now?

It wasn't until the introduction of Windows Vista, when to their credit, Microsoft sensibly reconfigure its file system directory structure, that reparse points surfaced as the recurrent mechanism to support backward compatibility of the frankly wordy and document centric  "\Documents And Settings" tree.  Unfortunately, in order to remap “\Documents And Settings” to the new “\Users” directory tree, a small number of looping reparse points were introduced by Vista (which grow linearly with each additional user account).   However, only one looping reparse point need exist to induce chaos within programs coded assuming a DAC file system when traversing it.  

In the case of robocopy, a looping reparse point eventually causes robocopy to issue the following message:  “ERROR 1921 The name of the file cannot be resolved by the system.”, as the length of the path it's attempting to traverse/backup exceeds the OS maximum.

Although a number of posts recommend using robocopy's /XJ switch, to exclude/ignore junction points, this recommendation simply subverts the purpose of robocopy: to create a faithful reproduction of the file system, as all junction points, even ones that aren't loopers are excluded.

I'm simply requesting that a Microsoft Developer repair robocopy:
1.   Identify & save all reparse points and their properties, such as ACL lists, but don't traverse them. 
2. Or detect a looping reparse point and treat a direct/indirect traversal to a parent node within the reparse point's path as a leaf node of the reparse point's directory chain. Remember, one can define a subdirectory of a reparse point that is also a reparse point. 
Sign in to post a comment.