Skip to content

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

Open
chrisnavar wants to merge 6 commits intobuildkite:mainfrom
elastic:main
Open

chore: Modified mktemp command for tarball extraction on macOS VMs#3698
chrisnavar wants to merge 6 commits intobuildkite:mainfrom
elastic:main

Conversation

@chrisnavar
Copy link

@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
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.

2 participants