Skip to content

Commit 5639320

Browse files
authored
Fix default setting of EXECUTABLE overriding the value set in phase_linker_setup() for autoconfiguring. (#26822)
Fix default setting of EXECUTABLE overriding the value set in phase_linker_setup() for autoconfiguring. This line has no effect: https://github.com/emscripten-core/emscripten/blob/2a8234f6651fcc2fdfaf1a97e749720ea76d55a7/tools/link.py#L829-L830 since it was being overridden by `default_setting('EXECUTABLE', 1)`, which looks only in `user_settings`, and not if the setting has already been initialized. The result is that all autoconfigures would get the default shebang https://github.com/emscripten-core/emscripten/blob/2a8234f6651fcc2fdfaf1a97e749720ea76d55a7/tools/link.py#L460-L462 and attempt to run Node from PATH. On my CI, I don't have a Node in PATH (exactly for the purposes of guarding against accidental 'wrong node' accesses like this). Fixes `test_bullet_autoconf` without Node in PATH: http://clbri.com:8010/api/v2/logs/406907/raw_inline
1 parent 0d980eb commit 5639320

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/link.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,10 @@ def phase_linker_setup(options, linker_args): # noqa: C901, PLR0912, PLR0915
933933
# When there is no final suffix or the suffix is `.out` (as in `a.out`) then default to
934934
# making the resulting file exectuable.
935935
if settings.ENVIRONMENT_MAY_BE_NODE and options.oformat == OFormat.JS and final_suffix in {'', '.out'}:
936-
default_setting('EXECUTABLE', 1)
936+
# autoconf handling above may have initialized the EXECUTABLE setting already, so only init default here
937+
# if not yet set.
938+
if not settings.EXECUTABLE:
939+
default_setting('EXECUTABLE', 1)
937940

938941
if settings.EXECUTABLE and not settings.ENVIRONMENT_MAY_BE_NODE:
939942
exit_with_error('EXECUTABLE requires `node` in ENVRIONMENT')

0 commit comments

Comments
 (0)