Skip to content

feat(handler): add par2 directory handler #1166

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rxpha3l
Copy link
Contributor

@rxpha3l rxpha3l commented Apr 9, 2025

Parchive or PAR2, is a format for creating redundant data that helps detect and repair corrupted files. These archives typically accompany split-file sets (like multi-volume RAR or ZIP archives). Each PAR2 file is composed of multiple “packets.” The header starts with PAR2\x00PKT

Create PAR2 file:

par2create backup.par2 file_to_protect
While creating PAR2 backup of a file, parchive creates in the same directory multiple .par2 file. Every file that ends with .volXX+YY.par2 specifies form which block (X), how many more blocks it contains (Y).
E.g. backup.vol01+02.par2 would contain the first block + 2 more blocks etc.

Verify PAR2 file:

par2verify backup.par2

Header :

8 bytes : Magic
8 bytes : Packet length
16 bytes : MD5 hash
16 bytes : Recovery set ID
16 bytes : Recovery Type

Unblob identifies each PAR2 file in a given directory by validating the magic signature, computing the MD5 hash and validating it with the MD5 hash in the header. Since parchive is a repair tool, no extractor is specified.

[Sources]
https://docs.fileformat.com/compression/par/
https://parchive.github.io/
https://github.com/Parchive/par2cmdline/tree/master/src
https://parchive.github.io/doc/Parity%20Volume%20Set%20Specification%20v2.0.html

@rxpha3l
Copy link
Contributor Author

rxpha3l commented Apr 9, 2025

I have no idea why there is a temp commit.

@qkaiser qkaiser self-assigned this Apr 9, 2025
@qkaiser qkaiser added enhancement New feature or request format:filesystem python Pull requests that update Python code labels Apr 9, 2025
@qkaiser qkaiser added this to the Internship 2025 milestone Apr 9, 2025
@qkaiser qkaiser linked an issue Apr 9, 2025 that may be closed by this pull request
Copy link
Contributor

@qkaiser qkaiser left a comment

Choose a reason for hiding this comment

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

Please get rid of temporary commits (can be done with fixup) and delete the erofs leftovers (can be done by rebasing on upstream/main).

@rxpha3l rxpha3l force-pushed the par2 branch 4 times, most recently from 68a798e to 61d4df1 Compare April 9, 2025 13:05
@rxpha3l
Copy link
Contributor Author

rxpha3l commented Apr 9, 2025

Please get rid of temporary commits (can be done with fixup) and delete the erofs leftovers (can be done by rebasing on upstream/main).

everything is now as it should be

@qkaiser
Copy link
Contributor

qkaiser commented Apr 13, 2025

Commit a14e76a broke some typing, see:

/home/runner/work/unblob/unblob/python/unblob/models.py:427:34 - error: "get_dependencies" is not a known attribute of "None" (reportOptionalMemberAccess)
  /home/runner/work/unblob/unblob/python/unblob/models.py:442:39 - error: Argument of type "list[Path]" cannot be assigned to parameter "inpath" of type "Path" in function "extract"
    "list[Path]" is not assignable to "Path" (reportArgumentType)

We can have a look at it sometime this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request format:filesystem python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for Parity Archives (PAR/PAR2)
2 participants