Commit Graph

14960 Commits

Author SHA1 Message Date
Jeroen van Rijn
91b5cec8e8 Merge pull request #5349 from Kelimion/check_all
Check all
2025-06-16 23:52:39 +02:00
Jeroen van Rijn
6d01aa9069 Appease -vet for haiku 2025-06-16 23:30:22 +02:00
Jeroen van Rijn
246deda2c5 Remove unneeded ; for essence 2025-06-16 23:03:07 +02:00
Jeroen van Rijn
29d9a12491 Add check_all scripts 2025-06-16 22:26:24 +02:00
Jeroen van Rijn
c4fb5ebf9b Merge pull request #5348 from Kelimion/get_env_buffer
Get env buffer
2025-06-16 20:51:06 +02:00
Jeroen van Rijn
b9809e7aa4 OpenBSD 2025-06-16 20:39:19 +02:00
Jeroen van Rijn
73dcc39d98 Fix macOS 2025-06-16 20:22:15 +02:00
Jeroen van Rijn
6347c87b5b Add buffered get_env variants to os2 2025-06-16 20:12:27 +02:00
Jeroen van Rijn
eef07431ef Factor out buffered utf helper. 2025-06-16 20:12:27 +02:00
Jeroen van Rijn
1a2f83f123 Add bring-your-own-buffer versions of os.lookup_env and os.get_env
And make `core:terminal` use it so that `core:log` can be imported with `-default-to-nil-allocator`,
in which the actual allocator is set up in `main()`.

Windows was tricky because of the utf-8 <> utf-16 conversion, so we use some temporary stack buffers for that purpose,
limiting the non-allocating version there to 512 utf-16 characters each for the key and environment value.

In general the value is (obviously) limited to the size of the supplied buffer, and a `.Buffer_Full` error is returned
if that buffer is insufficient. If the key is not found, the procedure returns `.Env_Var_Not_Found`.

TODO:
- Factor out buffer-backed utf8 + utf16 conversion to `core:sys/util` to more easily apply this pattern.
- Add similar `lookup_env` and `get_env` procedures to `core:os/os2`.

