Stdlib: touch() mtime/atime match Zend on VM + AOT (#28995) - #29012
Merged
Conversation
VmFsTouchPure used VmStatPath::exists(), which wrote a positive VmStatCache hit before host utime — so the first filemtime/fileatime after a timed touch returned “now”. Probe via uncached VmStatNative::stat and clear only the host BG cache after a successful touch; keep VmStatCache positive hits until clearstatcache (#25853). Co-authored-by: Cursor <cursoragent@cursor.com>
NestedJIT FsDirJitHelper::touch cannot set times under thin AOT — host \touch() re-enters __compiler_touch and FFI is unavailable in the native binary. Route __compiler_touch through TouchLibcRuntime (libc utime) with TOUCH_TIME_OMIT=PHP_INT_MIN; keep VmFsTouchPure for VM plus a quarantined thin utime ABI fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VmFsTouchPureno longer probes existence viaVmStatPath::exists()(positiveVmStatCachemade the firstfilemtime/fileatimeafter a timed touch return “now”). UncachedVmStatNative::stat+ hostclearstatcache(true, $path)only (Regression: touch() invalidates VmStatCache — Zend keeps filemtime stale until clearstatcache (re-#25308, ext/standard/filestat.c) #25853).FsDirJitHelper::touchcannot set times under thin AOT (\touch()re-enters__compiler_touch; FFI unavailable).__compiler_touchnow usesTouchLibcRuntime(libcutime, omit=PHP_INT_MIN/ Stdlib: touch() negative mtime — filemtime -1 not current time (ext/standard/filestat.c) #11587).VmFsTouchLibcThinAbi(thinutimeFFI, not in Pure).php-src:
ext/standard/filestat.c—php_touch/VCWD_UTIME.Closes #28995
Test plan
php bin/vm.php→mtime_ok=y atime_ok=y(2-arg + 3-arg)PHP_COMPILER_HELPER_RUNTIME_O=0 ./phpc build … && ./binary→ samevendor/bin/phpunit --filter 'TouchBuiltinTest|FsDirRuntimeShrinkTest|VmFsTouchTempnamRuntimeShrinkTest'→ OK (1 skipped JIT without llvm group)php script/check-selfhost-spine-coverage-sync.php→ OK 7250/7250ci-fast.sh/ compliance suite set-diff vs masterMade with Cursor