Subject: bug#20261: (mount-points) returns bogus values within the build environment

From: Mark H Weaver <[email-masked]>
Date: Sun, 05 Apr 2015 02:12:08 -0400

Within the guix-daemon build environment, tests/syscalls.scm
consistently fails on my i686 Libreboot X60 running linux-libre-3.19.3.
Outside of the build environment the test passes.

Here's the relevant except from syscalls.log:

--8<---------------cut here---------------start------------->8---
Test begin:
  test-name: "mount-points"
  source-file: "tests/syscalls.scm"
  source-line: 47
  source-form: (test-assert "mount-points" (member "/" (mount-points)))
Test end:
  result-kind: fail
  actual-value: #f
--8<---------------cut here---------------end--------------->8---

I built a simple derivation to print the result of (mount-points) within
the build environment:

--8<---------------cut here---------------start------------->8---
mhw@jojen:~/guix$ ./pre-inst-env guile
GNU Guile 2.0.11
Copyright (C) 1995-2014 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules (guix packages) (guix derivations) (guix store) (gnu packages commencement))
scheme@(guile-user)> (define store (open-connection))
scheme@(guile-user)> (build-expression->derivation
 store "test"
 '(begin (use-modules (guix build syscalls))
         (format #t "Mount points: ~S\n" (mount-points)))
 #:modules '((guix build syscalls))
 #:guile-for-build (package-derivation store guile-final "i686-linux" #:graft? #f)
 #:local-build? #t)

$1 = #<derivation /gnu/store/l7386hy58ffnj5pcvm621x6myml00bkj-test.drv => /gnu/store/8kya2xpgn89crq5cfrmj7952yhfhr4dv-test a2420f0>
scheme@(guile-user)> (build-derivations store (list $1))
building path(s) `/gnu/store/8kya2xpgn89crq5cfrmj7952yhfhr4dv-test'
Mount points: ("/dev/full" "/dev/kvm" "/dev/null" "/dev/random" "/dev/tty" "/dev/urandom" "/dev/zero" "/gnu/store/0ya00x8w06c1ph11lj5xwhiygy4b2lxd-gmp-6.0.0a" "/gnu/store/1d0s2rhqzrjqyb27n0b6w84knj8y51xq-libatomic-ops-7.4.2" "/gnu/store/269nlkyj5cqm7s4yfw3msc5sgj9is5qs-libunistring-0.9.5" "/gnu/store/3195f0cppgglxr91ir631f4bnvpqk9z0-bash-4.3.33" "/gnu/store/3xil4ahvng7iqvcbprp40glbvmjd843p-readline-6.3" "/gnu/store/5p57p4vznrf5j8wxpikwsdvxi4niv1dl-ncurses-5.9" "/gnu/store/7br8pxkz6jgkpjldr6hjzbxhzgsp1hx1-module-import-compiled" "/gnu/store/8lzvbsabc85pwfcszpav91flrl1lnc37-gcc-4.8.4-lib" "/gnu/store/bna6pmd8llg7g63is95rrkf8cfb8ly0q-ncurses-5.9" "/gnu/store/jzw8d98hrmjqgx9lfwmmnsgahqhcsbbr-pkg-config-0.28" "/gnu/store/lfh6q5ascp8b3545j9vr7ckbqi1al741-readline-6.3" "/gnu/store/mlmxnahghpvnj9wmhmqbi14fq408vjxx-module-import" "/gnu/store/nkv48yr5rhwdwgwv78gnap05nysq9wkn-libgc-7.4.2" "/gnu/store/vd8ij01bq08icp87bz5gs2v4bq53bls6-glibc-2.21" "/gnu/store/wd3wpzzl3z8bygkvjf4ka7486afbj0z3-libltdl-2.4.6" "/gnu/store/y2m6nf3w605k951fzmyanibzm3fd0caa-libffi-3.1" "/gnu/store/y5x64mcyzxjkjlq5la547lhd13b531mk-guile-2.0.11" "/tmp/nix-build-test.drv-0" "/proc" "/dev/shm" "/dev/pts")
builder for `/gnu/store/l7386hy58ffnj5pcvm621x6myml00bkj-test.drv' failed to produce output path `/gnu/store/8kya2xpgn89crq5cfrmj7952yhfhr4dv-test'
guix/store.scm:621:0: In procedure build-things:
guix/store.scm:621:0: Throw to key `srfi-34' with args `(#<condition &nix-protocol-error [message: "build of `/gnu/store/l7386hy58ffnj5pcvm621x6myml00bkj-test.drv' failed" status: 100] a971d50>)'.

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> ,q
scheme@(guile-user)> (use-modules (guix build syscalls))
scheme@(guile-user)> (mount-points)
$2 = ("/proc" "/sys" "/" "/dev" "/home/mhw/Videos" "/dev/pts" "/dev/shm" "/sys/kernel/debug")
scheme@(guile-user)> 
--8<---------------cut here---------------end--------------->8---

As you can see, "/" is listed as a mount point outside of the build
environment, but not inside.

      Mark