Path: blob/main/python/cpython/src/patches/05-st_mode.patch
1067 views
--- native/Modules/posixmodule.c 2022-08-05 07:45:18.000000000 -07001+++ wasm/Modules/posixmodule.c 2022-09-07 09:53:36.000000000 -07002@@ -2391,8 +2391,12 @@3PyObject *v = PyStructSequence_New((PyTypeObject *)StatResultType);4if (v == NULL)5return NULL;6-7- PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode));8+ // On WASM we modify st_mode to include u+rwx, since WASI provides nothing9+ // but "is it a directory or not" in st_mode, and this breaks a lot of things10+ // horribly, e.g., the entire zipfile module. For now the best solution is11+ // this patch. This will change -- see12+ // https://github.com/WebAssembly/wasi-filesystem/issues/3413+ PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode | 448));14static_assert(sizeof(unsigned long long) >= sizeof(st->st_ino),15"stat.st_ino is larger than unsigned long long");16PyStructSequence_SET_ITEM(v, 1, PyLong_FromUnsignedLongLong(st->st_ino));171819