FS no longer populated after "Micro-optimize preRun/postRun handling. NFC (#22671)"

25 views
Skip to first unread message

Stephan Bergmann

unread,
Oct 21, 2024, 5:01:09 AM10/21/24
to emscripte...@googlegroups.com
When building my app with a build of latest emsdk 3.1.69, I found that
the virtual file system would no longer be populated and only contained
the bare hardcoded minimum. Turned out that

> commit 483cdcd5306780520a2de8856fcd13910e71497e
> Author: Sam Clegg <s...@chromium.org>
> Date: Thu Oct 3 14:35:51 2024 -0700
>
> Micro-optimize preRun/postRun handling. NFC (#22671)
[...]
> diff --git a/src/preamble.js b/src/preamble.js
> index d37cb9fe7..3a6aee9c9 100644
> --- a/src/preamble.js
> +++ b/src/preamble.js
> @@ -195,11 +195,10 @@ function preRun() {
> assert(!ENVIRONMENT_IS_PTHREAD); // PThreads reuse the runtime from the main thread.
> #endif
> #if expectToReceiveOnModule('preRun')
> - if (Module['preRun']) {
> - if (typeof Module['preRun'] == 'function') Module['preRun'] = [Module['preRun']];
> - while (Module['preRun'].length) {
> - addOnPreRun(Module['preRun'].shift());
> - }
> + var preRuns = Module['preRun'];
> + if (preRuns) {
> + if (typeof preRuns == 'function') preRuns = [preRuns];
> + preRuns.forEach(addOnPreRun);
> }
> #endif
> callRuntimeCallbacks(__ATPRERUN__);
[...]

caused the function runWithFS to no longer be called, because it gets
added to Module.preRun from within the function runMetaWithFS that
itself is called from within the function preRun.

Sam Clegg

unread,
Oct 21, 2024, 1:21:16 PM10/21/24
to emscripte...@googlegroups.com
Ah!  Of course we were somehow depending on the specifics of the previous code.  Would you mind opening a bug for that?

cheers,
sam

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/feeb6609-50c3-4baf-8fd6-2a2294a5cb15%40gmail.com.

Stephan Bergmann

unread,
Oct 25, 2024, 3:42:48 AM10/25/24
to emscripte...@googlegroups.com
On 10/21/24 19:20, 'Sam Clegg' via emscripten-discuss wrote:
> Ah!  Of course we were somehow depending on the specifics of the
> previous code.  Would you mind opening a bug for that?

<https://github.com/emscripten-core/emscripten/issues/22790> "FS no
longer populated after 'Micro-optimize preRun/postRun handling. NFC
(#22671)'"
Reply all
Reply to author
Forward
0 new messages