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
Makefile.common: use system sha256sum if available #1967
Conversation
ec3dfc1
to
27235f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to understand why the build is failing, but I suppose I don't mind using the system copy -- having different implementations for this is actually sort of reasonable given what it's checking
The pull request that added that originally used the system sha256, but then it was noted in #1669 (review) that this could break the Makefile. So putting back in the Makefile a check for whether a system binary exists could go back to square one of breaking the Makefile. I'm also quite surprised that the current setup is broken for you, as it should be self-contained and the binary is relatively simple. What error do you get? |
Shoot, I misread @bradjc's review as having no binary at all, instead of a different one with other options. Nonetheless, this proposed approach shouldn't break anything, as it first uses the system
Me as well. I'm not currently aware under what circumstances this actually produces a broken binary, but I suspect it being the result of a combination of the It's someting along the lines of |
Maybe instead of invoking the binary directly as |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should set variable for tool name rather than define different rules.
This still requires the custom sha256sum binary to be listed in the prerequisites and I have not found a way to make that dynamic (e.g. based on a variable).
This also avoids the issue of having to put the binary into the rule's prerequisites conditionally.
I changed it to work using a conditional variable. However having a conditionally set prerequisite for a make rule gave me a hard time, so applying @gendx's recommendation of As per @ppannuto's recommendation to use I can also add checks for the |
This is fine by me, although given that we have the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
I guess I don't really see the issue of using the cargo version, but also don't really see a lot of harm in this. It's pretty contained and seems to work.
Pull Request Overview
Use the
sha256sum
binary from coreutils/busybox/... if installed.Somehow the compilation of the custom shipped
sha256sum
binary often fails for me, chooses the wrong interpreter or does other weird stuff. Often deleting the respectivetarget/
directory helps, sometimes "uninstalling" rustup (I'm on Nix, so I just leave the nix-shell) helps. In any case this is annoying and since a lot of systems have this preinstalled (almost Linux distributions I'm aware of), we can avoid building our custom application.Going further
There's no technical reason to not do what we currently do, but building our own replacement for something available on virtually every OS's package manager - which could instead be specified as an (optional) build dependency - feels over-engineered. It makes it our responsibility that the produced
sha256sum
binary is bug-free and secure and we must ensure the build process works.Even #1669 mentioned that this isn't mandatory for the build. For the reasons outlined above, I would propose to use the binary if present, specify it as an optional build-time dependency and only run it when it's present.
Tagging @gendx @bradjc, since they were involved #1669.
Testing Strategy
Building a board with
sha256sum
in $PATH and excluded from $PATH.Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.