Skip to content

chore(deps): Downgrade 7zip to v16.02 in nix packaging #1167

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

Merged
merged 3 commits into from
Apr 14, 2025
Merged

Conversation

kukovecz
Copy link
Contributor

No description provided.

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.

LGTM. However, I would like the commit to describe what those problems are.

Found some problems with 7z based extractions using the nix environment
which does not happen in debian.

Is the extraction different ? Did options changed ?

@qkaiser qkaiser added the dependencies Pull requests that update a dependency file label Apr 14, 2025
Found some problems with 7z based extractions using the nix environment
which does not happen in debian. The reason is that debian still using a
quite old stable version of the 7z, while a newer one is coming from
nixpkgs.

This commit downgrades 7zip version used by unblob's nix packaging to the same
version (applying the same patches) as debian does, hopefully making the
extractors more stable using nix-based environment.

7zip maintainers changed the behavior or MBR extraction between version
16.02 and 17.05:

- on 16.02, 7z creates a file per MBR partition in the extraction
  directory, regardless of the amount of partitions. So we get these
  files named ("0.img", "1.img") after their partition entry ID.
- on 17.05, 7z will automagically extract the partition itself if there
  is a single partition within the MBR and that partition is a supported
  filesystem format (e.g. extfs). So instead of having a "0.img" file,
  you immediately get the content of that partition written to disk.

Since one of the main objective of unblob is to identify known/unknown
chunks and provide detailed meta-data about them, we consider important
to have that intermediate step provided by 16.02. This way we know the
MRB contains a partition of a specific type, which itself was handled by
a dedicated unblob handler.

This behavior is kind of invisible on unblob-core since the MBR handler
is only available on the ONEKEY platform right now.

7z 17.05 also has issues when extracting ZIP files, where it does not
accept full path for the "-o" option. For example, "-o/tmp/lol" won't
work, but "cd /tmp/lol; 7z x -p -y sample.zip -o." will. On top of that,
7z seems to set arbitrary permissions on the output directory.
@qkaiser
Copy link
Contributor

qkaiser commented Apr 14, 2025

LGTM. However, I would like the commit to describe what those problems are.

Found some problems with 7z based extractions using the nix environment
which does not happen in debian.

Is the extraction different ? Did options changed ?

Investigated and edited the commit message:

7zip maintainers changed the behavior or MBR extraction between version
16.02 and 17.05:

- on 16.02, 7z creates a file per MBR partition in the extraction
  directory, regardless of the amount of partitions. So we get these
  files named ("0.img", "1.img") after their partition entry ID.
- on 17.05, 7z will automagically extract the partition itself if there
  is a single partition within the MBR and that partition is a supported
  filesystem format (e.g. extfs). So instead of having a "0.img" file,
  you immediately get the content of that partition written to disk.

Since one of the main objective of unblob is to identify known/unknown
chunks and provide detailed meta-data about them, we consider important
to have that intermediate step provided by 16.02. This way we know the
MRB contains a partition of a specific type, which itself was handled by
a dedicated unblob handler.

This behavior is kind of invisible on unblob-core since the MBR handler
is only available on the ONEKEY platform right now.

7z 17.05 also has issues when extracting ZIP files, where it does not
accept full path for the "-o" option. For example, "-o/tmp/lol" won't
work, but "cd /tmp/lol; 7z x -p -y sample.zip -o." will. On top of that,
7z seems to set arbitrary permissions on the output directory.

@qkaiser qkaiser enabled auto-merge April 14, 2025 09:07
@qkaiser qkaiser added this pull request to the merge queue Apr 14, 2025
Merged via the queue into main with commit 159796a Apr 14, 2025
27 checks passed
@qkaiser qkaiser deleted the 7zip-nix branch April 14, 2025 09:22
@vlaci
Copy link
Contributor

vlaci commented Apr 14, 2025

Also worth mentioning that Debian and RHEL are both sticking to 16.02 as of now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants