Project

General

Profile

Actions

Feature #10046

open

mktemp should support templates not located at the end of templates

Added by Hubert Garavel over 2 years ago. Updated almost 2 years ago.

Status:
In Progress
Priority:
Normal
Category:
-
Start date:
2018-12-06
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

On Illumos, Solaris 10, macOS, the template argument given to mktemp(1) must
end with XXXXXX. The XXXXXX cannot be followed by, e.g., an extension, e.g. .txt:

$ mktemp tmp_XXXXXXX.txt
tmp_XXXXXXX.txt
$ mktemp tmp_XXXXXXX.txt
mktemp: failed to create file: tmp_XXXXXXX.txt

Linux and Oracle Solaris 11 are more permissive and allow characters
after the XXXXXXX, e.g.:

$ mktemp tmp_XXXXXXX.txt
tmp_RXaiIFo.txt
$ mktemp tmp_XXXXXXX.txt
tmp_viLser2.txt
Actions #1

Updated by Robert Lankford almost 2 years ago

  • Assignee set to Robert Lankford
Actions #2

Updated by Rich Lowe almost 2 years ago

The whole way we do the name generation is embarrassing and needs a lot of work.

Actions #3

Updated by Rich Lowe almost 2 years ago

I should have gone into more detail with that previous comment.
If you get into the actual generation of these names, rather than just their use in mktemp(1):

- libc_mktemps really should use a real RNG (pick out of the portable charset array with arc4random_uniform()?)
- libc_mktemps should support more than six Xs where the standard lets it

I'd misread at first that this was probably just about mktemp(1) not using mkstemps(3C). Sorry.

Actions #4

Updated by Robert Lankford almost 2 years ago

Thanks for the clarification Rich. I'm planning to submit changes to the mktemp(1) cmd for review but it doesn't address the additional issues you've mentioned. I can go ahead and create some bite size bugs for these.

Actions #5

Updated by Robert Lankford almost 2 years ago

  • Status changed from New to In Progress
Actions

Also available in: Atom PDF