"find" problem
Dean S. Messing
deanm at sharplabs.com
Sun Jan 8 03:03:46 UTC 2012
On 07 January 2012 at 20:02:21 +1100, Cameron Simpson wrote:
> On 06Jan2012 23:29, Dean S. Messing <deanm at sharplabs.com> wrote:
> | In doing more experimenting with find, I discovered that
> | / is evidently fstype "rootfs", whatever that is.
>
> Interesting.
>
> | Looking in /etc/mtab I see:
> | rootfs / rootfs rw 0 0
>
> I was going to suggest you run the "mount" command, but I see you're
> ahead of me.
Yeah, I ran "mount" first and it _does not_ show up there.
But it does in /etc/mtab, which in F15 is just a symlink to /proc/self/mounts.
> | and
> | /dev/mapper/vg00-lv_root / ext4
> | rw,relatime,user_xattr,acl,barrier=1,stripe=32,data=ordered 0 0
> |
> | In fact,
> | find / -fstype rootfs -print
> | prints all the files and ordinary directories under /.
>
> Which makes sense, given the above.
Yep.
> | None of the ext4 mounts are entered, nor are /proc or /sys, &c.
>
> As you'd hope!
Well, I hoped for much more, but I didn't get it. :-)
> | find / -fstype ext4 -print
> | only prints the entries in ext4 directories mounted in /.
>
> Well at least it is all nice and consistent.
Yes.
> | This behaviour thoroughly breaks some of my scripts.
>
> Fun fun fun. What assumptions are you making (aside from ext4 == regular
> filesystem)? Are you simply trying to avoid /proc and /dev etc? And NFS
> mounts I guess?
Approximately. Here is the key line from one of the scripts.
find / \( \! -fstype ext2 \! -fstype ext3 \! -fstype ext4 $w \) -prune \
-o <my processing>
$w is built earlier in the script as follows:
for pp in $PRUNEPATHS
do
w="$w -o -wholename $pp"
done
$PRUNEPATHS is a list of directories I also want to prune from the tree
before processing begins.
I suppose I can just add rootfs to the list of -fstype switches, but
I'm not sure what side effects this will have since "rootfs" is not
really a "file type". It also is no longer portable.
How much nicer it would be to return to how it "should" work!
Dean
More information about the users
mailing list