Closed johnmehr closed 3 years ago
See https://lists.freebsd.org/pipermail/freebsd-fs/2021-April/028964.html and replies.
The manual page dirent(5) says: "BUGS The usage of the member d_type of struct dirent is unportable as it is FreeBSD-specific. It also may fail on certain file systems, for example the cd9660 file system. "
I think gitup would be more standards compliant if it used stat(2) for determining the type of a file/dir. If d_type == DT_UNKNOWN (0) it could stat(2) the path and check st_mode. So the d_type is an optimized code path, but it fallbacks to an extra syscall on filesystems that need it.
Thank you for digging and finding the root of the problem. Nick sent me a patch to use stat(2) instead and I believe it's working properly now. Thanks!
The d_type value set by the readdir(directory) call in prune_tree() on FreeBSD 11-STABLE r369614 with a ZFS filesystem is always returning 0.