[pass] Fix mktemp template to work with GNU Coreutils

Olof Johansson olof at ethup.se
Wed Feb 18 19:18:20 CET 2015

On 2015-02-18 15:50 -0200, Deny Dias wrote:
> Hi,
> GNU Coreutils (e.g. coreutils-8.23) imposes a limit of exactly six (6) X's to
> define a valid template. If this limit is not observed when passing arguments to
> mktemp, it throws an error:
>  mktemp: cannot create temp file /dev/shm/pass.XXXXXXXD2gHRw/XXXXX: \
>   Invalid argument

I can see no such limitation in coreutils 8.23. Are you sure you are
invoking the coreutils mktemp? And indeed, on Debian, doing the
following works just fine:

 $ mktemp /tmp/foo-XXXXXXXXXXXXXXX

> This is what 'man mktemp' says about the template size in such systems:
>  ...The template may be any filename with six (6) `Xs' appended to it, for
>  example /tmp/tfile.XXXXXX.  If no template is specified a default of tmp.XXXXXX
>  is  used  and  the  -t  flag  is implied (see below)...

  coreutils-8.23$ grep -Fr 'six (6)' *

gave me nothing... The help text in mktemp.c says the following:

| TEMPLATE must contain at least 3 consecutive 'X's in last component.
| If TEMPLATE is not specified, use tmp.XXXXXXXXXX, and --tmpdir is implied.

| Olof Johansson                              http://stdlib.se/ |
|  irc: zibri                           https://github.com/olof |

More information about the Password-Store mailing list