[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #60207] -prune returns false for files for which fstatat() fails wi
From: |
Stephane Chazelas |
Subject: |
[bug #60207] -prune returns false for files for which fstatat() fails with EACCESS |
Date: |
Wed, 10 Mar 2021 07:17:49 -0500 (EST) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0 |
URL:
<https://savannah.gnu.org/bugs/?60207>
Summary: -prune returns false for files for which fstatat()
fails with EACCESS
Project: findutils
Submitted by: stephanechazelas
Submitted on: Wed 10 Mar 2021 12:17:47 PM UTC
Category: find
Severity: 3 - Normal
Item Group: Wrong result
Status: None
Privacy: Public
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Release: 4.7.0
Discussion Lock: Any
Fixed Release: None
_______________________________________________________
Details:
(initially from
https://unix.stackexchange.com/questions/638372/why-does-find-still-try-to-access-gvfs-and-even-includes-it-in-the-output-de
by DJCrashdummy user there).
Reproduced with GNU find 4.8.0 and current git head (v4.8.0-5-gcaa03867) built
with default options on Debian GNU/Linux testing amd64.
Reproducer:
$ mkdir testdir; cd testdir
$ touch a1 a2 b1 b2
$ sudo bindfs --no-allow-other . a1
$ ls -l
ls: cannot access 'a1': Permission denied
total 0
-????????? ? ? ? ? ? a1
-rw-r--r-- 1 stephane stephane 0 Mar 10 11:53 a2
-rw-r--r-- 1 stephane stephane 0 Mar 10 11:53 b1
-rw-r--r-- 1 stephane stephane 0 Mar 10 11:53 b2
$ find . -name 'a*' -prune -o -print
.
./b1
find: ‘./a1’: Permission denied
./a1
./b2
See how "./a1" was output even though it matches "a*".
Here using bindfs as a different user as a way to have a file (a1) that is not
lstat()able. The OP had the problem initially with a .gvfs directory (also a
fuse FS mount point).
It can also be reproduced with -L/-follow and symlinks to inaccessible areas:
$ mkdir testdir; cd testdir
$ touch a2 b1 b2
$ ln -s /var/spool/cron/crontabs/foo a1
$ ln -s /no/such/file a3
$ ln -s a4 a4
$ ln -s a2/foo a5
$ find -L . -name 'a*' -prune -o -print
.
./b1
find: ‘./a1’: Permission denied
./a1
./b2
find: ‘./a5’: Not a directory
find: ‘./a4’: Too many levels of symbolic links
See how a1 was reported (for which stat() fails with EACCESS), but not a3
(ENOENT), a4 (ELOOP), a5 (ENOTDIR).
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?60207>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #60207] -prune returns false for files for which fstatat() fails with EACCESS,
Stephane Chazelas <=