| Summary: | bsd find finds only 32756 directories with '-type d' switch | ||
|---|---|---|---|
| Product: | Base System | Reporter: | emz |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | New --- | ||
| Severity: | Affects Only Me | CC: | emaste, sigsys |
| Priority: | --- | ||
| Version: | 11.2-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
emz
2018-11-12 13:41:15 UTC
This seems to be caused by an optimization in lib/libc/gen/fts.c that assumes that there can be no more subdirectories in a given directory than indicated by st_nlink (since each subdirectory increases the link count of the parent with its ".." entry). This doesn't work when st_nlink gets capped by ZFS. AFAIK, UFS does not allow more subdirectories than st_nlink can count so the problem does not happen there. Removing "zfs" from ufslike_filesystems[] in fts.c should avoid the bug. A better fix would be to check if st_nlink seems saturated (with pathconf(2)/_PC_LINK_MAX I guess) and disable the optimization only then. nlink_t is 64 bits on 12.X so the problem probably doesn't exist there. |