Skip to content
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

sasquatch: 4.4 -> 4.5.1-1 #219169

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

sasquatch: 4.4 -> 4.5.1-1 #219169

wants to merge 4 commits into from

Conversation

vlaci
Copy link
Contributor

@vlaci vlaci commented Mar 2, 2023

Required for #217836

Description of changes

Changed using ONEKEY fork of sasquatch which is up-to-date with squashfs-tools 4.5.1 and the Darwin compatibility patch shipped in Nixpkgs applies cleanly as well.

I have chosen to override the squashfsTools derivation, as this fork is entirely compatible with that version. I am open to critique on this. I wasn't sure copying from squashfstools or lifting a generic.nix base derivation out of it is the better solution. Existing NixOS test is also nice to have as a validation, although it may be overkill here.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@vlaci
Copy link
Contributor Author

vlaci commented Mar 3, 2023

Ah, figured keeping the existing test doesn't make sense as it will just use squashfs-tools anyway.

@AkechiShiro
Copy link
Contributor

Any news, any blockage ? Or any review from @Pamplemousse if he is still the right contact for this PR ?

@vlaci
Copy link
Contributor Author

vlaci commented May 22, 2023

Some questions got answerred: I shouldn't depend on squashFsTools at all, as it got updated to 4.6.1, and it is unlikely I want to rebase sasquatch the near future.

@vlaci
Copy link
Contributor Author

vlaci commented Jun 19, 2023

As squashfsTools derivation is now incompatible with previous versions, I have recreated the derivation from scratch.

@Pamplemousse
Copy link
Member

@AkechiShiro Sorry I missed your message earlier.

I have stopped using this package in years... I am not well placed to test.
Also, could you remove me from the maintainers please?

vlaci added a commit to vlaci/nixpkgs that referenced this pull request Jun 19, 2023
@vlaci
Copy link
Contributor Author

vlaci commented Jun 19, 2023

@AkechiShiro Sorry I missed your message earlier.

I have stopped using this package in years... I am not well placed to test. Also, could you remove me from the maintainers please?

Done

@qkaiser
Copy link
Contributor

qkaiser commented Dec 24, 2023

This PR has been stuck for the last 6 months waiting for a review from someone who explicitly requested to be removed from the maintainers list.

Who should review this then ? How can we make it move forward ?

Asking cause it's the last item missing in out meta-issue to get unblob in nixpkgs #217836

@AkechiShiro
Copy link
Contributor

AkechiShiro commented Dec 27, 2023

This PR needs a rebase, first of all on master @vlaci could you please rebase?

@Pamplemousse Pamplemousse removed their request for review December 27, 2023 10:52
vlaci added a commit to vlaci/nixpkgs that referenced this pull request Jan 1, 2024
vlaci added a commit to vlaci/nixpkgs that referenced this pull request Jan 1, 2024
@vlaci
Copy link
Contributor Author

vlaci commented Jan 1, 2024

Happy new year everyone :)
Rebased on master.

@AkechiShiro
Copy link
Contributor

AkechiShiro commented Jan 2, 2024

Thanks @vlaci, there seems to be a typo in the meta attribute of the package, please fix it, so that the ofborg evaluation test passes, see more details : https://gist.github.com/GrahamcOfBorg/6d11645476eaaef9b7fc87c573d4a188, meta.mainprogram should be meta.mainProgram.

I cannot help further as I'm inexperienced in reviews @qkaiser, maybe mentioning the pull request as ready for review here, should bring this PR to more experienced reviewers : https://discourse.nixos.org/t/prs-ready-for-review and hopefully help.

vlaci added a commit to vlaci/nixpkgs that referenced this pull request Jan 2, 2024
@qkaiser
Copy link
Contributor

qkaiser commented Jan 3, 2024

@AkechiShiro thanks for the heads up, I sent a reply to the Discourse thread asking for a review on this PR

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/1016/87

Copy link
Contributor

@tnias tnias left a comment

Choose a reason for hiding this comment

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

I ran nixpkgs-review and sucessfully used both x86_64 and aarch64 to extract an example squashfs I found somewhere on my disk.
For me the diffoscope tests are broken on master on x86_64 even without this patch.


Result of nixpkgs-review pr 219169 run on x86_64-linux 1

3 packages failed to build:
  • diffoscope
  • diffoscope.dist
  • diffoscope.man
10 packages built:
  • binwalk (python311Packages.binwalk)
  • binwalk.dist (python311Packages.binwalk.dist)
  • python310Packages.binwalk
  • python310Packages.binwalk-full
  • python310Packages.binwalk-full.dist
  • python310Packages.binwalk.dist
  • python311Packages.binwalk-full
  • python311Packages.binwalk-full.dist
  • sasquatch
  • sasquatch-v4be

Result of nixpkgs-review pr 219169 run on aarch64-linux 1

