Opened 4 years ago
Last modified 4 years ago
#60634 assigned defect
skaffold: usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | breun (Nils Breunese) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.6.2 |
Keywords: | yosemite | Cc: | |
Port: | skaffold |
Description
skaffold fails to build on Yosemite and probably earlier:
usage: mktemp [-d] [-q] [-t prefix] [-u] template ... mktemp [-d] [-q] [-u] -t prefix make: *** [cmd/skaffold/app/cmd/statik/statik.go] Error 1
Change History (12)
comment:1 Changed 4 years ago by breun (Nils Breunese)
comment:2 Changed 4 years ago by kencu (Ken)
on 10.6.8:
$ /usr/bin/mktemp -d usage: mktemp [-d] [-q] [-t prefix] [-u] template ... mktemp [-d] [-q] [-u] -t prefix $ /opt/local/libexec/gnubin/mktemp -d /var/folders/I0/I0fOotq3ErGZHYxrmmWiqU+++TI/-Tmp-/tmp.7LRt9Brr61
so gnubin
fulfills the needs.
comment:3 Changed 4 years ago by breun (Nils Breunese)
Does anyone know until which macOS version coreutils
is necessary to make mktemp -d
work?
comment:4 Changed 4 years ago by kencu (Ken)
It would appear 10.10 and less <https://ports.macports.org/port/skaffold/summary>
comment:5 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
It should hardly be difficult to rewrite the mktemp usage so that it is compatible with all operating systems (to wit: the template parameter is not optional). After all, macOS got by with that version of mktemp for a long time.
comment:6 Changed 4 years ago by kencu (Ken)
Yes, if you don't want to simply use coreutils, you can rewrite the code. There are always 10 ways to accomplish most anything.
comment:7 Changed 4 years ago by breun (Nils Breunese)
I've created a pull request upstream to explicitly add -t tmp
to all calls in Skaffold scripts, which should fix this issue: https://github.com/GoogleContainerTools/skaffold/pull/4319
comment:8 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
The most portable solution is to use the template parameter, e.g.
mktemp -d ${TMPDIR:-/tmp}/skaffold.XXXXXX
You can check on your Mac whether that works with both macOS mktemp and the coreutils port's gmktemp which is what mktemp is on Linux. (It does for me.)
comment:9 Changed 4 years ago by breun (Nils Breunese)
Skaffold builds on Ubuntu 16.04 via Travis and there mktemp
has even different behavior: it expects the prefix
to contain X
s, whereas mktemp
on Mac doesn't. I'd say the Mac's behavior makes more sense, because there it is actually a prefix, while on Ubuntu it is used as a template really.
Would the best solution then be for the Skaffold port to (only on Yosemite and older?) depend on coreutils
and patching the scripts to replace all calls to mktemp
with /opt/local/libexec/gnubin/mktemp
?
comment:10 Changed 4 years ago by ryandesign (Ryan Carsten Schmidt)
No the best solution is to rewrite the mktemp usage so that it works everywhere, as in comment:8.
comment:11 Changed 4 years ago by breun (Nils Breunese)
I've updated my upstream pull request with that solution, but it's used in like 15 places in Skaffold scripts.
comment:12 Changed 4 years ago by breun (Nils Breunese)
The pull request has been merged upstream, so hopefully this will be fixed in the next upstream release.
hack/generate-statik.sh
callsmktemp -d
: https://github.com/GoogleContainerTools/skaffold/blob/v1.10.1/hack/generate-statik.sh#L25On Catalina that command creates a temporary directory and returns the name:
I don't have access to a Yosemite system, but apparently that is not a valid command on Yosemite? Any idea what a valid alternative command would be?