-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix sysconf functions in FreeBSD #12995
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
Conversation
All FreeBSD do not implement the function sysconf with arguments _SC_GETGR_R_SIZE_MAX , _SC_GETPW_R_SIZE_MAX. php use this sysconf() in: - main/main.c php_get_current_user() - main/fopen_wrappers.c php_fopen_primary_script() - ext/posix/posix.c posix_getpwnam(), posix_getpwuid(), posix_getgrnam(), posix_getgrgid() - ext/standard/filestat.c php_get_uid_by_name(), php_get_gid_by_name()
All FreeBSD do not implement the function sysconf with arguments _SC_GETGR_R_SIZE_MAX , _SC_GETPW_R_SIZE_MAX. php use this sysconf() in: - main/main.c php_get_current_user() - main/fopen_wrappers.c php_fopen_primary_script() - ext/posix/posix.c posix_getpwnam(), posix_getpwuid(), posix_getgrnam(), posix_getgrgid() - ext/standard/filestat.c php_get_uid_by_name(), php_get_gid_by_name()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few questions - please note that they apply on some other parts as they are done in the same way (just commented on the first one)
@@ -476,6 +476,9 @@ PHP_FUNCTION(posix_ttyname) | |||
} | |||
#if defined(ZTS) && defined(HAVE_TTYNAME_R) && defined(_SC_TTY_NAME_MAX) | |||
buflen = sysconf(_SC_TTY_NAME_MAX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is _SC_TTY_NAME_MAX
also problematic on FreeBSD (you haven't listed it in description...)? If so, is that even defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it's defined.
https://cgit.freebsd.org/src/tree/lib/libc/gen/sysconf.c#n445
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the description.
@@ -783,6 +786,9 @@ PHP_FUNCTION(posix_getgrnam) | |||
|
|||
#if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX) | |||
buflen = sysconf(_SC_GETGR_R_SIZE_MAX); | |||
#if defined(__FreeBSD__) && defined(_SC_PAGESIZE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's not supported on all FreeBSD, why do you still try to use _SC_GETGR_R_SIZE_MAX
and then just fall back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's hardcoded as -1
.
https://cgit.freebsd.org/src/tree/lib/libc/gen/sysconf.c#n363
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what bukka meant is why bothering with _SC_GETGR_R_SIZE_MAX if it returns -1 anyway (means no hard limit on the getgrnam_r buffer in theory).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I looked a bit around, also dragonflybsd and linux/musl returns -1 too, so would checking -1 and no errno set do the trick ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give me some times to recheck. At least in one circumstances with FreeBSD 12 I can see that:
<?php var_dump(posix_getpwuid(0)); ?>
just returns bool(false)
where not on recent FreeBSD versions. I will need to recheck the codebase updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it looks like that when ZTS is enabled this issue occurs returns bool(false)
. And when ZTS is not enabled this issue does not occur. So setting no errno should resolve the problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I still don't understand why it needs to fail first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing this in lieu of #13187
All FreeBSD do not implement the function sysconf with arguments _SC_GETGR_R_SIZE_MAX , _SC_GETPW_R_SIZE_MAX. php use this sysconf() in: - main/main.c php_get_current_user() - main/fopen_wrappers.c php_fopen_primary_script() - ext/posix/posix.c posix_getpwnam(), posix_getpwuid(), posix_getgrnam(), posix_getgrgid() - ext/standard/filestat.c php_get_uid_by_name(), php_get_gid_by_name()
All FreeBSD do not implement the function sysconf with arguments _SC_GETGR_R_SIZE_MAX , _SC_GETPW_R_SIZE_MAX , _SC_TTY_NAME_MAX. php use this sysconf() in: - main/main.c php_get_current_user() - main/fopen_wrappers.c php_fopen_primary_script() - ext/posix/posix.c posix_getpwnam(), posix_getpwuid(), posix_getgrnam(), posix_getgrgid() - ext/standard/filestat.c php_get_uid_by_name(), php_get_gid_by_name()
…support. fix from @rainerjung
…_FETCHES Partial backport of phpGH-12793. Closes phpGH-12970.
* PHP-8.2: Fix phpGH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
* PHP-8.3: Fix phpGH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
Autotools emits warning if 3rd argument is empty. Call is wrapped in the AC_CACHE_CHECK with php_cv_* cache variable name according to the docs. Closes phpGH-12966
macOs CI update. since sonoma (14) had been released since few months, we could afford to upgrade to its previous release.
* PHP-8.2: Add cross-compiling 3rd argument to AC_RUN_IFELSE
* PHP-8.3: Add cross-compiling 3rd argument to AC_RUN_IFELSE
…tes" and empty attributes Closes phpGH-12993.
* PHP-8.2: Fix phpGH-12980: tidynode.props.attribute is missing "Boolean Attributes" and empty attributes
* PHP-8.3: Fix phpGH-12980: tidynode.props.attribute is missing "Boolean Attributes" and empty attributes
* PHP-8.3: Fix crash when toggleAttribute() is used without a document
I forgot to also update the document reference of attributes, so when there is no document reference anymore from a variable, but still an attribute, this can crash. Fix it by also updating the document references for attributes. Closes phpGH-13002.
There's two issues here: - freeing of predefined entity declaration crashes (unique to 8.3 & master) - using multiple entity references for a single entity declaration crashes (since forever) The fix for the last issue is fairly easy to do on 8.3, but may require a slightly different approach on 8.2. Therefore, for now this is 8.3-only. Closes phpGH-13004.
All FreeBSD do not implement the function sysconf with arguments _SC_GETGR_R_SIZE_MAX , _SC_TTY_NAME_MAX:_SC_GETPW_R_SIZE_MAX.
php use this sysconf() in: