Commit Graph

5677 Commits

Author SHA1 Message Date
mischief
71801576eb unix: make OpenBSD uv_exepath work
some users of libuv rely on uv_exepath to be an actual path to a
program. unfortunately, the OpenBSD KERN_PROC_ARGV sysctl just returns
what is in argv[0], so if the program was executed by being looked up in
$PATH, uv_exepath would only return the basename and not an actual path.

to fix, this use the same approach as IBM i, OS/390 and AIX by searching
with uv__search_path. this is also the same approach the Zig language
has taken for the similar selfExePath function for OpenBSD.

the tests expect that uv_exepath still works after uv_set_process_title,
which on BSD is a call to setproctitle. the place setproctitle stores to
is the same place that KERN_PROC_ARGV reads from, so we need to stash
the original argv[0] in uv_setup_args to recover it later in uv_exepath.
2026-02-05 11:45:49 +01:00
Ben Noordhuis
0db25a91f0 doc: add setuid warning to uv_exepath 2026-02-05 11:44:11 +01:00
Han Gao
e50d4e672e
unix: implement cpu_relax() for riscv64 (#5019)
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
2026-02-04 22:46:14 +01:00
Ben Noordhuis
885613f1fe
aix,ibmi: fix test suite build breakage (#5020)
Apparently there is no openpty() on those platforms. Introduced in
commit 2e2114ed from last month.

Fixes: https://github.com/libuv/libuv/issues/5018
2026-02-04 22:45:38 +01:00
tobil4sk
73bfbb995f
idna: fix assert in wtf8_to_utf16 conversion (#5021)
0x10FFFF is the valid max unicode character, so the check should be
inclusive.

This assert gets triggered because uv__wtf8_decode1 (used by
uv_wtf8_length_as_utf16) has the correct code_point <= 0x10FFFF check,
so the sequence is treated as valid and it will be passed into
uv_wtf8_to_utf16, where the incorrect assert gets triggered:

src/idna.c:397: uv_wtf8_to_utf16: Assertion `code_point < 0x10FFFF' failed.
2026-02-04 21:55:43 +01:00
Ben Noordhuis
fc90bb9843
unix: remove sunpro references (#5017)
Sun Studio / Oracle Developer Studio hasn't had a release in almost
nine years. If Oracle doesn't feel like supporting it, then neither
do I.
2026-02-02 23:15:38 +01:00
Santiago Gimeno
c68ca444e7
win: refactor to support large statfs blocks (#5016)
Accomplish this by replacing `GetDiskFreeSpaceW()` with
`NtQueryVolumeInformationFile()` which allows us to represent blocks
larger than 2^32 - 1 via
`FILE_FS_FULL_SIZE_INFORMATION.TotalAllocationUnits`.

Expanded `fs_statfs` test to check that `uv_fs_statfs()` also works with
files, meaning https://github.com/libuv/libuv/issues/2683 remains fixed
without the need of https://github.com/libuv/libuv/pull/2695.
2026-02-02 10:04:36 +01:00
Ben Noordhuis
91dc2389cc
unix,win: check nbufs argument is reasonable (#5014)
Catch sign conversion bugs by introducing a bounds check that doubles
as a sanity check.

Fixes: https://github.com/libuv/libuv/issues/5012
2026-02-01 13:03:07 +01:00
Ben Noordhuis
4839e28d50
test: disable tcp_reuseport test under qemu (#5005)
The test is multi-threaded and expects both threads to receive at least
some of the incoming connections but there isn't always true parallelism
under QEMU's user-mode emulator.

Single-core systems are also susceptible to that so also add a check
that we have at least two cores to run on.

As mentioned in the change for the udp_reuseport test from a few days
ago, the test is not perfect (there being > 1 core doesn't guarantee
we actually get to run on them) but it's better than nothing.

Fixes: https://github.com/libuv/libuv/issues/5003
2026-01-23 11:07:15 +01:00
Ben Noordhuis
0405e1224f
test: disable udp_reuseport test under qemu (#5002)
The test is multi-threaded and expects both threads to receive at least
some of the incoming datagrams but there isn't always true parallelism
under QEMU's user-mode emulator.

Single-core systems are also susceptible to that so also add a check
that we have at least two cores to run on.

It's not perfect because a sufficiently dedicated test torturer could
probably concoct a containerized setup where the core count > 1 but the
available CPU slice is so small that the test effectively still runs
sequentially, but it's better than nothing.

Fixes: https://github.com/libuv/libuv/issues/4777
2026-01-21 22:34:30 +01:00
Ben Noordhuis
4cb6a2d33c
unix: factor out common i/o poll code (#5000) 2026-01-18 22:32:36 +01:00
Ben Noordhuis
2e2114ed89
unix: fix partial read handling after POLLHUP (#4997)
It was reported that PTYs on Linux sometimes report POLLHUP, return a
partial read, but still return more data on the next read.

Libuv contains an optimization where it assumes a partial read after
POLLHUP means the next read can be skipped because it's going to fail
with EOF anyway. That assumption was thought to be always true but,
alas, it isn't.

The fact the optimization has been present for 13 years and this is the
first bug report about it, indicates how rare this particular condition
is, but of course we can't skim on correctness.

The reworked optimization only uses POLLHUP as an input signal when
POLLIN is not also set. That means we no longer have to track partial
reads because we're going to try and read anyway as long as POLLIN is
set. It seems to cause no measurable regressions on the test suite or
the (lightly tested) benchmarks.

Fixes: https://github.com/libuv/libuv/issues/4992
2026-01-18 12:21:53 +01:00
Cody Tapscott
588ea9b913
win: readlink support for IO_REPARSE_TAG_LX_SYMLINK (#4994)
This adds support for "Linux"-style Windows symbolic links, reparse tag
0xA000001D (IO_REPARSE_TAG_LX_SYMLINK).
2026-01-16 10:38:18 +01:00
Ben Noordhuis
3908e54252
test: make pty test work under asan (#4996)
AddressSanitizer was right to complain about the test because it was
passing an uninitialized `struct winsize` to openpty().
2026-01-15 21:39:23 +01:00
Ben Noordhuis
d67f9d2fba
test: fix -Wstringop-overread warning (#4993)
Check the length before doing the compare like we do a few lines below,
not the other way around. It's a false positive because the length is
capped well below the maximum object size but it's an easy fix.

Fixes the following warning:

    test/test-poll-oob.c:94:19: warning: ‘strncmp’ specified bound
    [18446744071562067968, 18446744073709551615] exceeds maximum
    object size 9223372036854775807 [-Wstringop-overread]
2026-01-13 14:35:19 +01:00
Ben Noordhuis
f420c2bd57
test: fix -Wuninitialized-const-pointer warning (#4990)
Zero the struct. The compiler is not aware it's not actually used.
2026-01-07 23:24:28 +01:00
Ben Noordhuis
91ae02a63d
unix,win: add f_frsize field to uv_statfs_t (#4984)
Fixes: https://github.com/libuv/libuv/issues/4983
2026-01-01 22:33:44 +01:00
Ben Noordhuis
8b870dab3d
doc: remove hp-ux from supported platforms list (#4985)
As of January 1, 2026, HP-UX is well and truly dead. Remove it.
2026-01-01 21:34:36 +01:00
Oblivionsage
3e9ae1bca0
unix: remove handle from queue on uv_spawn() error (#4980)
If uv_spawn() fails after uv__handle_init() has been called, the handle
remains in loop->handle_queue. This causes use-after-free if the handle
is stack-allocated or freed, and a subsequent loop operation like
uv_walk() accesses it.

This follows the same pattern as uv_tcp_init_ex() which explicitly
removes the handle from the queue on error.
2025-12-26 16:53:42 +01:00
Ben Noordhuis
309b28bdbe
doc: add handle and request usage guidelines (#4978)
Refs: https://github.com/libuv/libuv/discussions/4977
2025-12-21 19:00:09 +01:00
Santiago Gimeno
9c876b2f3b
test: run more fs tests using io_uring too (#4970)
Fix `threadpool_cancel_fs_iouring` so it takes `UV_FS_FTRUNCATE` into
account.
2025-12-20 22:30:42 +01:00
dependabot[bot]
ec7ec98b70
build(deps): bump actions/upload-artifact from 5 to 6 (#4975)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-15 07:35:23 -05:00
dependabot[bot]
5c91d49561
build(deps): bump actions/download-artifact from 6 to 7 (#4974)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-15 07:34:09 -05:00
chemodax
ada5131840 win: Optimize file/directory delete.
Use GetFileInformationByHandleEx(FileBasicInfo) instead of GetFileInformationByHandle() because it's cheaper -- one syscall, instead of two [1]

[1]: https://blog.axiorema.com/engineering/hidden-cost-getfileinformationbyhandle/
2025-12-12 08:46:10 +01:00
Ben Noordhuis
ac591507f3
ci: add macos-15-intel to matrix (#4968)
And fix a stupid typo that made GHA skip running the tests 🤦
2025-12-10 20:43:08 +01:00
Kartik Puri
504887a339
doc: add example usage for uv_sleep (#4955) 2025-12-10 07:23:39 +01:00
Ben Noordhuis
4eefcbeb5c
ci: update macos runner images (#4967)
Add macos-15 runners. Remove the deprecated macos-13 runners.

Fixes: https://github.com/libuv/libuv/issues/4965
Refs: https://github.com/actions/runner-images/issues/10924
2025-12-09 17:36:57 +01:00
Bart Louwers
3c1e7013b3
Update OS X reference to macOS in README (#4964) 2025-12-08 19:02:08 -05:00
Santiago Gimeno
fd89e63f2f linux: fix uv_fs_ftruncate io_uring implementation (#4963 2/2)
The `offset` field should be assigned to ithe `io_uring_sqe.off` field.
2025-12-08 10:31:45 +01:00
Santiago Gimeno
e522b27da3 test: add macros to run fs tests with io_uring (#4963 1/2)
Added `TEST_FS_DECLARE`, `TEST_FS_ENTRY` and `TEST_FS_IMPL` so we can
run test-fs.c tests both using the threadpool and io_uring
implementations.
2025-12-08 10:31:45 +01:00
Ambuj Vashistha
9640bc6510
unix,win: fix leak in uv_os_environ error path (#4960) 2025-12-06 22:04:49 +01:00
Ben Noordhuis
d7dda9edfe
win: handle sshfs-win quirk in uv_fs_readdir() (#4953)
The initial FindFirstFile can fail with ERROR_FILE_NOT_FOUND, meaning
no matches (read: empty directory), which leaves dir_handle set to
INVALID_HANDLE_VALUE. Not an actual error, it just means no results.

I can't get FindFirstFile to work like that on regular file systems
but it's been reported that it does under sshfs-win and the MSDN
documentation clearly states it's possible. Handle it.

Fixes: https://github.com/libuv/libuv/issues/4952
2025-12-02 16:37:17 +01:00
Ayush Kumar
bf44c3fdcc
unix: support nanosecond resolution in uv__fs_to_timespec (#4951)
Remove the microsecond truncation in uv__fs_to_timespec() function to enable
full nanosecond resolution support. The utimensat() system call already
supports nanosecond precision, so the artificial truncation to microseconds
is no longer necessary.

This allows file modification and access times to be set with full nanosecond
precision instead of being limited to microsecond resolution.

Fixes the TODO comment about removing the microsecond resolution limit.
2025-12-02 08:42:44 +01:00
Ben Noordhuis
8fc70344df
win: fix race in uv_fs_event_start() (#4948)
Fetch file metadata by handle instead of by path, otherwise there is a
race window between fetching and acting on said metadata where another
process can replace the file with another one.

There is still a potential race when upgrading the short path to a long
path but that that one is intrinsic. It's not something libuv can solve
except by refraining from calling GetLongPathName.

Fixes: https://github.com/libuv/libuv/issues/4568
2025-11-29 20:21:40 +01:00
dependabot[bot]
8e024629fe build(deps): bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 23:25:44 +01:00
Andy Pan
f6e19be743 win: rename minimal_windows10_version1709() for libuv's convention
---------

Signed-off-by: Andy Pan <i@andypan.me>
2025-11-22 15:43:50 +01:00
Gang Zhuo
01250432eb
doc: fix documentation for uv_utf16_to_wtf8() function (#4935)
When `wtf8_ptr` is NULL, the length will be stored in `wtf8_len_ptr` (not in `wtf8_ptr`).

Fixes: https://github.com/libuv/libuv/issues/4934
2025-11-18 20:45:29 +01:00
Ben Noordhuis
b33162dd0b
unix: fix use of uninitialized variable (#4924)
The `flags` argument to `uv__udp_recvmsg_errqueue` was not initialized
in all code paths. Shuffle code around to make the control flow more
obvious (at the cost of a less legible diff.)

Also fixes an unused label warning when building on systems that aren't
Linux.

Introduced last month in commit 80a5e3ba0, "linux: add MSG_ERRQUEUE
ipv4/ipv6 udp support".
2025-11-06 22:34:44 +01:00
dependabot[bot]
12d1ed1380 build(deps): bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-28 09:51:07 +01:00
dependabot[bot]
300fc32263
build(deps): bump actions/download-artifact from 5 to 6 (#4914)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-27 07:56:06 -04:00
Christian Guinard
a944c422cc
darwin: better heuristic for available memory (#4908)
Fixes: https://github.com/libuv/libuv/issues/3897
2025-10-15 08:35:42 +02:00
Ben Noordhuis
f3ce527ea9
ibmi: add stub function to satisfy linker (#4905)
Add a stub function for no-ahafs builds. src/unix/core.c won't actually
call uv__ahafs_event but the linker still needs to see a symbol.

Like commit 87943b03 but for IBM i instead of AIX this time.
2025-10-07 23:08:33 +02:00
Juan José
80a5e3ba01
linux: add MSG_ERRQUEUE ipv4/ipv6 udp support (#4902)
Fixes: https://github.com/libuv/libuv/issues/4447
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
Co-authored-by: theanarkh <theratliter@gmail.com>
2025-10-06 16:45:58 +02:00
Ben Noordhuis
87943b03b3
aix: add stub function to satisfy linker (#4903)
Add a stub function for no-ahafs builds. src/unix/core.c won't actually
call uv__ahafs_event but the linker still needs to see a symbol.
2025-10-05 18:40:12 +02:00
Juan José
ee67f3db88
unix,win: implement uv_udp_open_ex (#4896)
Fixes: https://github.com/libuv/libuv/issues/4551

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-10-04 09:43:07 +02:00
Juan José
50f281c044
test: make thread_priority robust against system default nice levels (#4901)
The test previously assumed a default nice value of 0, but this can vary
depending on PAM configuration, /etc/security/limits.conf, or other environment
settings.

Fixes: https://github.com/libuv/libuv/issues/4898

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
2025-10-03 11:32:58 -04:00
green-br
74079a8e47
unix: add neoverse-v2 cpu identifier (#4897) 2025-10-01 19:18:20 +02:00
Ben Noordhuis
553bb9858f
aix: fix nullptr check in uv__skip_lines (#4892)
Fixes: https://github.com/libuv/libuv/issues/4891
2025-09-25 20:21:54 +02:00
Jameson Nash
cfdce92fa5
unix: fix uv__signal_loop_cleanup call in init (#4876)
While unlikely that this fails (since it is implemented to call
`abort()` instead of actually return an error code, we would
theoretically leak this state. The process state init doesn't actually
have a cleanup, and just awkwardly relies on uv_signal_close being
unnecessary (which is likely true though).
2025-09-25 11:02:44 -04:00
dependabot[bot]
392590a738
build(deps): bump actions/setup-python from 5 to 6 (#4884) 2025-09-25 11:02:28 -04:00