mktemp (from coreutils) using relative directory instead of temp directory
jhult opened this issue · 2 comments
jhult commented
I'm using mktemp
(0.0.15) from https://github.com/uutils/coreutils
Using mktemp -t mcfly.XXXXXXXX
creates the file in the local directory instead of the temp directory.
If I use mktemp -p mcfly.XXXXXXXX
it properly places the files in $TMPDIR
.
This is likely an edge case. I'm not sure if you want to try to fix and if so, how to.
cantino commented
Huh, my version says:
-t prefix
Generate a template (using the supplied prefix and TMPDIR if set) to create a filename
template.
Maybe something like this would be better?
MCFLY_HISTORY=$(mktemp ${TMPDIR:/tmp}/mcfly.XXXXXX)
jhult commented
That solutions seems good to me. Based on your recommendation, I submitted this PR: #291
FYI, here is the help from mktemp
(0.0.15) from uutils/coreutils
❯ mktemp --help
mktemp 0.0.15
create a temporary file or directory.
USAGE:
mktemp [OPTION]... [TEMPLATE]
ARGS:
<template>...
OPTIONS:
-d, --directory Make a directory instead of a file
-h, --help Print help information
-p, --tmpdir <DIR> interpret TEMPLATE relative to DIR; if DIR is not specified, use $TMPDIR ($TMP on windows) if set, else /tmp.
With this option, TEMPLATE must not be an absolute name; unlike with -t, TEMPLATE may contain slashes, but
mktemp creates only the final component
-q, --quiet Fail silently if an error occurs.
--suffix <SUFFIX> append SUFFIX to TEMPLATE; SUFFIX must not contain a path separator. This option is implied if TEMPLATE does
not end with X.
-t Generate a template (using the supplied prefix and TMPDIR (TMP on windows) if set) to create a filename
template [deprecated]
-u, --dry-run do not create anything; merely print a name (unsafe)
-V, --version Print version information