lix/src
Shea Levy cc63db1dd5 makeStoreWritable: Ask forgiveness, not permission
It is surprisingly impossible to check if a mountpoint is a bind mount
on Linux, and in my previous commit I forgot to check if /nix/store was
even a mountpoint at all. statvfs.f_flag is not populated with MS_BIND
(and even if it were, my check was wrong in the previous commit).

Luckily, the semantics of mount with MS_REMOUNT | MS_BIND make both
checks unnecessary: if /nix/store is not a mountpoint, then mount will
fail with EINVAL, and if /nix/store is not a bind-mount, then it will
not be made writable. Thus, if /nix/store is not a mountpoint, we fail
immediately (since we don't know how to make it writable), and if
/nix/store IS a mountpoint but not a bind-mount, we fail at first write
(see below for why we can't check and fail immediately).

Note that, due to what is IMO buggy behavior in Linux, calling mount
with MS_REMOUNT | MS_BIND on a non-bind readonly mount makes the
mountpoint appear writable in two places: In the sixth (but not the
10th!) column of mountinfo, and in the f_flags member of struct statfs.
All other syscalls behave as if the mount point were still readonly (at
least for Linux 3.9-rc1, but I don't think this has changed recently or
is expected to soon). My preferred semantics would be for MS_REMOUNT |
MS_BIND to fail on a non-bind mount, as it doesn't make sense to remount
a non bind-mount as a bind mount.
2013-03-25 19:00:16 +01:00
..
boost * Install some headers in the right location. 2009-03-05 14:57:50 +00:00
bsdiff-4.3 Drop the externals directory 2012-03-18 23:54:57 +01:00
libexpr Fix building against Bison 2.6 2013-03-14 18:31:08 +01:00
libmain Revert "Prevent config.h from being clobbered" 2013-03-08 01:24:59 +01:00
libstore makeStoreWritable: Ask forgiveness, not permission 2013-03-25 19:00:16 +01:00
libutil Remove tabs 2013-01-03 13:00:46 +01:00
nix-daemon Revert "Prevent config.h from being clobbered" 2013-03-08 01:24:59 +01:00
nix-env Allow setting the profile location using $NIX_PROFILE 2012-12-12 16:01:46 +01:00
nix-hash When ‘--help’ is given, just run ‘man’ to show the manual page 2012-10-03 16:40:09 -04:00
nix-instantiate nix-instantiate: Fix read-only evaluation 2012-11-26 17:41:10 +01:00
nix-log2xml * Emit warning='1' or error='1' attributes for lines marked as 2010-03-05 12:54:58 +00:00
nix-setuid-helper Templatise tokenizeString() 2012-09-19 15:43:23 -04:00
nix-store Revert "Prevent config.h from being clobbered" 2013-03-08 01:24:59 +01:00
Makefile.am Rename nix-worker to nix-daemon 2012-10-03 17:59:23 -04:00