mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
container: Allow 'container-excursion' to the same namespaces.
Before that, 'container-excursion' would call 'setns' even when the
target namespace is the one the caller is already in, which would fail.
* gnu/build/linux-container.scm (container-excursion): Introduce
'source' and 'target'. Compare the result of 'readlink' on these
instead of comparing file descriptors to decide whether to call
'setns'.
* tests/containers.scm ("container-excursion, same namespace"): New test.
This commit is contained in:
@@ -162,4 +162,13 @@
|
||||
(waitpid pid)
|
||||
(zero? result)))))))
|
||||
|
||||
(skip-if-unsupported)
|
||||
(test-equal "container-excursion, same namespaces"
|
||||
42
|
||||
;; The parent and child are in the same namespaces. 'container-excursion'
|
||||
;; should notice that and avoid calling 'setns' since that would fail.
|
||||
(container-excursion (getpid)
|
||||
(lambda ()
|
||||
(primitive-exit 42))))
|
||||
|
||||
(test-end)
|
||||
|
||||
Reference in New Issue
Block a user