[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #54913] find: "-type"-test wrong on bind-mounted char device
From: |
Bernhard Voelker |
Subject: |
[bug #54913] find: "-type"-test wrong on bind-mounted char device |
Date: |
Thu, 1 Nov 2018 15:01:07 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0 |
Follow-up Comment #4, bug #54913 (project findutils):
What a pity: that code - to use the D_TYPE returned from gnulib's FTS - has
been added to avoid an extra stat() when getdents() already returns it:
https://git.sv.gnu.org/cgit/findutils.git/commit/?id=acb82fe
[adding Jim as the patch author]
The fix would be to undo this:
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -579,8 +579,9 @@ find (char *arg)
state.already_issued_stat_error_msg = false;
state.have_stat = false;
- state.have_type = !!ent->fts_statp->st_mode;
- state.type = state.have_type ? ent->fts_statp->st_mode : 0;
+ state.have_type = false;
+ state.type = 0;
+
consider_visiting (p, ent);
}
/* fts_read returned NULL; distinguish between "finished" and "error".
*/
... but to the cost of performance again, because FTS usually returns
FTS_NSOK for all non-directory files (see "find -D search").
E.g. on NFS, that extra stat() would be quite slow ... and only needed
for that quite special and therefore seldom case of bind-mounts.
The only alternative I can currently think of is to check the mountlist
for the given ent->fts_path before not taking over the FTS information.
Any other idea to avoid the performance punishment?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54913>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/