Emscripten 3.1.40 (#3888)

This commit is contained in:
Hood Chatham 2023-08-08 21:16:43 +02:00 committed by GitHub
parent d036485b28
commit f8f026a5de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 82 additions and 3 deletions

View File

@ -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

View File

@ -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`

View File

@ -0,0 +1,79 @@
From b3b02ec173471bfb541da23d396c9644a7187cef Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
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