Skip to content

Conversation

richardlau
Copy link
Member

If the nop binary used in parallel/test-process-execve-no-args has been linked to external libraries, it may need an environment variable such as LD_LIBRARY_PATH to be set to be able to run.

Assume if node has been configured to link against any external libraries then nop has also been, and in that case pass through the environment variables to the test.

Refs: nodejs/build#4156 (comment)


This is a really subtle problem with parallel/test-process-execve-no-args that has not been caught until now because we've been running the sharedlibs_* CI on Ubuntu with gcc and suddenly came up when we tested switching over to clang.

With many of the sharedlibs_* builds we add libraries onto the command line, e.g. for OpenSSL

-L/opt/openssl-3.5.0/lib64 -lcrypto -lssl

The nop binary used by the test doesn't need any of that, so gcc on Ubuntu (and other Debian-derived Linux distributions) will not link the nop binary to those additional libraries1. However gcc on other Linux distributions, and clang do not do this by default so the nop binary will be linked to the additional libraries. parallel/test-process-execve-no-args currently doesn't pass on the environment variables, so if LD_LIBRARY_PATH (or equivalent for the platform) needed to be set to find those additional libraries the test would not be able to successfully run nop.

For completeness, it's possible to replicate the Ubuntu gcc default behaviour by passing --as-needed through to the linker (e.g. -Wl,--as-needed) but that's sensitive to the linker being used (e.g. the default linker on AIX/Illumos does not support that flag). In an ideal world we would not be appending the additional libraries onto the command line when linking nop, but that would be tricky to do with the way configure and gyp currently work.

FYI @nodejs/distros

If the `nop` binary used in `parallel/test-process-execve-no-args`
has been linked to external libraries, it may need an environment
variable such as `LD_LIBRARY_PATH` to be set to be able to run.

Assume if `node` has been configured to link against any external
libraries then `nop` has also been, and in that case pass through
the environment variables to the test.
@richardlau richardlau added the test Issues and PRs related to the tests. label Sep 26, 2025
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Sep 26, 2025
@richardlau
Copy link
Member Author

hmm actually this may be a bug in Node.js.
https://nodejs.org/docs/v22.20.0/api/process.html#processexecvefile-args-env describes the last env parameter as defaulting to process.env.

This comment was marked as outdated.

@richardlau
Copy link
Member Author

I'll open a new PR.

@richardlau richardlau closed this Sep 26, 2025
@richardlau richardlau deleted the execve-no-args branch September 26, 2025 18:29
@richardlau
Copy link
Member Author

Superseded by #60029

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants