psst icon indicating copy to clipboard operation
psst copied to clipboard

Don't read git config in build.rs

Open colemickens opened this issue 3 months ago • 4 comments

Describe the bug

I find it very inappropriate that psst-core's build.rs is... reading the git configuration.

We have to patch this in nixpkgs, and I'm glad that we do. It would be great to not have to carry a patch and manually rebase it constantly because of the choices to try to embed this information in the binary, in this way.

To Reproduce

see: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/ps/psst/make-build-reproducible.patch

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment

  • OS:
  • Version:

Additional context Add any other context about the problem here.

colemickens avatar Sep 25 '25 12:09 colemickens

By the way, I hit this when trying to test the auth fixes.

colemickens avatar Sep 25 '25 12:09 colemickens

I see, we read it just to get the build commit sha. Would there be another way you'd suggest that would be more preferable so this info can be kept?

jacksongoode avatar Sep 25 '25 12:09 jacksongoode

So, I think there's a method we can do to provide a "fake-git" to the package so that some things will work, but I'm not sure that will include the origin the way the build script expects it.

I'll dig in and send a patch when I figure out the least disruptive change on both sides.

Thanks for the quick reply!

colemickens avatar Sep 25 '25 12:09 colemickens

Have you looked at https://github.com/rustyhorde/vergen/ ? I think it leaves a placeholder in the values when they are unavailable due to missing git dir.

kingosticks avatar Sep 25 '25 13:09 kingosticks