[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: /proc/self/mountinfo versus chroot
From: |
Pádraig Brady |
Subject: |
Re: /proc/self/mountinfo versus chroot |
Date: |
Wed, 2 Mar 2016 19:21:35 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 02/03/16 18:18, Rick Troth wrote:
Hi ...
Thanks for your work supporting Gnu Coreutils, and _thanks especially for
signing the tarballs_. That's a major plus.
Recently, someone (might have been you) put a lot of work into the parsing of
/proc/self/mountinfo in 'df'.
But the result is not always ideal: When running under 'chroot' (with /proc
mounted) /etc/mtab gets bypassed.
(That's my test case. There might be others.)
I could offer a patch to provide some kind of switch, but not sure how you or
other Coreutils developers would want that handled.
For most of my builds, I would simply --disable-mountinfo or maybe
--enable-mtab or some such, a config time flag.
What do you recommend? (Coreutils is a big package and 'df' is just one
program.)
Not sure when the mountinfo logic was added. I only noticed the ignored
/etc/mtab effect in Coreutils 8.24.
CCing the mailing list.
Ironically the preference for /proc/self/mountinfo was chosen
to give more accurate info within chroots (and for bind mounts).
The kernel has all the info, which is why we prefer that
dynamically generated info.
What inaccuracies are you seeing exactly?
I do vaguely remember references to issues on some ubuntu kernels,
so perhaps there is a kernel fix to provide better info?
The change to use /proc/self/mountinfo was done in v8.24.
As a hack to avoid it, you could use an LD_PRELOAD wrapper to return
ENOENT for open("/proc/self/mountinfo"), along the lines of:
http://git.sv.gnu.org/cgit/coreutils.git/tree/tests/df/no-mtab-status.sh?id=v8.24
cheers,
Pádraig