OpenCDK, temporary files and $TMPDIR

Ludovic Courtès ludo at
Tue Apr 8 23:19:19 CEST 2008


When building and testing GnuTLS on NixOS ( in a
chroot, `tests/openpgp/keyring.c' fails.  More precisely
`gnutls_openpgp_keyring_import ()' returns `GNUTLS_E_FILE_ERROR'.

The reason is that the chroot doesn't have a writable `/tmp', and
`cdk_stream_tmp_from_mem ()' (called from `cdk_keydb_new_from_mem ()')
tries to create a file with `tmpfile ()', which does not honor $TMPDIR
($TMPDIR is set to a writable temporary directory in the NixOS chroot).

Two remarks:

  1. Why the hell does it have to create a file when all it does is
     decode a keyring from memory?  :-)

  2. Too bad $TMPDIR is not honored.  This can surely be fixed using
     `getenv' and Gnulib's `tempname' module.


More information about the Gnutls-devel mailing list