Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use /proc/self/mounts instead of /etc/mtab
According to glibc documentation one should use `_PATH_MOUNTED`, which by default should point to `/etc/mtab`. This file is maintained by `mount` and `umount` programs. This is wrong if we are running in a sandboxed everinment, e.g. Linux containers (OpenVZ, Docker, Rocket, LXC/LXD) or chroot/proot. Then this files comes from alternative rootfs and does not reflect actual mount points. On modern systems (incl. CentOS 7 and Fedora) `/etc/mtab` points to `/proc/self/mounts`. The patch by default reads `/proc/self/mounts` on Linux systems. By default Docker will create a `/etc/mtab` as symlink to `/proc/mounts` (which points to `/proc/self/mounts`) on any container. OpenVZ documentation also request chaging `/etc/mtab` to a symlink. Same in Linux From Scratch guide. Also reminds that `/` could be mounted as read-only, thus `/etc/mtab` could be stale. Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch> Reported-by: Sébastien Brochet <sebastien.brochet@cern.ch>
- Loading branch information