Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fix for when readdir(directory) d_type value is always 0 #67

Closed
johnmehr opened this issue Apr 29, 2021 · 2 comments
Closed

Add fix for when readdir(directory) d_type value is always 0 #67

johnmehr opened this issue Apr 29, 2021 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@johnmehr
Copy link
Owner

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.

@johnmehr johnmehr added bug Something isn't working enhancement New feature or request labels Apr 29, 2021
@johnmehr johnmehr self-assigned this Apr 29, 2021
johnmehr added a commit that referenced this issue Apr 29, 2021
@ronaldklop
Copy link

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.

@johnmehr
Copy link
Owner Author

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!

@johnmehr johnmehr closed this as completed May 1, 2021
johnmehr added a commit that referenced this issue May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants