Skip to content

Commit a545108

Browse files
committed
Merge branch 'main' into chmod-not-update-mtim
2 parents 5e15b42 + 58889f9 commit a545108

File tree

82 files changed

+390
-330
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+390
-330
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ jobs:
799799
EMTEST_SKIP_NODE_CANARY: "1"
800800
EMTEST_SKIP_RUST: "1"
801801
EMTEST_SKIP_WASM64: "1"
802+
EMTEST_SKIP_NEW_CMAKE: "1"
802803
steps:
803804
- install-rust
804805
- run: apt-get install -q -y ninja-build scons ccache

ChangeLog.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ to browse the changes between the tags.
1818

1919
See docs/process.md for more on how version tagging works.
2020

21-
3.1.73 (in development)
21+
3.1.74 (in development)
2222
-----------------------
23+
24+
3.1.73 - 11/28/24
25+
-----------------
2326
- libunwind was updated to LLVM 19.1.4. (#22394)
2427
- mimalloc was updated to 2.1.7. (#21548)
2528
- The file system was updated to independently track atime, mtime and ctime

cmake/Modules/Platform/Emscripten.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,10 @@ set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1)
279279
set(CMAKE_C_RESPONSE_FILE_LINK_FLAG "@")
280280
set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")
281281

282+
# Enable $<LINK_LIBRARY:WHOLE_ARCHIVE,static_lib> for CMake 3.24+
283+
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE "-Wl,--whole-archive" "<LINK_ITEM>" "-Wl,--no-whole-archive")
284+
set(CMAKE_LINK_LIBRARY_USING_WHOLE_ARCHIVE_SUPPORTED True)
285+
282286
# Set a global EMSCRIPTEN variable that can be used in client CMakeLists.txt to
283287
# detect when building using Emscripten.
284288
set(EMSCRIPTEN 1 CACHE INTERNAL "If true, we are targeting Emscripten output.")

emscripten-version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.73-git
1+
3.1.74-git

