[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master baac356: A better fix for process-tests on MS-Windows
From: |
Eli Zaretskii |
Subject: |
master baac356: A better fix for process-tests on MS-Windows |
Date: |
Tue, 29 Dec 2020 14:32:17 -0500 (EST) |
branch: master
commit baac3562a669ef4570cc258b5e6fc6472a6c9407
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
A better fix for process-tests on MS-Windows
* src/w32.c (pipe2): When forcibly closing pipe handles due to
overflow of FD_SETSIZE, set the handles to -1, to avoid assertion
violations in emacs_close.
* test/src/process-tests.el (process-tests/fd-setsize-no-crash):
No need to skip this test anymore.
---
src/w32.c | 5 +++++
test/src/process-tests.el | 5 +++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/w32.c b/src/w32.c
index 5ebae32..56c78a0 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -8667,6 +8667,11 @@ pipe2 (int * phandles, int pipe2_flags)
{
_close (phandles[0]);
_close (phandles[1]);
+ /* Since we close the handles, set them to -1, so as to
+ avoid an assertion violation if the caller then tries to
+ close the handle again (emacs_close will abort otherwise
+ if errno is EBADF). */
+ phandles[0] = phandles[1] = -1;
errno = EMFILE;
rc = -1;
}
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index 3272044..aeb5b75 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -389,11 +389,12 @@ See Bug#30460."
(ert-deftest process-tests/fd-setsize-no-crash ()
"Check that Emacs doesn't crash when trying to use more than
FD_SETSIZE file descriptors (Bug#24325)."
- (skip-unless (not (eq system-type 'windows-nt)))
(with-timeout (60)
(let ((sleep (executable-find "sleep"))
;; FD_SETSIZE is typically 1024 on Unix-like systems.
- (fd-setsize 1024)
+ ;; On MS-Windows we artificially limit FD_SETSIZE to 64,
+ ;; see the commentary in w32proc.c.
+ (fd-setsize (if (eq system-type 'windows-nt) 64 1024))
;; `make-process' allocates at least four file descriptors per process
;; when using the pipe communication method. However, it closes two of
;; them in the parent process, so we end up with only two new
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master baac356: A better fix for process-tests on MS-Windows,
Eli Zaretskii <=