Bug #75538 [Asn->Csd]: stream_set_blocking() always returning false for files on windows
| From: | requinix@php.net | Date: | Fri, 16 Nov 2018 17:06:57 +0000 |
| Subject: | Bug #75538 [Asn->Csd]: stream_set_blocking() always returning false for files on windows | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217992@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75538&edit=1
ID: 75538
Updated by: requinix@php.net
Reported by: samuel dot chemla at orange dot com
Summary: stream_set_blocking() always returning false for
files on windows
-Status: Assigned
+Status: Closed
Type: Bug
Package: Streams related
Operating System: Windows
PHP Version: 7.1.11
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
> My understanding is that stream_set_blocking does *not* work for regular files, whatever the OS
> is.
Linux and BSD may or may not support it, but all seem to support setting the flag.
http://man7.org/linux/man-pages/man2/open.2.html
> When possible, the file is opened in nonblocking mode.
> Note that this flag has no effect for regular files and block devices
https://linux.die.net/man/2/open
> When possible, the file is opened in nonblocking mode.
https://www.freebsd.org/cgi/man.cgi?sektion=2&query=open
> O_NONBLOCK do not block on open
But Windows' _open doesn't have a "_O_NONBLOCK" or other non-blocking flag.
https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx
In fact as far as I can tell, it doesn't have an fcntl (though winsock has something equivalent
for sockets?) or O_NONBLOCK flag anywhere. I think that's the problem: not that Windows
doesn't allow setting non-blocking on files but that it can't.
Previous Comments:
------------------------------------------------------------------------
[2018-11-16 13:54:36] samuel dot chemla at orange dot com
I'm reopening this because I think it requires clarification
------------------------------------------------------------------------
[2018-11-09 20:59:30] samel dot chemla at orange dot com
Hi!
I know this is an old topic, but I just saw the doc http://php.net/manual/en/function.stream-set-blocking.php
was updated with that note: "On Windows, this has no affect on local files. Non-blocking IO for
local files is not supported on Windows."
My understanding is that stream_set_blocking does *not* work for regular files, whatever the OS is.
Then if this is correct, then:
* the windows note should be removed from the documentation,
* this statement should be fixed: "This function works for any stream that supports
non-blocking mode (currently, regular files and socket streams)."
* stream_set_blocking() should return false, whatever the OS is. IE linux implementation should be
fixed because actually it returns true.
Can you clarify?
Regards.
------------------------------------------------------------------------
[2018-01-26 16:47:03] ab@php.net
Closing as per request. Thanks for documenting, Matt.
------------------------------------------------------------------------
[2018-01-23 02:53:11] mattficken@php.net
stream_set_blocking() for local files can't be supported on Windows.
I have updated the documentation notes to state that.
This bug can probably be closed now.
------------------------------------------------------------------------
[2017-11-22 10:04:39] samuel dot chemla at orange dot com
Hi,
Thanks for your answer.
I didn't realize the implication of this, and I understand it's not a priority.
I'm not C developper, but I would be happy to help on PHP side (testing?)...
Maybe we should at least update the doc to mention that non blocking file acces cannot (yet :-)) be
guaranteed.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=75538
--
Edit this bug report at https://bugs.php.net/bug.php?id=75538&edit=1