[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #42318] find with xdev traverses other filesystem when mountpiont i
From: |
Daniele Palumbo |
Subject: |
[bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory |
Date: |
Fri, 17 Mar 2017 10:43:57 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0 |
Follow-up Comment #1, bug #42318 (project findutils):
Should be renamed to:
"find -mount (or -xdev) is listing permission for root directory of other
mounted filesystem."
https://www.gnu.org/software/findutils/manual/html_mono/find.html#Filesystems
---
[...]
Don't descend directories on other filesystems. These options are
synonyms.
[...]
---
root directory in a filesystem is a directory (everything is a file), even if
mounted not in system root.
So root directory reside always in the mounted filesystem, as permission.
To put it in other terms:
Taking in consideration ext4, when a filesystem is mounted, the permission on
the root directory for the mounted filesystem are taken from the root
directory of the mounted filesystem itself.
The same apply to all *nix filesystem that handle permissions, including NFS.
Suppose to have:
/mnt/testmount, a directory with no content and permission 755
mount then /dev/mapper/myvg-mounttest in this directory.
The root directory of this filesystem already has permission set to 777.
ls -l will show 777 now for the same directory.
This is fine.
If find with -mount is used to spot all 777 permissions, this will be listed.
Result should be instead:
1) no entries for that mountpoint at all (because of -mount this is
effectively not in our find)
2) the directory entry with permission of the original filesystem directory
(likely not possible)
Maybe worth the case to check also other OS implementation, like AIX and
Solaris.
Reproducer:
Prereq:
One disk (local or remote) mounted:
/dev/mapper/myvg-mounttest on /mnt/testmount type ext4
(rw,relatime,data=ordered)
/dev/mapper/myvg-mounttest 976M 2.6M 907M 1% /mnt/testmount
Content of the mounted filesystem:
testserver ~ # ls -laR /mnt/
/mnt/:
total 12
drwxr-xr-x. 3 root root 4096 Mar 15 14:08 .
dr-xr-xr-x. 20 root root 4096 Feb 17 12:30 ..
drwxrwxrwx 5 root root 4096 Mar 15 14:16 testmount
/mnt/testmount:
total 32
drwxrwxrwx 5 root root 4096 Mar 15 14:16 .
drwxr-xr-x. 3 root root 4096 Mar 15 14:08 ..
-rwxrwxrwx 1 root root 0 Mar 15 14:15 beta
drwxr-xr-x 2 root root 4096 Mar 15 14:16 charlie
drwx------ 2 root root 16384 Mar 15 14:14 lost+found
drwxrwxrwx 2 root root 4096 Mar 15 14:16 sigma
/mnt/testmount/charlie:
total 8
drwxr-xr-x 2 root root 4096 Mar 15 14:16 .
drwxrwxrwx 5 root root 4096 Mar 15 14:16 ..
/mnt/testmount/lost+found:
total 20
drwx------ 2 root root 16384 Mar 15 14:14 .
drwxrwxrwx 5 root root 4096 Mar 15 14:16 ..
/mnt/testmount/sigma:
total 8
drwxrwxrwx 2 root root 4096 Mar 15 14:16 .
drwxrwxrwx 5 root root 4096 Mar 15 14:16 ..
-rwxrwxrwx 1 root root 0 Mar 15 14:15 alpha
-rw-r--r-- 1 root root 0 Mar 15 14:16 charlie
testserver ~ #
Steps:
testserver ~ # cd /mnt/
testserver mnt # umount testmount/
testserver mnt # ls -la
total 12
drwxr-xr-x. 3 root root 4096 Mar 15 14:08 .
dr-xr-xr-x. 20 root root 4096 Feb 17 12:30 ..
drwxr-xr-x 2 root root 4096 Mar 15 14:08 testmount
testserver mnt # find /mnt -mount -perm -o+w -a ! -perm -1000
testserver mnt # mount /dev/myvg/mounttest testmount/
testserver mnt # ls -la
total 12
drwxr-xr-x. 3 root root 4096 Mar 15 14:08 .
dr-xr-xr-x. 20 root root 4096 Feb 17 12:30 ..
drwxrwxr-x 5 root root 4096 Mar 15 14:16 testmount
testserver mnt # find /mnt -mount -perm -o+w -a ! -perm -1000
testserver mnt # ls -la testmount/
total 32
drwxrwxr-x 5 root root 4096 Mar 15 14:16 .
drwxr-xr-x. 3 root root 4096 Mar 15 14:08 ..
-rwxrwxrwx 1 root root 0 Mar 15 14:15 beta
drwxr-xr-x 2 root root 4096 Mar 15 14:16 charlie
drwx------ 2 root root 16384 Mar 15 14:14 lost+found
drwxrwxrwx 2 root root 4096 Mar 15 14:16 sigma
testserver mnt # chmod 777 testmount/
testserver mnt # ls -la
total 12
drwxr-xr-x. 3 root root 4096 Mar 15 14:08 .
dr-xr-xr-x. 20 root root 4096 Feb 17 12:30 ..
drwxrwxrwx 5 root root 4096 Mar 15 14:16 testmount
testserver mnt # find /mnt -mount -perm -o+w -a ! -perm -1000
/mnt/testmount
testserver mnt # umount testmount/
testserver mnt # ls -la
total 12
drwxr-xr-x. 3 root root 4096 Mar 15 14:08 .
dr-xr-xr-x. 20 root root 4096 Feb 17 12:30 ..
drwxr-xr-x 2 root root 4096 Mar 15 14:08 testmount
testserver mnt # find /mnt -mount -perm -o+w -a ! -perm -1000
testserver mnt #
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?42318>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory,
Daniele Palumbo <=
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Bernhard Voelker, 2017/03/17
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Dale Worley, 2017/03/20
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Daniele Palumbo, 2017/03/21
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Dale Worley, 2017/03/22
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Daniele Palumbo, 2017/03/23
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Daniele Palumbo, 2017/03/23
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Dale Worley, 2017/03/24
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Daniele Palumbo, 2017/03/29
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, Dale Worley, 2017/03/29
- [bug #42318] find with xdev traverses other filesystem when mountpiont is subdirectory, James Youngman, 2017/03/30