-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TarWriter on Windows Server treats File Deduplication reparse point flag as symbolic links #82949
Comments
Tagging subscribers to this area: @dotnet/area-system-io Issue Detailsruntime/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarWriter.Windows.cs Line 25 in 9fd3ece
As seen in the snippet above, the Tar Entry gets mistaken for a symlink if the reparse point flag is set, but it doesn't verify if the file/directory is actually a symlink/junction. Windows Server with file deduplication enabled, or even OneDrive synced files, can set the Reparse point flag, but utilizes entirely different reparse tags. IO_REPARSE_TAG_DEDUP is used for deduplication, whereas IO_REPARSE_TAG_MOUNT_POINT & IO_REPARSE_TAG_SYMLINK are used for junctions and symlinks.
|
I should note, this results in the following exception:
|
Looking further, it appears this line is masking the issue (which ultimately leads to the exception due to the fallback to passing runtime/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarWriter.Windows.cs Line 61 in 9fd3ece
|
@jozkee @adamsitnik is this something that the System.IO APIs do correctly, or do we have to address this problem in both the Tar APIs and the IO APIs? (maybe Zip too?) |
|
Sorry, the wording wasn't clear. I meant that it returns |
I see what you mean. We should explicitly confirm that the file is a reparse point of type junction, and nothing else, and if the answer is "junction", we should store it in the archive as a symbolic link (because it's the closest entry type to junction, and because the Tar spec does not officially support junctions). I am unsure how the other reparse points should be treated. I suspect we could try treating them as regular files. I'd have to investigate. If it's helpful for you, @billfreist , the workaround would be to manually extract that reparse point junction entry manually, using TarArchive to open the archive, then iterating the entries until the one that failed is found, and manually creating a symbolic link for it: https://learn.microsoft.com/en-us/dotnet/api/system.io.file.createsymboliclink?view=net-7.0 |
Ok I have a fix that would specifically check, just like we do in FileSystem.Windows.cs, that if we have a reparse point, we only treat it as a tar symlink if windows categorized it as a junction or as a symlink. |
runtime/src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarWriter.Windows.cs
Line 25 in 9fd3ece
As seen in the snippet above, the Tar Entry gets mistaken for a symlink if the reparse point flag is set, but it doesn't verify if the file/directory is actually a symlink/junction. Windows Server with file deduplication enabled, or even OneDrive synced files, can set the Reparse point flag, but utilizes entirely different reparse tags.
IO_REPARSE_TAG_DEDUP is used for deduplication, whereas IO_REPARSE_TAG_MOUNT_POINT & IO_REPARSE_TAG_SYMLINK are used for junctions and symlinks.
The text was updated successfully, but these errors were encountered: