Skip to content

Commit dc586b1

Browse files
committed
Mark buildFromIterator test as conflicting
Commit 0b2e6bc started caching the directory entry type to improve performance. Shortly after, we've seen flaky failures of the buildFromIterator phar test. When it fails, it's always a value error in the constructor of RecursiveDirectoryIterator::__construct() with a "no such file or directory" error. What's happening here is this: 1) A parallel test creates a subdirectory in the current working dir. 2) This test checks hasChildren() on a directory entry, the cached entry returns "yes" on the subdirectory. 3) The parallel test finishes and removes the subdirectory. 4) The constructor mentioned above is called, causing an exception because the directory is gone. This race has always been possible, even before said commit. It's just that it was very hard to hit before: the expensive stat call made the race window hard to hit. The race is now easier to hit because of the caching that is fast. Since there's many tests that modify the current working directory, it seems best to mark this as an "all" conflict. We cannot avoid every TOC-TOU race when working with files with these phar tests. In particular, mounteddir.phpt caused every conflict I saw on CI, but there's more tests that create subdirectories in the current working directory. Closes GH-11869.
1 parent f7be15d commit dc586b1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ext/phar/tests/phar_buildfromiterator10.phpt

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Phar::buildFromIterator() RegexIterator(RecursiveIteratorIterator), SplFileInfo as current
33
--EXTENSIONS--
44
phar
5+
--CONFLICTS--
6+
all
57
--INI--
68
phar.require_hash=0
79
phar.readonly=0

0 commit comments

Comments
 (0)