Eric Blake wrote: ... > But the mktempd script requires -p: > > d=`env -u TMPDIR mktemp -d -t -p "$destdir" "$template" 2>/dev/null` \ > > and FreeBSD mktemp lacks that: > > usage: mktemp [-d] [-q] [-t prefix] [-u] templat ... > mktemp [-d] [-q] [-u] -t prefix > > in other words, since the mktempd usage appears to be hard-coded to GNU > mktemp, it explains why the FreeBSD mktemp fails the test and we fall > back to dd. > > Since mktemp is not standardized, perhaps we should try multiple > invocation styles, if we can make BSD's mktemp give us the results we > want without having to fall back to dd.
I deliberately chose not to do that, to avoid complicating the implementation. What would be the motivation for finding a non-GNU mktemp with adequate semantics when we already have a work-around? Once you find one, verifying (efficiently) that it does its job safely and reliably may be quite hard. If there's a security problem, we should deal with it regardless. Performance? Probably not.