Skip to content

Conversation

@inaky-intc
Copy link

The call to mktemp with a relative template name creates the temp directory wherever the thing logs in to, $HOME.

If $HOME is read-only, then this fails.

With this change, the temp directory is made in whatever the system considers the temporary directory to be, acknowledging TMPDIR if set (per mktemp man page) and defaulting to /tmp.

The call to mktemp with a relative template name creates the temp
directory wherever the thing logs in to, $HOME.

If $HOME is read-only, then this fails.

With this change, the temp directory is made in whatever the system
considers the temporary directory to be, acknowledging TMPDIR if set
(per mktemp man page) and defaulting to /tmp.
@henryiii
Copy link
Collaborator

henryiii commented Oct 29, 2025

That's not what I see for -t:

$ man mktemp
...
     -t prefix
             Generate a template (using the supplied prefix and TMPDIR if set) to create a filename template.
...

It seems to want a prefix.

@inaky-intc
Copy link
Author

inaky-intc commented Oct 29, 2025

That's not what I see for -t:

$ man mktemp
...
     -t prefix
             Generate a template (using the supplied prefix and TMPDIR if set) to create a filename template.
...

ugh, great -- score one on one of those annoying flavour variations -- what system are you on? (kernel, Distro?); on Linux/Fedora, Ubuntu, arch, suse:

       -t     interpret TEMPLATE as a single file name component, relative  to
              a  directory:  $TMPDIR, if set; else the directory specified via
              -p; else /tmp [deprecated]

now the problem is I am seeing that deprecated thing in there and making me nervous. Per the other options, we prolly should use --tmpdir instead

  -p DIR, --tmpdir[=DIR]  interpret TEMPLATE relative to DIR; if DIR is not
                        specified, use $TMPDIR 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

however I am really interested in knowing the environment where @henryiii found a different -t option

@henryiii
Copy link
Collaborator

I'm on macOS, so a BSD flavor. I do see the -p option, and it seems consistent.

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