Project

General

Profile

Feature #10046

mktemp should support templates not located at the end of templates

Added by Hubert Garavel 11 months ago. Updated 4 months ago.

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

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

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

History

#1

Updated by Robert Lankford 4 months ago

  • Assignee set to Robert Lankford
#2

Updated by Rich Lowe 4 months ago

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

#3

Updated by Rich Lowe 4 months 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.

#4

Updated by Robert Lankford 4 months 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.

#5

Updated by Robert Lankford 4 months ago

  • Status changed from New to In Progress

Also available in: Atom PDF