Skip to content

Conversation

@thg2k
Copy link
Contributor

@thg2k thg2k commented Jan 10, 2026

If the mtime of the stub file is more recent than arginfo's one, but the content is unchanged, the build script will launch gen_stub.php without any effect, and attempt to do so over and over.

By touching the arginfo file, we ensure that no more attempts are made unless the stub file is modified again.

If the mtime of the stub file is more recent than arginfo's one, but the
content is unchanged, the build script will launch gen_stub.php without any
effect, and attempt to do so over and over.

By touching the arginfo file, we ensure that no more attempts are made unless
the stub file is modified again.
@thg2k thg2k changed the base branch from master to PHP-8.4 January 10, 2026 07:44
@thg2k
Copy link
Contributor Author

thg2k commented Jan 10, 2026

What's the right target for this? I have more similar fixes to the build process coming up.

@iluuu1994 iluuu1994 requested a review from kocsismate January 10, 2026 12:01
@iluuu1994
Copy link
Member

What's the right target for this?

8.4 looks right.

if test ! -z "$(PHP)"; then \
echo Parse $< to generate $@;\
$(PHP) $(top_srcdir)/build/gen_stub.php $<; \
touch $@; \
Copy link
Member

Choose a reason for hiding this comment

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

Should the touch() rather be included in gen_stub.php to make it self-contained?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about it. My reasoning is that updating the timestamp is strictly makefile business, because that's how makefile works. If you think about the gen_stub.php script, when you invoke it manually, has no business updating the timestamp in case of a no-op, it doesn't care nor it shouldn't. Hence, I figured it belongs to the makefile.

Copy link
Member

Choose a reason for hiding this comment

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

I disagree. When I run gen_stub.php, I expect it to generate the resulting artifacts. The hash check is an optimization / implementation detail to me, except it's currently a leaky optimization, since it is observable. Moving the touch() into gen_stub.php would be the right thing.

Also: What would happen if gen_stub.php fails for some reason? Would the touch still be executed? Is the shell running with -e?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also: What would happen if gen_stub.php fails for some reason? Would the touch still be executed? Is the shell running with -e?

Good point, I assumed it does and the execution would stop in case of failure, but now that you point it out... I'll test it anyway and then update the PR with the touch inside the script.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants