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

On FreeBSD check for EMLINK when expecting ELOOP and on NetBSD check for EFTYPE #76

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

ChrisDenton
Copy link
Contributor

@ChrisDenton ChrisDenton commented Sep 20, 2024

See: https://man.freebsd.org/cgi/man.cgi?query=open&sektion=2&n=1#end

Essentially FreeBSD had NO_FOLLOW before it was standardised and chose to use EMLINK whereas the standard uses ELOOP. Without this PR it's not possible to delete directories containing symlinks on FreeBSD. See rust-lang/rustup#4022 (comment)

Update: And NetBSD uses EFTYPE https://man.netbsd.org/open.2#ERRORS

I decided to test both error codes in case newer versions of FreeBSD or NetBSD follow the POSIX specified errno.

@ChrisDenton ChrisDenton changed the title On FreeBSD check for EMLINK when expecting ELOOP On FreeBSD check for EMLINK when expecting ELOOP and on NetBSD check for EFTYPE Sep 20, 2024
@ChrisDenton
Copy link
Contributor Author

I decided to test both error codes in case newer versions of FreeBSD or NetBSD follow the POSIX specified errno.

Hmm... I'm having second thoughts about that. Considering it's security sensitive, maybe we should just check the documented errno?

@ChrisDenton
Copy link
Contributor Author

Oh right. I'll need #[cfg] here because the errnos don't exist on all platforms.

Copy link
Collaborator

@rbtcollins rbtcollins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you. To cut a release, a PR bumping the version in Cargo.toml is needed.

@rbtcollins rbtcollins merged commit d555788 into XAMPPRocky:master Sep 23, 2024
18 checks passed
@ChrisDenton ChrisDenton deleted the emlink branch September 23, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants