container: Gracefully report mount errors in the child process.

Fixes <http://bugs.gnu.org/23306>.

* gnu/build/linux-container.scm (run-container): Use 'socketpair'
instead of 'pipe'.  Rename 'in' to 'child' and 'out' to 'parent'.  Send
a 'ready message or an exception argument list from the child to the
parent; adjust the parent accordingly.
* tests/containers.scm ("call-with-container, mnt namespace, wrong bind
mount"): New test.
* tests/guix-environment-container.sh: Add test with
--expose=/does-not-exist.
This commit is contained in:
Ludovic Courtès 2016-05-30 22:44:58 +02:00
parent 4c14d4eaa7
commit c06f6db7a4
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 52 additions and 12 deletions

View file

@ -44,6 +44,16 @@ else
test $? = 42
fi
# Make sure file-not-found errors in mounts are reported.
if guix environment --container --ad-hoc --bootstrap guile-bootstrap \
--expose=/does-not-exist -- guile -c 1 2> "$tmpdir/error"
then
false
else
grep "/does-not-exist" "$tmpdir/error"
grep "[Nn]o such file" "$tmpdir/error"
fi
# Make sure that the right directories are mapped.
mount_test_code="
(use-modules (ice-9 rdelim)