-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Windows flock support #20
Comments
Made a PR to make flock pass-thru. The test ofc passes now on Windows too since flock is just a pass-thru. |
Forgot to mention, infection works perfectly now with that change. |
Hello, thanks for working on this and debugging. Related to dg/bypass-finals@101d0cc seems like solution on |
That indeed fixes the default |
The Interceptor has to catch the LOCK_EX and just pass it through since it doesn't support it. Gotta watch out for edge cases such as $operation &= (~LOCK_EX);
return $operation
? flock($this->handle, $operation)
: true; To support the 0 case, the LOCK_EX not supported case, and NB cases. |
Hello,
Background
You can skip this section
After #16 I've been having issues with infection(root project) on one of my projects on windows. Its setup is pretty specific, but basically, every mutant was killed no matter what. After some investigation, it turns out that running the created PHPUnit config files directly with PHPUnit results in the following:
fwrite(): Write of 4 bytes failed with errno=13 Permission denied
I went high and low trying to fix this to no avail; therefore, since then, I've been using Linux for this project of mine. I don't have this issue with some other projects on windows but for the life of me, I can't replicate the exact problem that causes this.
TLDR
test_it_works_with_locks()
does not pass on windows. As it seems, aLOCK_SH
is a reader_lock, and would prevent any writing from being done on the file at least on Windows. It probably doesn't throw an error on Linux since on Linux,flock()
is advisory, but on windows, it's mandatory.Could be due to this?
Versions
master
branch ofinclude-interceptor
Simpler proof (without wrapper)
The following fails on windows:
This doesn't fail though:
Hence my idea of LOCK_SH working only for reads, and failing on something like
file_put_content()
.Possible fix
Could we just make
flock
pass-thru with areturn true;
? I can't see why would the LOCK_SH would be useful.The text was updated successfully, but these errors were encountered: