diff --git a/Makefile.envs b/Makefile.envs index e9c16a425..8b9345f0a 100644 --- a/Makefile.envs +++ b/Makefile.envs @@ -1,5 +1,5 @@ export PYVERSION ?= 3.11.3 -export PYODIDE_EMSCRIPTEN_VERSION ?= 3.1.39 +export PYODIDE_EMSCRIPTEN_VERSION ?= 3.1.40 ifdef CPYTHON_DEBUG export CPYTHON_ABI_FLAGS=d diff --git a/docs/project/changelog.md b/docs/project/changelog.md index 3d35be731..dda904166 100644 --- a/docs/project/changelog.md +++ b/docs/project/changelog.md @@ -35,8 +35,8 @@ myst: - {{ Enhancement }} Make it possible to use the @example JSDoc directive. {pr}`4009` -- {{ Enhancement }} ABI Break: Updated Emscripten to version 3.1.39 - {pr}`3665`, {pr}`3659`, {pr}`3822`, {pr}`3889`, {pr}`3890` +- {{ Enhancement }} ABI Break: Updated Emscripten to version 3.1.40 + {pr}`3665`, {pr}`3659`, {pr}`3822`, {pr}`3889`, {pr}`3890`, {pr}`3888` - {{ Update }} The docker image now has node v20 instead of node v14. {pr}`3819` diff --git a/emsdk/patches/0001-Fix-fcntl-DUPFD.patch b/emsdk/patches/0001-Fix-fcntl-DUPFD.patch new file mode 100644 index 000000000..bf1b973d4 --- /dev/null +++ b/emsdk/patches/0001-Fix-fcntl-DUPFD.patch @@ -0,0 +1,79 @@ +From b3b02ec173471bfb541da23d396c9644a7187cef Mon Sep 17 00:00:00 2001 +From: Hood Chatham +Date: Mon, 7 Aug 2023 16:29:04 +0200 +Subject: [PATCH] Fix fcntl DUPFD + +Backport of Emscripten PR 19986: +https://github.com/emscripten-core/emscripten/pull/19986 + +PR #19391 introduced a regression in fcntl F_DUPFD. In particular, the manpage for +fcntl says it should: + +> Duplicate the file descriptor fd using the lowest-numbered available file descriptor +> greater than or equal to arg. + +But now it uses fd exactly arg, even if this fd already exists. This pretty badly +screws up file system state. +--- + src/library_syscall.js | 3 +++ + test/fcntl/test_fcntl.c | 12 ++++++++++-- + test/fcntl/test_fcntl.out | 8 +++++++- + 3 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/src/library_syscall.js b/src/library_syscall.js +index 3ccf03781..ab9b8ac20 100644 +--- a/src/library_syscall.js ++++ b/src/library_syscall.js +@@ -752,6 +752,9 @@ var SyscallsLibrary = { + if (arg < 0) { + return -{{{ cDefs.EINVAL }}}; + } ++ while (FS.streams[arg]) { ++ arg++; ++ } + var newStream; + newStream = FS.createStream(stream, arg); + return newStream.fd; +diff --git a/test/fcntl/test_fcntl.c b/test/fcntl/test_fcntl.c +index 0f531c284..3839f7ef9 100644 +--- a/test/fcntl/test_fcntl.c ++++ b/test/fcntl/test_fcntl.c +@@ -12,9 +12,17 @@ + + int main() { + int f = open("test", O_RDWR, 0777); +- assert(f > 0); ++ assert(f == 3); + +- printf("F_DUPFD: %d\n", fcntl(f, F_DUPFD, 100) >= 100); ++ printf("F_DUPFD 1: %d\n", fcntl(f, F_DUPFD, 0) == 4); ++ printf("errno: %d\n", errno); ++ printf("\n"); ++ ++ printf("F_DUPFD 2: %d\n", fcntl(f, F_DUPFD, 100) == 100); ++ printf("errno: %d\n", errno); ++ printf("\n"); ++ ++ printf("F_DUPFD_CLOEXEC: %d\n", fcntl(f, F_DUPFD_CLOEXEC, 0) == 5); + printf("errno: %d\n", errno); + printf("\n"); + errno = 0; +diff --git a/test/fcntl/test_fcntl.out b/test/fcntl/test_fcntl.out +index b0d458c24..6192b8558 100644 +--- a/test/fcntl/test_fcntl.out ++++ b/test/fcntl/test_fcntl.out +@@ -1,4 +1,10 @@ +-F_DUPFD: 1 ++F_DUPFD 1: 1 ++errno: 0 ++ ++F_DUPFD 2: 1 ++errno: 0 ++ ++F_DUPFD_CLOEXEC: 1 + errno: 0 + + F_DUPFD/error1: -1 +-- +2.25.1 +