UnauthorizedAccessException occurs for extracting tar file at .NET Framework 4.7.1 #596

Open
opened 2026-01-29 22:14:22 +00:00 by claunia · 1 comment
Owner

Originally created by @ghost on GitHub (Nov 7, 2023).

My application working on .NET Framework 4.7.1 needs to extract a tar file.

But System.UnauthorizedAccessException occurs while extracting tar file.

My code is like this

(The version of SharpCompress is 0.34.1)

using SharpCompress.Archives;
using SharpCompress.Common;

using (var archive = ArchiveFactory.Open(tarFilePath))
{
    foreach (var entry in archive.Entries)
    {
        if (!entry.IsDirectory)
        {
            entry.WriteToDirectory(outputDirectory, new ExtractionOptions()
            {
                ExtractFullPath = true,
                Overwrite = true
            });
        }
    }
}

Since there is no problem with the other library 'SharpZipLib' or System.Formats.Tar(on .NET 7), I think there is no problem with access permission on the file or directory.

Originally created by @ghost on GitHub (Nov 7, 2023). My application working on .NET Framework 4.7.1 needs to extract a tar file. But System.UnauthorizedAccessException occurs while extracting tar file. My code is like this (The version of SharpCompress is 0.34.1) ``` using SharpCompress.Archives; using SharpCompress.Common; using (var archive = ArchiveFactory.Open(tarFilePath)) { foreach (var entry in archive.Entries) { if (!entry.IsDirectory) { entry.WriteToDirectory(outputDirectory, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true }); } } } ``` Since there is no problem with the other library 'SharpZipLib' or System.Formats.Tar(on .NET 7), I think there is no problem with access permission on the file or directory.
claunia added the question label 2026-01-29 22:14:22 +00:00
Author
Owner

@Erior commented on GitHub (Dec 4, 2023):

The test suite does extractions with net462, do you have an example tar file that we can play with?

@Erior commented on GitHub (Dec 4, 2023): The test suite does extractions with net462, do you have an example tar file that we can play with?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#596