Fixes #5336
2025-06-16 20:12:26 +02:00
Jeroen van Rijn
03e5636abe Merge pull request #5347 from Feoramund/test-expect-assert
Let tests expect assertion failures and signals raised
2025-06-16 19:51:04 +02:00
Feoramund
36762ce081 Add tests for new test failure expectation API 2025-06-16 11:25:32 -04:00
Feoramund
71c6b0c8f0 testing: Add API to expect signals and assertion failures 2025-06-16 11:25:32 -04:00
Jeroen van Rijn
1bd48df41f Disable test_try_select_raw_happy 2025-06-16 12:59:24 +02:00
Jeroen van Rijn
d79d5237ad Merge pull request #5346 from Airtz/master
Fix typo in `error_article_table` lookup
2025-06-16 12:40:03 +02:00
Airtz
fe7fbfedc0 Fix typo in error_article_table lookup 2025-06-16 12:22:03 +02:00
Jeroen van Rijn
4281dc4999 Attempt fix brew errors (#5345)
Disable macOS Intel for now.
2025-06-16 12:06:20 +02:00
Jeroen van Rijn
9c9380d158 Merge pull request #5315 from peperronii/master
Expose getpeername() in core:net package as "peer_endpoint"
2025-06-16 11:30:34 +02:00
PePerRoNii
acdab793d9 Added Socket_Info_Error to Network_Error union 2025-06-16 16:17:48 +07:00
Jeroen van Rijn
795ceec2cd Merge pull request #5327 from nubunto/fix/pool-join-hangs
fix: pool_join hangs if no threads are started
2025-06-16 10:50:35 +02:00
Bruno Panuto
6874a4cdb0 fix: make pool_finish not hang when pool_start is not called 2025-06-16 00:28:43 -03:00
PePerRoNii
c08d9c50c8 Changed TCP_Recv_Err to Socket_Info_Err and tested on darwin_arm64 2025-06-15 12:14:59 +07:00
PePerRoNii
42aa8ac383 Implemented _socket_info_error on peer_endpoint and bound_endpoint 2025-06-15 11:17:49 +07:00
PePerRoNii
f49bf1abd2 added Socket_Info_Errors Enum 2025-06-15 10:26:06 +07:00
Jeroen van Rijn
771c1c4332 Merge pull request #5334 from Kelimion/types-checks
Add additional nullptr checks in types.cpp
2025-06-14 01:22:15 +02:00
Jeroen van Rijn
cc08dca53d Add additional nullptr checks in types.cpp
Ran into a bunch of nullptr problems while reviving an 8-year old Odin problem.
2025-06-14 01:13:36 +02:00
Laytan Laats
144daf6fff add macOS Tahoe to odin report and core:sys/info 2025-06-14 00:27:37 +02:00
Laytan
aa0cffb412 Merge pull request #5328 from laytan/compat-allocator-improvements
mem: compat allocator improvements
2025-06-13 19:41:58 +02:00
Jeroen van Rijn
f03484e352 Merge pull request #5332 from Kelimion/replace_environment_variables
Replace core:posix usage in core:os/os2
2025-06-13 18:15:31 +02:00
Jeroen van Rijn
84eaddbd47 WASI 2025-06-13 18:08:35 +02:00
Jeroen van Rijn
8c8406cc4d stub out get_env for js 2025-06-13 18:00:30 +02:00
Jeroen van Rijn
3862555153 Replace core:posix usage in core:os/os2 2025-06-13 17:49:05 +02:00
Jeroen van Rijn
fe9f74f7a2 Disable PR comments 2025-06-13 07:24:03 +02:00
Laytan
fc7fc4d5cd Merge pull request #5289 from JackMordaunt/jfm-sync_chan_refactor
Jfm sync chan refactor
2025-06-12 21:51:34 +02:00
Jack Mordaunt
3c3fd6e580 tests/core/sync/chan: move global state into test
While this state is not actually needed by more than one test, we can
just make it a static variable.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
c1cd525d9d core/sync/chan.select_raw: call try_select_raw with deprecation warning
Eventually select_raw should be a blocking select operation, but for now
we need to migrate people away.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
96b91849a9 core/sync/chan.try_select_raw: fix doc comment typo
Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
2025-06-12 16:14:52 -03:00
Jack Mordaunt
4d7c182f7d tests/core/sync/chan: test harness for chan.try_select_raw
This test harness ensures consistent non-blocking semantics and
validates that we have solved the toctou condition.

The __global_context_for_test is a bit of a hack to fuse together the
test supplied proc and the executing logic in packaage chan.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
faae81ba61 core/sync/chan.try_select_raw: test hook for testing the toctou
This is necessary because we need to allow the test guarantee against a
rare condition: where a third-party thread steals a value between the
validity checks can_{send,recv} and the channel operation
try_{send,recv}.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
4043be8567 core/sync/chan.try_select_raw: skip nil input messages
This makes the proc easier and safer to call by letting the caller nil
out messages to skip sends.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
fb39e5a2f8 core/sync/chan.try_select_raw: clarify loop control flow
Use a label to clarify the continue statements.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
d5b7302ac0 core/sync.try_select_raw: fix TOCTOU
Fixes a TOCTOU where the channel could be used between the call to
can_{recv,send} and {recv,send} causing an unexpected blocking
operation.

To do this we use the non-blocking try_{recv,send} and retry the check
in a loop. This guarantees non-blocking select behaviour, at the cost of
spinning if the input channels are highly contended.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
2025-06-12 16:14:52 -03:00
Jack Mordaunt
be873af003 core/sync.select_raw: rename to try_select_raw
This follows the convention where non-blocking operations are prefixed
with "try" to indicate as much.

Since select_raw in it's current form doesn't block, it should be
try_select_raw, and allow select_raw to name a blocking implementation.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
7f9589922d core/sync.select_raw: return a useful index
This fixes a flaw in the original implementation: the returned index is
actually useless to the caller.

This is because the index returned refers to the internal "candidate"
list. This list is dynamic, and may not have all of the input channels
(if they weren't ready according to chan.can_{recv,send}). That means
the index is not guaranteed to mean anything to the caller.

The fix introduced here is to return the index into the input slice
(recvs,sends) and an enum to specify which input slice that is.

If no selection was made, then (-1, .None) is returned to communicate as
much.

Signed-off-by: Jack Mordaunt <jackmordaunt.dev@gmail.com>
2025-06-12 16:14:51 -03:00
Laytan Laats
67a8b035db mem: compat allocator improvements
1. store alignment instead of original pointer
2. implement .Query_Info
3. poison the header and alignment portion of the allocation
4. .Resize uses `max(orig_alignment, new_alignment)` as it's alignment
   now
5. .Free passes along the original alignment
2025-06-12 20:40:22 +02:00
Laytan Laats
0ed6cdc98e mem/tlsf: fix asan reporting poisoning of already poisoned region
free on tlsf poisons the entire block, while alloc might only unpoison a
part of it (cause it's size is aligned up). This causes free to
potentially poison an already poisoned portion, which is a
use-after-poison.

Because this is "fine" and intended, I opted to just
@no_sanitize_address it.
2025-06-12 19:37:24 +02:00
Jeroen van Rijn
74f70bfbcb Comment 2025-06-12 17:09:33 +02:00
Jeroen van Rijn
298bab99a4 Merge pull request #5326 from Kelimion/fix-5321
Revert changes to thread_unix.odin
2025-06-12 16:56:29 +02:00
Jeroen van Rijn
5aa377e64e Revert changes to thread_unix.odin 2025-06-12 16:36:40 +02:00
Jeroen van Rijn
b119ca0261 Merge pull request #5325 from Kelimion/fix-5321
Fix #5321
2025-06-12 16:14:01 +02:00