-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Refactor glob.c
to be Windows specific
#15564
base: master
Are you sure you want to change the base?
Conversation
463c04c
to
5709e0b
Compare
Are you planning to do this for PHP 8.4? If so, I'll have a closer look as soon as possible (might still take a couple of days due to long backlog). Otherwise I'm not going to bother with this PR during the next weeks (there are still so many issue to solve for PHP 8.4). |
This is low priority and not intended for 8.4. I'm just in my janitor phase of going through different parts of the codebase. :) |
9d9aa7d
to
f96ce00
Compare
83cfb11
to
4c3ad1f
Compare
4c3ad1f
to
2ee1742
Compare
I don't recommend doing this. This isn't our code and it is quite behind upstream. We should pull in upstream changes and probably not refactor this to keep pulling upstream easy. |
Good point, but would be upstream? I don't think we ever pulled from whatever upstream repo there is, and the introducing commit doesn't mention where this had be taken from, either. And some quick Web search gives several results. |
This is glob from OpenBSD, and it was last synced around 2002. |
So upstream would be https://github.com/openbsd/src/blob/master/lib/libc/gen/glob.c and https://github.com/openbsd/src/blob/master/include/glob.h. Syncing might be some work then; still a reasonable thing to do (and maybe to provide patches against upstream), but we also need to document that in https://github.com/php/php-src/blob/master/CONTRIBUTING.md#php-source-code-directory-structure. |
I think that we need to sync even on stable versions to pull in some fixes. |
FWIW, I'm actually looking into issues with the system glob on AIX reported by users, and considering replacing it with i.e. NetBSD glob. It does miss some functionality like the brace matches, so it might be useful too wire it up to Unix. However, the way I was looking at doing it was putting said better glob in a library, provide its own name for functions, and having my own |
Having tried to clean up the |
Yeah, that's an old (adapted) version of OpenBSD's glob (should be updated, though). Using it instead of the system library's |
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.
Might be best to decide first where to go with our internal glob implementation, before doing any changes at all.
I am fine with having this become our standard |
Yeah, sure, but lets formally discuss this first (might need an RFC). |
I'd be willing to help with an RFC for the next release if needed. |
This would be appreciated! I brought it up in the last Foundation dev meeting, and we seem to be in agreement that this would be a good way forward. |
} | ||
|
||
/* Free allocated data belonging to a glob_t structure. */ | ||
PHPAPI void globfree(glob_t *pglob) | ||
PHP_WIN_GLOB void globfree(glob_t *pglob) | ||
{ | ||
register int i; |
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.
nit: I question register
usefulness wdyt ?
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.
Me too, but we should stick as close to upstream as possible. and need to update to latest (where this appears to be gone; also it's no longer an int
).
We're considering making this used as a glob implementation on POSIX as well, but first, we should rebase it from the latest version of OpenBSD. See conversation in phpGH-15564.
We're considering making this used as a glob implementation on POSIX as well, but first, we should rebase it from the latest version of OpenBSD. This also adds a new internal header (charclass.h) for glob. See conversation in phpGH-15564.
We're considering making this used as a glob implementation on POSIX as well, but first, we should rebase it from the latest version of OpenBSD. This also adds a new internal header (charclass.h) for glob. See conversation in phpGH-15564.
We're considering making this used as a glob implementation on POSIX as well, but first, we should rebase it from the latest version of OpenBSD. This also adds a new internal header (charclass.h) for glob. See conversation in phpGH-15564.
We're considering making this used as a glob implementation on POSIX as well, but first, we should rebase it from the latest version of OpenBSD. This also adds a new internal header (charclass.h) for glob. See conversation in phpGH-15564. Co-authored-by: Christoph M. Becker <[email protected]>
We're considering making this used as a glob implementation on POSIX as well, but first, we should rebase it from the latest version of OpenBSD. This also adds a new internal header (charclass.h) for glob. See conversation in GH-15564. Co-authored-by: Christoph M. Becker <[email protected]>
As far as I can tell, we never use glob.c to implement support for *NIX based OS that do not have
glob()
as such, let's make it truly Windows specific and remove some weird cross-section dependences on Zend andphp.h
.