Skip to content

fix crypt_r detection under BSD system. #5971

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

Closed
wants to merge 1 commit into from

Conversation

devnexen
Copy link
Member

OpenBSD needs additional header too.

build/php.m4 Outdated
]],[[
struct crypt_data buffer;
crypt_r("passwd", "hash", &buffer);
]])],[php_cv_crypt_r_style=struct_crypt_data_bsd],[])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
]])],[php_cv_crypt_r_style=struct_crypt_data_bsd],[])
]])],[php_cv_crypt_r_style=struct_crypt_data],[])

I think. Though I think it would be better to just add an #if HAVE_UNISTD_H #include <unistd.> #endif to the main check above, instead of doing a separate one. It's not like including an extra header should hurt :)

Copy link
Member Author

Choose a reason for hiding this comment

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

there is no crypt.h header on FreeBSD

Copy link
Member

@nikic nikic Aug 12, 2020

Choose a reason for hiding this comment

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

I see, in that case I'd still suggest to merge the checks and put the crypt.h include behind #if HAVE_CRYPT_H as well.

As implemented now, I would expect actual usage to fail because neither CRYPT_R_STRUCT_CRYPT_DATA nor CRYPT_R_CRYPTD gets set. It doesn't matter right now because we never actually end up using system crypt_r right now, but would be a problem if we did.

Copy link
Member Author

@devnexen devnexen Aug 12, 2020

Choose a reason for hiding this comment

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

Yes right I knew for crypt_r not used it was just to pass config step :-) fiar point I ll take your suggestion

Copy link
Member

Choose a reason for hiding this comment

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

Your current variant also works though, maybe it's cleaner this way :)

Copy link
Member Author

Choose a reason for hiding this comment

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

The current version works better maybe in the longer run. What do you prefer ?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, let's stick with your current version.

OpenBSD needs additional header too.
@php-pulls php-pulls closed this in 6ca6e9f Aug 12, 2020
@nikic
Copy link
Member

nikic commented Aug 12, 2020

Do you know if there is any good way we can test FreeBSD in CI?

@devnexen
Copy link
Member Author

well there is this possibility : https://builds.sr.ht/

as we do for radare2 project here https://github.com/radareorg/radare2/blob/master/.builds/freebsd.yml

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