src/library.js

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,25 +2182,19 @@ addToLibrary({
21822182
},
21832183

21842184
$asyncLoad__docs: '/** @param {boolean=} noRunDep */',
2185-
$asyncLoad: (url, onload, onerror, noRunDep) => {
2186-
var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : '';
2187-
readAsync(url).then(
2188-
(arrayBuffer) => {
2189-
#if ASSERTIONS
2190-
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
2191-
#endif
2192-
onload(new Uint8Array(arrayBuffer));
2193-
if (dep) removeRunDependency(dep);
2194-
},
2195-
(err) => {
2196-
if (onerror) {
2197-
onerror();
2198-
} else {
2199-
throw `Loading data file "${url}" failed.`;
2200-
}
2201-
}
2202-
);
2203-
if (dep) addRunDependency(dep);
2185+
$asyncLoad: (url, noRunDep) => {
2186+
return new Promise((resolve, reject) => {
2187+
var dep = !noRunDep ? getUniqueRunDependency(`al ${url}`) : '';
2188+
if (dep) addRunDependency(dep);
2189+
readAsync(url).then(
2190+
(arrayBuffer) => {
2191+
#if ASSERTIONS
2192+
assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
2193+
#endif
2194+
resolve(new Uint8Array(arrayBuffer));
2195+
if (dep) removeRunDependency(dep);
2196+
}, reject);
2197+
});
22042198
},
22052199

22062200
$alignMemory: (size, alignment) => {

src/library_async.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ addToLibrary({
470470
emscripten_wget_data__async: true,
471471
emscripten_wget_data: (url, pbuffer, pnum, perror) => {
472472
return Asyncify.handleSleep((wakeUp) => {
473-
asyncLoad(UTF8ToString(url), (byteArray) => {
473+
/* no need for run dependency, this is async but will not do any prepare etc. step */
474+
asyncLoad(UTF8ToString(url), /*noRunDep=*/true).then((byteArray) => {
474475
// can only allocate the buffer after the wakeUp, not during an asyncing
475476
var buffer = _malloc(byteArray.length); // must be freed by caller!
476477
HEAPU8.set(byteArray, buffer);
@@ -481,7 +482,7 @@ addToLibrary({
481482
}, () => {
482483
{{{ makeSetValue('perror', 0, '1', 'i32') }}};
483484
wakeUp();
484-
}, true /* no need for run dependency, this is async but will not do any prepare etc. step */ );
485+
});
485486
});
486487
},
487488

src/library_dylink.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ var LibraryDylink = {
10241024

10251025
var libFile = locateFile(libName);
10261026
if (flags.loadAsync) {
1027-
return new Promise((resolve, reject) => asyncLoad(libFile, resolve, reject));
1027+
return asyncLoad(libFile);
10281028
}
10291029

10301030
// load the binary synchronously

src/library_fs.js

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -175,60 +175,46 @@ FS.staticInit();
175175
path = PATH_FS.resolve(path);
176176

177177
if (!path) return { path: '', node: null };
178+
opts.follow_mount ??= true
178179

179-
var defaults = {
180-
follow_mount: true,
181-
recurse_count: 0
182-
};
183-
opts = Object.assign(defaults, opts)
184-
185-
if (opts.recurse_count > 8) { // max recursive lookup of 8
186-
throw new FS.ErrnoError({{{ cDefs.ELOOP }}});
187-
}
180+
// limit max consecutive symlinks to 40 (SYMLOOP_MAX).
181+
linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) {
182+
// split the absolute path
183+
var parts = path.split('/').filter((p) => !!p);
188184

189-
// split the absolute path
190-
var parts = path.split('/').filter((p) => !!p);
185+
// start at the root
186+
var current = FS.root;
187+
var current_path = '/';
191188

192-
// start at the root
193-
var current = FS.root;
194-
var current_path = '/';
195-
196-
for (var i = 0; i < parts.length; i++) {
197-
var islast = (i === parts.length-1);
198-
if (islast && opts.parent) {
199-
// stop resolving
200-
break;
201-
}
189+
for (var i = 0; i < parts.length; i++) {
190+
var islast = (i === parts.length-1);
191+
if (islast && opts.parent) {
192+
// stop resolving
193+
break;
194+
}
202195

203-
current = FS.lookupNode(current, parts[i]);
204-
current_path = PATH.join2(current_path, parts[i]);
196+
current = FS.lookupNode(current, parts[i]);
197+
current_path = PATH.join2(current_path, parts[i]);
205198

206-
// jump to the mount's root node if this is a mountpoint
207-
if (FS.isMountpoint(current)) {
208-
if (!islast || (islast && opts.follow_mount)) {
199+
// jump to the mount's root node if this is a mountpoint
200+
if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) {
209201
current = current.mounted.root;
210202
}
211-
}
212-
213-
// by default, lookupPath will not follow a symlink if it is the final path component.
214-
// setting opts.follow = true will override this behavior.
215-
if (!islast || opts.follow) {
216-
var count = 0;
217-
while (FS.isLink(current.mode)) {
218-
var link = FS.readlink(current_path);
219-
current_path = PATH_FS.resolve(PATH.dirname(current_path), link);
220203

221-
var lookup = FS.lookupPath(current_path, { recurse_count: opts.recurse_count + 1 });
222-
current = lookup.node;
223-
224-
if (count++ > 40) { // limit max consecutive symlinks to 40 (SYMLOOP_MAX).
225-
throw new FS.ErrnoError({{{ cDefs.ELOOP }}});
204+
// by default, lookupPath will not follow a symlink if it is the final path component.
205+
// setting opts.follow = true will override this behavior.
206+
if (FS.isLink(current.mode) && (!islast || opts.follow)) {
207+
if (!current.node_ops.readlink) {
208+
throw new FS.ErrnoError({{{ cDefs.ENOSYS }}});
226209
}
210+
var link = current.node_ops.readlink(current);
211+
path = PATH_FS.resolve(PATH.dirname(current_path), link, ...parts.slice(i + 1));
212+
continue linkloop;
227213
}
228214
}
215+
return { path: current_path, node: current };
229216
}
230-
231-
return { path: current_path, node: current };
217+
throw new FS.ErrnoError({{{ cDefs.ELOOP }}});
232218
},
233219
getPath(node) {
234220
var path;
@@ -373,6 +359,9 @@ FS.staticInit();
373359
return 0;
374360
},
375361
mayCreate(dir, name) {
362+
if (!FS.isDir(dir.mode)) {
363+
return {{{ cDefs.ENOTDIR }}};
364+
}
376365
try {
377366
var node = FS.lookupNode(dir, name);
378367
return {{{ cDefs.EEXIST }}};

src/library_fs_shared.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ addToLibrary({
7676
}
7777
addRunDependency(dep);
7878
if (typeof url == 'string') {
79-
asyncLoad(url, processData, onerror);
79+
asyncLoad(url).then(processData, onerror);
8080
} else {
8181
processData(url);
8282
}

src/library_pthread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ var LibraryPThread = {
10001000
},
10011001
10021002
$establishStackSpace__internal: true,
1003-
$establishStackSpace__deps: ['$stackRestore'],
1003+
$establishStackSpace__deps: ['$stackRestore', 'emscripten_stack_set_limits'],
10041004
$establishStackSpace: (pthread_ptr) => {
10051005
#if ALLOW_MEMORY_GROWTH
10061006
// If memory growth is enabled, the memory views may have gotten out of date,

0 commit comments

Comments
 (0)