Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Virtual cwd refactoring #15524

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

Draft
Girgias wants to merge 12 commits into php:master
base: master
Choose a base branch
Loading
from Girgias:virtual-cwd-refactoring
Draft

Conversation

Copy link
Member

@Girgias Girgias commented Aug 21, 2024
edited
Loading

Commits should be reviewed individually.

Motivation

There are two primary motivations:

  • Prevent computing strlen() when we already know it
  • Use more appropriate types instead of int to convey meaning and intent

To achieve this, refactoring is conducted one step at a time on the various layers that interact with each other:

  • the Virtual CWD mechanism
  • the stream layer
  • the Windows I/O layer

Some other/unrelated minor refactorings are likely going to happen in some commits when I encounter some oddities.

Comment on lines -428 to +419
oldnamew = php_win32_ioutil_any_to_w(oldnamea);
oldnamew = php_win32_ioutil_conv_any_to_w(old_name_a, old_name_a_len, PHP_WIN32_CP_IGNORE_LEN_P);
Copy link
Member Author

Choose a reason for hiding this comment

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

@cmb69 as don't have a Windows machine and can't test it, is such a function call change even sensible or not?
And if yes, can I also provide a size_t pointer for the 3rd argument so that PHP_WIN32_IOUTIL_CHECK_PATH_W() doesn't need to make a call to wstrlen()?

As seemingly this changes the behaviour of some tests in ways that I don't totally understand.

Copy link
Member

cmb69 commented Aug 24, 2024

I'm not sure whether doing this change in zend_virtual_cwd.c now is a good idea. According to "Make it work, make it right, make it fast", we shouldn't skip the second step. That code is really contrieved, and especially tsrm_realpath_r() is a 500 line long mess. Some "extract functions" refactorings seem to be in order, although that doesn't appear to be simple; both Anatol and I tried, but gave up, a couple of years ago; that doesn't mean that it's not worth to try a fresh attempt.

Copy link
Member Author

Girgias commented Sep 10, 2024

I'm not sure whether doing this change in zend_virtual_cwd.c now is a good idea. According to "Make it work, make it right, make it fast", we shouldn't skip the second step. That code is really contrieved, and especially tsrm_realpath_r() is a 500 line long mess. Some "extract functions" refactorings seem to be in order, although that doesn't appear to be simple; both Anatol and I tried, but gave up, a couple of years ago; that doesn't mean that it's not worth to try a fresh attempt.

I'll chip at this when I have motivation, as passing only a char* is far from ideal.

cmb69 reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@bukka bukka Awaiting requested review from bukka bukka will be requested when the pull request is marked ready for review bukka is a code owner

@nielsdos nielsdos Awaiting requested review from nielsdos nielsdos will be requested when the pull request is marked ready for review nielsdos is a code owner

@dstogov dstogov Awaiting requested review from dstogov dstogov will be requested when the pull request is marked ready for review dstogov is a code owner

@devnexen devnexen Awaiting requested review from devnexen devnexen will be requested when the pull request is marked ready for review devnexen is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /