Commit e0f69d79 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

kernel: Use an unguessable temporary directory for containers.

* guix/jupyter/kernel.scm (make-container-directory): Use 'mkdtemp!' to
create temporary as /tmp/guix-jupyter.XXXXXX.  This works around a bug
preventing multiple users from using Guix-Jupyter on the same machine at
the same time.
* jupyter/kernels.scm (exec-kernel): Likewise.
parent 11abd492
......@@ -89,8 +89,9 @@ imported."
The returned directory contains a 'root' and a 'home' sub-directory meant to
be used respectively as the root and home directory of the container."
(define parent
(string-append (or (getenv "TMPDIR") "/tmp")
(let ((template (string-append (or (getenv "TMPDIR") "/tmp")
(mkdtemp! template)))
(mkdir-p parent)
(let* ((template (string-append parent "/container.XXXXXX"))
......@@ -19,6 +19,7 @@
#:use-module (jupyter messages)
#:use-module (jupyter json)
#:use-module (guix build utils)
#:use-module ((guix build syscalls) #:select (mkdtemp!))
#:use-module (gcrypt mac)
#:use-module (gcrypt base64)
#:use-module (ice-9 rdelim)
......@@ -338,8 +339,15 @@ be in use (but this is racy)."
(define (exec-kernel specs connection)
"Execute the kernel specified by SPECS, a <kernel-specs> record, passing it
CONNECTION serialized to a \"connection file\"."
(define parent
(let ((template (string-append (or (getenv "TMPDIR") "/tmp")
(mkdir-p (dirname template))
(mkdtemp! template)))
(define connection-file
(string-append "/tmp/guix-kernel/conn/"
(string-append parent "/conn/"
(number->string (string-hash
(connection->json connection))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment