On IBMi PASE, there is no root user or nobody user.
User may grant root-like privileges, including setting uid/gid
to 0.
PR-URL: https://github.com/libuv/libuv/pull/2676
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
It looks like I managed to introduce a typo between two incarnations
of the pull request, causing the test to fail on macOS when using the
autotools dynamic library build.
I even managed to spell it correctly in the skip message, just not in
the actual environment variable lookup... I hang my head in shame at
such a silly mistake.
Fixes: https://github.com/libuv/libuv/issues/2421
PR-URL: https://github.com/libuv/libuv/pull/2422
Refs: https://github.com/libuv/libuv/pull/2408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Commit ba780231 ("unix,win: handle zero-sized allocations uniformly")
makes `uv__malloc()` return NULL when `size == 0`.
That's exactly the size that is passed to it when uv_spawn() tries to
spawn a process with an empty environment so handle that edge case.
Fixes: https://github.com/nodejs/node/issues/29008
PR-URL: https://github.com/libuv/libuv/pull/2408
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash+github@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
UV_PROCESS_WINDOWS_HIDE_CONSOLE and UV_PROCESS_WINDOWS_HIDE_GUI were
whitelisted on Windows but not Unices. Now they are.
Bug introduced in commit 4c2dcca27 ("win: support more fine-grained
windows hiding") which I reviewed but where I failed to spot it. Mea
culpa.
Fixes: https://github.com/libuv/libuv/issues/2266
PR-URL: https://github.com/libuv/libuv/pull/2278
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Kyle Edwards <kyle.edwards@kitware.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The return type is changed to avoid having to craft an artificial
`return` just for the Studio compiler.
PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The Studio C compiler issues a warning if there is a `return` after an
`abort()` call or an unreachable `return` after a prior `return`.
The Studio C compiler issues a warning if there is a `return` after a
prior `return`, or an endless loop (e.g., `for (;;)`) with a `return` at
the end of the function.
PR-URL: https://github.com/libuv/libuv/pull/2200
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/libuv/libuv/pull/2017
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: John Barboza <jbarboza@ca.ibm.com>
Previously, we required the user to specify the expected read/write
flags for a pipe or tty. But we've already been asking the OS to tell us
what they actually are (fcntl F_GETFL), so we can hopefully just use
that information directly.
Fixes: https://github.com/libuv/libuv/issues/1936
PR-URL: https://github.com/libuv/libuv/pull/1964
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Back in the day I wrote comments in a really unusual way. Nowadays it
makes my eyes bleed, and clang-format doesn't know how to deal with it.
PR-URL: https://github.com/libuv/libuv/pull/1853
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Sending a SIGTERM to a process that is still starting up kills it with
SIGKILL instead of SIGTERM.
PR-URL: https://github.com/libuv/libuv/pull/1709
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit uses the Register File Interest feature on z/OS
to enable users to monitor file system events.
The poll call is used to check for file descriptors as well
as a message queue that z/OS will report file system events
on. The last item on the list used by poll will contain the
message queue id instead of a file descriptor.
Limitation:
Writes to a directory (that is, file creation and deletion)
do not generate a change message for a registered directory.
PR-URL: https://github.com/libuv/libuv/pull/1311
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Add getter/setter functions for the fields of public structs that
might be relevant to e.g. Node.js addons.
Through these methods, ABI compatibility for a subset of the ABI
is easier to achieve, since using them makes code independent
of the exact offsets of these fields.
The intended use case that prompted this are N-API addons for
Node.js, which look for more long-term ABI compatibility guarantees
than typical Node code. With these helper functions, using libuv
directly should no longer be an obstacle for such addons.
PR-URL: https://github.com/libuv/libuv/pull/1657
Refs: https://github.com/nodejs/node/issues/13512
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Unbreaks libuv compilation on Windows.
PR-URL: https://github.com/libuv/libuv/pull/1641
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
We use the UV_HANDLE_BOUND flag to mark a socket as bound to a
port. We need to do this for sockets that are sent from another
process as well as sockets that created by the process itself.
First check if the port number is non-zero. If yes then mark
it as bound.
PR-URL: https://github.com/libuv/libuv/pull/1348
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
`options.file` is of type `const char*`, don't assign it to a variable
that is a non-const `char*`. The other way around is perfectly legal,
though.
PR-URL: https://github.com/libuv/libuv/pull/1588
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This is because on some platforms like z/OS, setgid(0) is
allowed for non-superusers. So instead, use setgid(-1) to
get UV_EINVAL to test that spawn failure returns the right
return code.
PR-URL: https://github.com/libuv/libuv/pull/1456
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Like the previous commit, except now the signal mask is reset instead
of the signal disposition. This does open a race window where blocked
signals can get delivered in the interval between the pthread_sigmask()
call and the execve() call (and may end up terminating the process) but
that cannot be helped; the same caveat applies to the previous commit.
Fixes: https://github.com/nodejs/node/issues/13662
PR-URL: https://github.com/libuv/libuv/pull/1376
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Signal dispositions are inherited by child processes. Libuv itself
does not touch them (if you don't use uv_signal_start(), that is)
but the embedder might and probably does in the case of SIGPIPE.
Reset the disposition for signals 1-31 to their defaults right before
execve'ing into the new process.
Fixes: https://github.com/nodejs/node/issues/13662
PR-URL: https://github.com/libuv/libuv/pull/1376
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Cygwin and MSYS2 are POSIX layers implemented on top of Windows.
Use our POSIX `poll(2)` implementation of our poll abstraction.
For most other components we already have dedicated sources
implementing them in terms of APIs available on Cygwin or
providing non-implementations of components not supported.
This leaves only three components that need Cygwin-specific
implementations:
* uv_uptime: implement using sysinfo
* uv_resident_set_memory: add a placeholder returning UV_ENOSYS
* uv_cpu_info: add a placeholder returning UV_ENOSYS
Update our test suite to account for features not available
due to Cygwin platform limitations or our placeholders.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
At least starting with Darwin Kernel Version 16.4.0, sending a SIGTERM
to a process that is still starting up kills it with SIGKILL instead of
SIGTERM.
Fixes: https://github.com/libuv/libuv/issues/1226
PR-URL: https://github.com/libuv/libuv/pull/1282
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Check that the child process' uid and gid are correctly set.
PR-URL: https://github.com/libuv/libuv/pull/1024
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
- zos: disable test cases not applicable
- zos: build options
- zos: semaphore implementation
- zos: use compare and swap builtins
- zos: struct rusage not the same as other platforms
- zos: backlog<=0 produces undefined behaviour
Will redefine backlog in the following way
* if backlog == 0, set it to 1
* if backlog < 0, set it to SOMAXCONN
- zos: define IMAXBEL as empty flag and implement uv__tty_make_raw
- zos: use udp multicast operations from aix
- zos: ESC in ebcdic
- zos: use LIBPATH for dynamic linker path
- zos: uv_udp_set_ttl only works for ipv6
- zos: increase pthread stack size by factor of 4
- zos: return ENODEV instead of ENXIO errors for setsockopt
- zos: use uv_cond_init the same way as aix
- test: enable oob test for zos
- zos: return EINVAL for zos error code EOPNOTSUPP
PR-URL: https://github.com/libuv/libuv/pull/937
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Ifdef out the tests that rely on internal symbols when making a shared build.
PR-URL: https://github.com/libuv/libuv/pull/444
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
UV_HANDLE_CONNECTED was defined, but never used anywhere - outside this if
condition inside uv__stdio_create. So this test can't be true.
UV_HANDLE_CONNECTION was meant.
A test was also added verifying the behaviour.
PR-URL: https://github.com/libuv/libuv/pull/404
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The Windows spawn_with_an_odd_path test builds a PATH variable that
starts with ";.;". However, the old path is then used to run the test.
This commit updates the test to use the new path.
PR: https://github.com/libuv/libuv/pull/184
Reviewed-by: Bert Belder <bertbelder@gmail.com>
The contract specifies that the file descriptor should already be in
non-blocking mode before passing it to libuv.
However, node users don't really have an opportunity to do so, never
mind the fact that the call to uv_pipe_open() or uv_tcp_open() is an
implementation detail that most users won't be aware of.
Let's be nice and set the non-blocking flag explicitly. It's a cheap
operation anyway.
Fixes: https://github.com/libuv/libuv/issues/124
PR: https://github.com/libuv/libuv/pull/134
Reviewed-by: Saúl Ibarra Corretgé <saghul@gmail.com>
Fix spawn_reads_child_path when executed as `test/run-tests` or
`make check`:
1. `make check` builds a dynamic libuv.so or libuv.dyld by default.
2. spawn_reads_child_path spawns a new instance of the test runner
by consulting uv_exepath() and executing the result.
3. `test/run-tests` is normally a shell script that sets up
DYLD_LIBRARY_PATH or LD_LIBRARY_PATH before executing the
real test runner in `test/.libs`.
4. uv_exepath() (corectly) returns the path of the binary in
`test/.libs`. The binary is linked against libuv.so but that
library is not on any of the default linker paths; and if it is,
it's almost certainly the wrong version.
5. Ergo, carry over the value of the (DY)LD_LIBRARY_PATH environment
variable into the environment of the child process so that the
dynamic linker knows where to find the library.
Alternatively, we could link the test runner statically against libuv.a
but that breaks `make check` when configured with `--disable-static`.
Fixes: https://github.com/libuv/libuv/issues/85
PR-URL: https://github.com/libuv/libuv/pull/91
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
warning: ISO C90 forbids mixing declarations and code [-Wdeclaration-after-statement]
PR-URL: https://github.com/libuv/libuv/pull/67
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
More often than not, users run the test suite from /root, which means
the 'nobody' user won't be able to access the test runner and the test
will fail because we drop privileges to that user. Just skip it then.
PR-URL: https://github.com/libuv/libuv/pull/66
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The unix and windows process implementations diverge in their behavior
when dealing with subprocesses that are spawned with a relative path.
With unix the *child's* PATH environment variable is read, whereas
with windows the *parent's* environment variable is read.
This commit brings the two implementation in line with respect to
their behavior of reading PATH by having both read the *child's* PATH
environment variable. This involves looking into the user-provided
environment on windows and extracting the PATH variable specifically
so it can be inspected later on.
The PATH-parsing code for windows erroneously contained an infinite
loop when the PATH started with a leading semicolon. Each iteration of
the loop usually bumped over the separator, but if the first character
was a semicolon then it would never skip it, causing the infinite
loop.
Closes#909