Util-Linux package development
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: James Youngman <jay@gnu.org>
Cc: Philipp Thomas <pth@suse.de>,
	bug-gnulib@gnu.org, util-linux <util-linux@vger.kernel.org>
Subject: Re: Using /proc/mounts in mountlist.c for linux
Date: Tue, 31 May 2011 10:31:17 +0100	[thread overview]
Message-ID: <4DE4B565.6040504@draigBrady.com> (raw)
In-Reply-To: <BANLkTin=pcsJ-b2y=GN3BpXsx8p+zgnJWA@mail.gmail.com>

On 31/05/11 01:14, James Youngman wrote:
> On Tue, Apr 5, 2011 at 1:36 PM, Philipp Thomas <pth@suse.de> wrote:
>> GNU find will not recognize file systems of type autofs on newer Linux
>> kernels as autofs entries are only listed in /proc/mounts and mountlist.c
>> includes glibc mntent.h which takes the _PATH_MOUNTED from paths.h and that
>> is /etc/mtab.
>>
>> After a longer discussion, we (SUSE) chose to patch mountlist.c in findutils
>> to use proc/mounts instead of /etc/mtab which fixed ou problem.
>>
>> Would gnulib accept the attached patch to mountlist.c?
> 
> I don't know if this patch was accepted, but it shouldn't be.   The
> problem is that /proc/mounts has incomplete data for /.   This will
> break gnulib's mountlist, at least with the current form of the patch,
> because mountlist will have an incorrect idea of the type of the root
> filesystem.   Here's an example showing the problem:
> 
> ~$ cat tryit.sh
> #! /bin/sh
> f() {
>     echo "$1"
>     ( ls -l /etc/mtab; find / -maxdepth 0 -printf '%p %F\n' ) |
>     sed -e 's_^_    _'
> }
> 
> set -e
> cd /etc
> f "regular /etc/mtab"
> 
> mv mtab mtab.old; ln -s ../proc/mounts mtab
> f "with /proc/mounts"
> rm mtab; mv mtab.old mtab
> ~$ sudo sh tryit.sh
> regular /etc/mtab
>     -rw-r--r-- 1 root root 1869 May 30 23:53 /etc/mtab
>     / ext3
> with /proc/mounts
>     lrwxrwxrwx 1 root root 14 May 31 01:12 /etc/mtab -> ../proc/mounts
>     / rootfs

Well I didn't merge it, but for more generic reasons.
It seemed like a bit of a layering violation to me,
and I was unsure that other users of gnulib may need
access to /etc/mtab specific stuff (on older systems).

Here is related output on my Fedora 15 system
which does link /etc/mtab -> /proc/mounts

$ df /
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdb2             13102208   3210896   9758244  25% /
$ df -t rootfs
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                13102208   3210896   9758244  25% /
$ find / -maxdepth 0 -printf "%p %F\n"
/ rootfs

cheers,
Pádraig.

       reply	other threads:[~2011-05-31  9:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20110405123650.GW22289@paradies.suse.de>
     [not found] ` <BANLkTin=pcsJ-b2y=GN3BpXsx8p+zgnJWA@mail.gmail.com>
2011-05-31  9:31   ` Pádraig Brady [this message]
2011-05-31  9:42     ` Using /proc/mounts in mountlist.c for linux James Youngman
2011-05-31 11:10     ` Karel Zak
2011-05-31 23:28       ` James Youngman
2011-06-01  7:56         ` Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DE4B565.6040504@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=bug-gnulib@gnu.org \
    --cc=jay@gnu.org \
    --cc=pth@suse.de \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox