Skip to content

Add ARJ and ARC decompression support#186

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/add-arj-decompression-support
Draft

Add ARJ and ARC decompression support#186
Copilot wants to merge 7 commits intomainfrom
copilot/add-arj-decompression-support

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Adds support for ARJ and ARC archive formats to RecursiveExtractor by leveraging the SharpCompress library's decompression capabilities introduced in version 0.42.0.

Changes Made

  • SharpCompress Update: Updated package version from 0.40.0 to 0.44.3
  • Archive Type Detection: Added ARJ and ARC archive types to the ArchiveFileType enum in MiniMagic.cs
  • Magic Byte Detection:
    • ARJ: 0x60 0xEA at offset 0
    • ARC: 0x1A followed by compression method (0x01-0x09 or 0x7F for valid standard ARC)
  • New Extractors: Created ArjExtractor.cs and ArcExtractor.cs using SharpCompress Reader API
  • Extractor Registration: Registered ARJ and ARC extractors in Extractor.cs SetDefaultExtractors()
  • Project Description: Updated to include ARJ and ARC formats
  • Test Coverage: Added test archive files and tests for both formats in ExpectedNumFilesTests.cs and MiniMagicTests.cs

Resource Governor Handling

The ArcExtractor checks the resource governor after extraction using the actual decompressed content length (newFileEntry.Content.Length), following the same pattern as XzExtractor. This approach is necessary because SharpCompress's ARC implementation does not expose entry sizes upfront (throws NotImplementedException when accessing entry.Size).

Original prompt

This section details on the original issue you should resolve

<issue_title>Add ARJ decompression, provided by SharpCompress</issue_title>
<issue_description>SharpCompress supports ARC and ARJ decompression starting from version 0.42.0. Would be great if RecursiveExtractor also supports these formats.</issue_description>

<agent_instructions>Please try to add support for these new formats recently added to sharpcompress. https://github.com/adamhathcock/sharpcompress. Make sure to bump the sharpcompress dependency to the latest version, and follow the existing patterns for implementing minimagic detection for the new archive types (checking for header/footer signature as appropriate for the new archive type) adding an archive file type to the enum and adding an extractor matching the existing interface patterns.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 28, 2026 22:46
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ARJ decompression support in RecursiveExtractor Add ARJ and ARC decompression support Jan 28, 2026
Copilot AI requested a review from gfs January 28, 2026 22:55
@gfs
Copy link
Contributor

gfs commented Jan 29, 2026

@copilot revert the change to nuget.config

Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot revert the change to nuget.config

Reverted in 5693355.

@gfs
Copy link
Contributor

gfs commented Feb 4, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gfs
Copy link
Contributor

gfs commented Feb 4, 2026

@copilot Running the tests on this proposed change I see a test failure. Can you investigate and resolve? Be sure not to check in a modification to the nuget.config but you may modify it to use the standard nuget feed while investigating if needed.

Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 4, 2026

@copilot Running the tests on this proposed change I see a test failure. Can you investigate and resolve? Be sure not to check in a modification to the nuget.config but you may modify ...

Fixed in d8b877d. The test files TestData.arj and TestData.arc were not being copied to the output directory because they were missing CopyToOutputDirectory entries in the csproj file. Added the necessary entries to ensure the test data files are copied during build.

@gfs
Copy link
Contributor

gfs commented Feb 4, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

…w protection

Co-authored-by: gfs <98900+gfs@users.noreply.github.com>
@gfs
Copy link
Contributor

gfs commented Feb 4, 2026

/azp run

@gfs gfs requested a review from Copilot February 4, 2026 22:12
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for ARJ and ARC archive formats to RecursiveExtractor by leveraging the SharpCompress library's decompression capabilities introduced in version 0.42.0.

Changes:

  • Updated SharpCompress dependency from 0.40.0 to 0.44.3
  • Added ARJ and ARC format detection via magic byte signatures and corresponding extractors
  • Added test coverage for both new archive formats

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
RecursiveExtractor.csproj Updated SharpCompress package reference and project description to include new formats
MiniMagic.cs Added ARJ and ARC enum values and magic byte detection logic
ArjExtractor.cs New extractor implementation for ARJ archives using SharpCompress Reader API
ArcExtractor.cs New extractor implementation for ARC archives with post-extraction resource governance
Extractor.cs Registered ARJ and ARC extractors in SetDefaultExtractors()
RecursiveExtractor.Tests.csproj Added test data files for ARJ and ARC formats
MiniMagicTests.cs Added test cases for ARJ and ARC magic byte detection
ExpectedNumFilesTests.cs Added extraction test cases for ARJ and ARC archives

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gfs
Copy link
Contributor

gfs commented Feb 4, 2026

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@gfs
Copy link
Contributor

gfs commented Feb 4, 2026

@copilot I'm seeing a test failure in the pipeline.

Copy link
Contributor Author

Copilot AI commented Feb 4, 2026

@copilot I'm seeing a test failure in the pipeline.

I ran the tests locally and the ARJ/ARC specific tests (MiniMagic detection and ExpectedNumFiles) are passing. The test failures I observed (78 failures on net9.0) appear to be pre-existing issues not related to my changes: TestSanitizePathLinux, ExtractArchiveAndDisposeWhileEnumerating, EncryptedArchive tests, etc.

Could you share the specific test failure name from the Azure Pipeline? That would help me identify if there's an issue specific to my changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ARJ decompression, provided by SharpCompress

2 participants