Re: "find" problem

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

 



Dean S. Messing <deanm <at> sharplabs.com> writes:

> 
> On my F13 machine, 
> 
>       find / \! -fstype ext4 -prune -o -print
> 
> prints every file that is in an ext4 filesystem mounted on /, and prunes
> those in any other type of fs.
> 
> On my F15 the same command prints nothing.  Why might that be?
> 

I have a hunch regarding this problem.
It may be related to systemd and /etc/mtab.

Up to F14 (the system I have in front of me; /dev/sda2 is "/"):
$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda2              8062384   4070156   3910344  52% /
...
$ ls -l /etc/mtab
-rw-r--r-- 1 root root 242 Jan  7 11:20 /etc/mtab
$ cat /etc/mtab
/dev/sda2 / ext4 rw 0 0
...
$ mount
/dev/sda2 on / type ext4 (rw)
...
$ ls -al /proc/mounts 
lrwxrwxrwx 1 root root 11 Jan  7 19:00 /proc/mounts -> self/mounts
$ cat /proc/self/mounts
rootfs / rootfs rw 0 0
/dev/sda2 / ext4 rw,relatime,barrier=1,data=ordered 0 0
...

Since systemd implementation on F15 and onward /etc/mtab is symlinked to
/proc/self/mounts (the other system I have in front of me is F16; /dev/sda8 is
is "/"):

$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
rootfs          15116288 3590644  11372116  24% /
/dev/sda8       15116288 3590644  11372116  24% /
...
$ ls -al /etc/mtab
lrwxrwxrwx 1 root root 12 Dec  4 12:26 /etc/mtab -> /proc/mounts
$ cat /etc/mtab
rootfs / rootfs rw 0 0
/dev/sda8 / ext4 rw,relatime,user_xattr,barrier=1,data=ordered 0 0
...

NOTE: the difference between /proc/mounts above and mount outputs.
$ mount
/dev/sda8 on / type ext4 (rw,relatime,user_xattr,barrier=1,data=ordered)
...

$ ls -al /proc/mounts
lrwxrwxrwx 1 root root 11 Jan  7 19:19 /proc/mounts -> self/mounts

NOTE:
systemd requires that /etc/mtab be a symlink to /proc/self/mounts, or
the following warning will be printed:
/etc/mtab is not a symlink or not pointing to /proc/self/mounts. This is not
supported anymore. Please make sure to replace this file by a symlink to avoid
incorrect or misleading mount(8) output.
# ln -fs /proc/self/mounts /etc/mtab
Without doing this, features such as automounting through /etc/fstab will be
unavailable. 

One more hint (formally unrelated as your "find" does not use Olevel);
on F14 and F16 (no difference):
$ man find
-P            ...
-L            ...
-H            ...
...
              2      Any  -type  or -xtype tests are performed after any tests
                     based only on the names of files, but  before  any  tests
                     that  require information from the inode.  On many modern
                     versions of Unix, file types are  returned  by  readdir()
                     and so these predicates are faster to evaluate than pred‐
                     icates which need to stat the file first.  If you use the
                     -fstype  FOO  predicate  and specify a filsystem type FOO
                     which is not known (that is, present in  `/etc/mtab')  at
                     the  time  find  starts,  that predicate is equivalent to
                     -false.

Did the /etc/mtab being a symlink or that pecularity with optimization created
code execution conditions that make "find" behave differently ?

Some more ouput.

On F14:
# find / \! -fstype ext4 -print -prune
/var/lib/nfs/rpc_pipefs
/dev
/sys
/proc
# find / \! -fstype ext4 -prune -o -print
/
/.pulse
/.pulse/dd64759292eef8babdfc0cd400000013-runtime
/selinux
/selinux/booleans
/media
/media/.hal-mtab
/.autofsck
/usr
/usr/local
/usr/local/lib
...

On F16:
# find / \! -fstype ext4 -print -prune
/
# find / \! -fstype ext4 -prune -o -print
#

I am not able to put a finger on it yet; you may have more luck.
JB


-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux