[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using /proc/mounts in mountlist.c for linux

From: James Youngman
Subject: Re: Using /proc/mounts in mountlist.c for linux
Date: Tue, 31 May 2011 01:14:05 +0100

On Tue, Apr 5, 2011 at 1:36 PM, Philipp Thomas <address@hidden> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]