xcaddy: use temp dir on Darwin

Upstream xcaddy uses the $HOME directory as the temp directory on Darwin
in order to fix an interesting bug.

In order to find version information for Caddy, it runs a command that
needs to operate on file system without "noexec" set, but Darwin's temp
directory has it set.

We can tolerate losing version information, since the alternative is
that xcaddy does not run on Darwin.
This commit is contained in:
Theodore Ni 2022-09-19 00:06:14 -07:00
parent 157918af5d
commit 7a23457bac
No known key found for this signature in database
GPG Key ID: 48B67583BDDD4474
2 changed files with 17 additions and 0 deletions

View File

@ -13,6 +13,10 @@ buildGoModule rec {
hash = "sha256-oGTtS5UlEebIqv4SM4q0YclASJNu8DNOLrGLRRAtkd8=";
};
patches = [
./use_tmpdir_on_darwin.diff
];
vendorHash = "sha256-RpbnoXyTrqGOI7DpgkO+J47P17T4QCVvM1CfS6kRO9Y=";
meta = with lib; {

View File

@ -0,0 +1,13 @@
diff --git a/builder.go b/builder.go
index ed6c5ef..36e8055 100644
--- a/builder.go
+++ b/builder.go
@@ -200,7 +200,7 @@ func NewReplace(old, new string) Replace {
// It is the caller's responsibility to remove the folder when finished.
func newTempFolder() (string, error) {
var parentDir string
- if runtime.GOOS == "darwin" {
+ if false && runtime.GOOS == "darwin" {
// After upgrading to macOS High Sierra, Caddy builds mysteriously
// started missing the embedded version information that -ldflags
// was supposed to produce. But it only happened on macOS after