13 packages built:
  • binwalk (python311Packages.binwalk)
  • binwalk.dist (python311Packages.binwalk.dist)
  • diffoscope
  • diffoscope.dist
  • diffoscope.man
  • python310Packages.binwalk
  • python310Packages.binwalk-full
  • python310Packages.binwalk-full.dist
  • python310Packages.binwalk.dist
  • python311Packages.binwalk-full
  • python311Packages.binwalk-full.dist
  • sasquatch
  • sasquatch-v4be

@Mic92
Copy link
Member

Mic92 commented Mar 6, 2024

What does the bigendian variant do? Do we need both?

pname = "sasquatch";
version = "4.4";
drv = stdenv.mkDerivation rec {
pname = "sasquatch${lib.optionalString bigEndian "-v4be"}";
Copy link
Member

@tilpner tilpner Mar 6, 2024

Choose a reason for hiding this comment

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

This repeats the version number (v4), that's already appended to pname, so the full name would be sasquatch-v4be-4.5.1-4. Perhaps it should just be sasquatch-be?

Copy link
Contributor

Choose a reason for hiding this comment

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

The v4be indicates the squashfs filesystem version while the 4.5.1-4 indicates the squashfs-tools version sasquatch is based on. These versions are unrelated.

@qkaiser
Copy link
Contributor

qkaiser commented Mar 7, 2024

What does the bigendian variant do? Do we need both?

sasquatch is built on top of squashfs-tools to support non standard squashfs filesystems. By the standard, squashfs version 4.0 filesystems are fixed little-endian. There are no big-endian 4.0 filesystems. However, embedded vendors love to mess with standards. So instead of adapting squashfs-tools code, we build a version with __BYTE_ORDER swapped which is the sasquatch-v4be binary. This binary can handle non-standard squashfs v4 big-endian filesystems.

More information about the big-endian variant can be found at onekey-sec/sasquatch@0c65f00

Here's a small preview of what vendors do with squashfs. Cells with a star (*) are standard.

type v2​ v3​ v4 DDWRT v3​ Broadcom v3​ ??? v3​ AVM​ Netgear​
magic (LE) hsqs*​ hsqs*​ hsqs*​ hsqt​ shsq​ zlqs​ Header in BE, but chunks in LE.​ Let‘s use a non standard LZMA + XZ compression !​
magic (BE)​ sqsh*​ sqsh*​ sqsh​ tqsh​ qshs​ sqlz​ / /

@smancill
Copy link
Contributor

What's the status of this? Can it be merged?

@AkechiShiro
Copy link
Contributor

Hello @smancill I think there was a review that approved the package, I guess running nixpkgs-review on this PR and testing the tool and leaving a comment stating how it went could help move the PR forward.

I don't know however if a rebase is needed to make sure that the current package still build with the latest upstream in Nixpkgs.

@AkechiShiro
Copy link
Contributor

AkechiShiro commented Sep 1, 2024

@vlaci there might be a dead link as a source for the current version :
image

I cannot find the repo on GitHub, maybe there is new unblob that is being worked on that doesn't depend on sasquatch ?

I only found this repo : https://github.com/onekey-sec/sasquatch

EDIT :

  • nixpkgs-review result :
1 package failed to build:
sasquatch-v4be

14 packages built:
binwalk binwalk.dist diffoscope diffoscope.dist diffoscope.man python310Packages.binwalk python310Packages.binwalk-full python310Packages.binwalk-full.dist python310Packages.binwalk.dist python311Packages.binwalk python311Packages.binwalk-full python311Packages.binwalk-full.dist python311Packages.binwalk.dist sasquatch

error: build log of '/nix/store/40nfx0yjl4q7965p05dkqgavd9xjbh7j-sasquatch-v4be-4.5.1-4.drv^*' is not available
error: build log of '/nix/store/bw99kzndaqc2r8bykzcjc34z91a964j0-sasquatch-v4be-4.5.1-4' is not available

@vlaci
Copy link
Contributor Author

vlaci commented Sep 9, 2024

@vlaci there might be a dead link as a source for the current version : image

I cannot find the repo on GitHub, maybe there is new unblob that is being worked on that doesn't depend on sasquatch ?

I only found this repo : https://github.com/onekey-sec/sasquatch

EDIT :

  • nixpkgs-review result :
1 package failed to build:
sasquatch-v4be

14 packages built:
binwalk binwalk.dist diffoscope diffoscope.dist diffoscope.man python310Packages.binwalk python310Packages.binwalk-full python310Packages.binwalk-full.dist python310Packages.binwalk.dist python311Packages.binwalk python311Packages.binwalk-full python311Packages.binwalk-full.dist python311Packages.binwalk.dist sasquatch

error: build log of '/nix/store/40nfx0yjl4q7965p05dkqgavd9xjbh7j-sasquatch-v4be-4.5.1-4.drv^*' is not available
error: build log of '/nix/store/bw99kzndaqc2r8bykzcjc34z91a964j0-sasquatch-v4be-4.5.1-4' is not available

It must have been a github api error, as the source is there...

vlaci added a commit to vlaci/nixpkgs that referenced this pull request Sep 9, 2024
@vlaci
Copy link
Contributor Author

vlaci commented Sep 9, 2024

IDK if I should move these from all-packages accorving to nixpkgs-vet.

@AkechiShiro
Copy link
Contributor

I believe there is a typo in the package @vlaci

       error: evaluation aborted with the following error message: 'Failed to evaluate sasquatch-4.5.1-4: «unknown-meta»: has an invalid meta attrset:
         - key 'meta.mainprogram' is unrecognized; expected one of:
         ['available', 'badPlatforms', 'branch', 'broken', 'changelog', 'description', 'downloadPage', 'executables', 'homepage', 'hydraPlatforms', 'insecure', 'isBuildPythonPackage', 'isFcitxEngine', 'isGutenprint', 'isHydraChannel', 'isIbusEngine', 'knownVulnerabilities', 'license', 'longDescription', 'mainProgram', 'maintainers', 'maxSilent', 'name', 'outputsToInstall', 'pkgConfigModules', 'platforms', 'position', 'priority', 'schedulingPriority', 'sourceProvenance', 'tag', 'tests', 'timeout', 'unfree', 'unsupported', 'version']
       '

mainprogram -> mainProgram, if you can also solve the conflict and rebase the PR please ?

vlaci added a commit to vlaci/nixpkgs that referenced this pull request Sep 11, 2024
@vlaci
Copy link
Contributor Author

vlaci commented Sep 11, 2024

I believe there is a typo in the package @vlaci

       error: evaluation aborted with the following error message: 'Failed to evaluate sasquatch-4.5.1-4: «unknown-meta»: has an invalid meta attrset:
         - key 'meta.mainprogram' is unrecognized; expected one of:
         ['available', 'badPlatforms', 'branch', 'broken', 'changelog', 'description', 'downloadPage', 'executables', 'homepage', 'hydraPlatforms', 'insecure', 'isBuildPythonPackage', 'isFcitxEngine', 'isGutenprint', 'isHydraChannel', 'isIbusEngine', 'knownVulnerabilities', 'license', 'longDescription', 'mainProgram', 'maintainers', 'maxSilent', 'name', 'outputsToInstall', 'pkgConfigModules', 'platforms', 'position', 'priority', 'schedulingPriority', 'sourceProvenance', 'tag', 'tests', 'timeout', 'unfree', 'unsupported', 'version']
       '

mainprogram -> mainProgram, if you can also solve the conflict and rebase the PR please ?

Thanks, this error did not emerge on my Nix version.
Also, I botched up a previous patch, hence the conflict. Adjusted.

@AkechiShiro
Copy link
Contributor

Tested a build (nixpkgs-review seems a bit confused however) with the new changes, seems to be working alright.

Output of nixpkgs-review :

8 packages removed:
binwalk (†2.4.2) diffoscope (†277) ghidraninja-ghidra-scripts-unstable (†2020-10-07) python3.11-binwalk (†2.4.2) python3.11-binwalk-full (†2.4.2) python3.12-binwalk (†2.4.2) python3.12-binwalk-full (†2.4.2) sasquatch (†4.4)

Nothing to be built.

I ran the build manually.

Copy link
Contributor

@AkechiShiro AkechiShiro left a comment

Choose a reason for hiding this comment

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

Just waiting for sasquatch-v4be to be moved from top-level/all-packages.nix into by-name/sa/sasquatch-v4be, then I will approve this PR on my side, I can't really test however on nix darwin

pkgs/by-name/sa/sasquatch/package.nix Outdated Show resolved Hide resolved
pkgs/top-level/all-packages.nix Show resolved Hide resolved
vlaci pushed a commit to onekey-sec/unblob that referenced this pull request Sep 11, 2024
NOTE: as of now, it requires overriding nixpkgs to
NixOS/nixpkgs#219169
vlaci pushed a commit to onekey-sec/unblob that referenced this pull request Sep 11, 2024
@vlaci
Copy link
Contributor Author

vlaci commented Sep 11, 2024

Just waiting for sasquatch-v4be to be moved from top-level/all-packages.nix into by-name/sa/sasquatch-v4be, then I will approve this PR on my side, I can't really test however on nix darwin

I've created a draft PR for unblob pointing to this branch, so its tests will run for darwin as well: https://github.com/onekey-sec/unblob/pull/946/checks

Changed using ONEKEY fork of sasquatch which is up-to-date with
squashfs-tools 4.5.1 and the Darwin compatibility patch used to be
shipped in Nixpkgs applies cleanly as well.

The updated version also provides a big-endian compatible build as
well to support even more insane squashfs dialects.
@AkechiShiro
Copy link
Contributor

I don't think the ghidra failure is related :

1 package failed to build:
ghidra-extensions.ghidraninja-ghidra-scripts

13 packages built:
binwalk binwalk.dist diffoscope diffoscope.dist diffoscope.man python311Packages.binwalk python311Packages.binwalk-full python311Packages.binwalk-full.dist python311Packages.binwalk.dist python312Packages.binwalk-full python312Packages.binwalk-full.dist sasquatch sasquatch-v4be

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/4576

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

Successfully merging this pull request may close these issues.

10 participants