Skip to content

chore: Modified mktemp command for tarball extraction on macOS VMs#3698

Merged
DrJosh9000 merged 6 commits intobuildkite:mainfrom
elastic:main
Feb 11, 2026
Merged

chore: Modified mktemp command for tarball extraction on macOS VMs#3698
DrJosh9000 merged 6 commits intobuildkite:mainfrom
elastic:main

Conversation

@chrisnavar
Copy link
Contributor

@chrisnavar chrisnavar commented Feb 4, 2026

Description

On MacOS VMs, the default mktemp is the BSD/macOS version, which does not support the -p option. Even on MacOS, unless you have specifically installed GNU coreutils and are using gmktemp, mktemp -p will fail. This approach is safe and works in both systems, as long as $DESTINATION exists and is writable. mp.XXXXXX will create a unique temp directory inside $DESTINATION and avoid the error when the folder already exists.

Context

  • Although the following is not an official site, it does reflect the current options macOS provides regarding mktemp command.

Changes

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go tool gofumpt -extra -w .)

Disclosures / Credits

I consulted Copilot on potential approaches, then wrote the implementation myself.

esenmarti and others added 6 commits October 29, 2024 10:23
On MacStadium VMs, the default mktemp is the BSD/macOS version, which does not support the -p option. Even on MacStadium, unless you have specifically installed GNU coreutils and are using gmktemp, mktemp -p will fail. This approach is safe and works in both systems, as long as $DESTINATION exists and is writable. tmp.XXXXXX will create a unique temp directory inside $DESTINATION and avoid the error when the folder already exists.
@chrisnavar chrisnavar marked this pull request as ready for review February 4, 2026 09:52
Copy link
Contributor

@DrJosh9000 DrJosh9000 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@DrJosh9000 DrJosh9000 merged commit 0c2cdd5 into buildkite:main Feb 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants