1
0
mirror of https://github.com/janet-lang/janet synced 2026-03-30 03:21:28 +00:00
Commit Graph

4900 Commits

Author SHA1 Message Date
Calvin Rose
7d388f267a Update exceptions for os/execute with empty env test. 2026-03-02 19:24:12 -06:00
Calvin Rose
37a2677ecb Verbose testing for windows sanitizer build. 2026-03-02 19:17:10 -06:00
Calvin Rose
143ba6ba0f Add JanetOverlapped modification to filewatch. 2026-03-02 18:47:39 -06:00
Calvin Rose
0e8c3e3e0a Load connect lazily instead of in init. 2026-03-02 18:41:27 -06:00
Calvin Rose
4d13437c31 More tweaks for net.c 2026-03-02 18:31:15 -06:00
Calvin Rose
b134f5359d Correct missed overlappd conversions as reported by CI. 2026-03-02 18:26:28 -06:00
Calvin Rose
ce56342168 msvc does not have undefined behavior sanitizer. 2026-03-02 18:22:42 -06:00
Calvin Rose
ab86ef09ef Move declarations around for header fixes. 2026-03-02 18:21:37 -06:00
Calvin Rose
b8db108702 build_win tweaks. 2026-03-02 18:18:09 -06:00
Calvin Rose
479d846f7a WIP port of net/connect on windows to ConnectEx.
ConnectEx will let us restore non-blocking behavior on connect. Also
revisiting our IOCP implementation to see if we can do other
refactoring, such as removing code that tries to user OVERLAPPED
internals for no good reason.
2026-03-02 17:55:21 -06:00
Calvin Rose
39f8cf207c Cast for warning on mingw DWORD printing. 2026-03-01 12:24:03 -06:00
Calvin Rose
95f2e233c5 Try io.h on windows 2026-03-01 12:20:15 -06:00
Calvin Rose
e8f9c12935 Fix regression where private main was not run. 2026-03-01 10:52:52 -06:00
Calvin Rose
32d75c9e49 Dup io file descriptors when marshalling closable files.
For unclosable files, no need to dup, but for closable files we can get
a resource leak. Valgrind and similar tools won't catch this but IO will
unexpectedly start going to the wrong descriptor if a file was
transferred to a new thread, closed, and then a new file was created.
2026-03-01 10:39:50 -06:00
Calvin Rose
5fec2aa9df Move some files around code more defensively for mitigation. 2026-02-27 18:19:40 -06:00
Brett
54fbd7607f Fix GC collecting active fiber during nested janet_continue (#1720)
janet_collect() marks janet_vm.root_fiber but not janet_vm.fiber.
When janet_pcall (or janet_continue) is called from a C function,
the inner fiber becomes janet_vm.fiber while root_fiber still points
to the outer fiber. If GC triggers inside the inner fiber's execution,
the inner fiber is not in any GC root set and can be collected —
including its stack memory — while actively running.

This also affects deeply nested cases: F1 -> C func -> janet_pcall ->
F2 -> C func -> janet_pcall -> F3, where F2 is saved only in a C
stack local (tstate.vm_fiber), invisible to GC.

Fix: in janet_continue_no_check, root the fiber with janet_gcroot
when this is a nested call (root_fiber already set). Each nesting
level roots its own fiber, handling arbitrary depth. Top-level calls
(event loop, REPL) skip the root/unroot entirely since root_fiber
is NULL.

Add test/test-gc-pcall.c: standalone C test covering both single
and deep nesting cases.

Co-authored-by: Brett Adams <brett@bletia-9.local>
2026-02-27 18:13:46 -06:00
sogaiu
019829fdf9 Tweak a docstring and a comment (#1718)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-02-25 17:51:54 -06:00
Calvin Rose
2602bec017 Check stderr for redirection before turning on/off color. 2026-02-21 08:17:12 -06:00
Calvin Rose
403b2c704a Add sanitizer test to github actions and sr.ht builds.
This will run both clang and gcc sanitizers as part of ordinary testing.
2026-02-20 18:08:09 -06:00
Calvin Rose
ca9ffaa5bb Avoid memory leak when canceling fibers with threaded channels.
Objects in channels are sent as messages that need to be freed by the
consumer. However, in certain cases, no consumer is available and the
messages were being discarded without properly being freed. This should
also fix `-fsanitize=address` on GCC and CLANG with the default test
suite.
2026-02-20 14:47:00 -06:00
Calvin Rose
e61194a8d9 Remove older extra channel unlocks. 2026-02-20 08:17:25 -06:00
Calvin Rose
08e4030487 Add builders for issue #1716 2026-02-20 08:00:36 -06:00
Calvin Rose
56b5998553 Suspicious locking behavior with select.
This looks like it could cause deadlocks with threaded channels
(normal channels are unaffected, locking/unlocking is a no-op).
2026-02-20 07:35:18 -06:00
R Fisher
ea997d585b fix multicast on illumos (#1717)
illumos, like BSD, expects IP_MULTICAST_TTL to be
an unsigned char
2026-02-20 07:30:30 -06:00
Calvin Rose
fc725e2511 Prepare for next patch release. 2026-02-18 08:46:17 -06:00
Calvin Rose
d636502c32 Fix vestigial doc string. 2026-02-18 08:41:31 -06:00
Calvin Rose
0fea20c821 Prepare for v1.41.2 and indicate vm changes for stack correction. v1.41.2 2026-02-18 08:27:10 -06:00
Calvin Rose
91cc499e77 1.42.2 patch. 2026-02-18 08:19:55 -06:00
Calvin Rose
68850a0a05 Update for 1.41.2 patch. 2026-02-18 08:19:13 -06:00
Calvin Rose
d3d7c675a8 Update CHANGELOG.md 2026-02-17 18:56:21 -06:00
Calvin Rose
b2c9fc123c Generate JOP_PUT_INDEX in the compiler when possible. 2026-02-17 09:07:01 -06:00
Calvin Rose
fa0c039cd3 Add regression test for issue #1714 2026-02-17 07:59:08 -06:00
Evan Shaw
78ef9d1733 Initialize memory allocated by put (#1715) 2026-02-17 07:50:50 -06:00
sogaiu
b6676f350c Use snprintf instead of sprintf - sequel (#1713)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-02-16 09:12:02 -06:00
Calvin Rose
0299620a2d Code defensively with regard to stack resizes from custom get and put
for abstract types.

Abstract types whose get/put/length/etc. implementations allocated fiber
slots could break the VM by invalidating the stack pointer in the
interpreter. This is admittedly a bit unusual but is something most
users would probably expect to work. Debugging this would be a real pain.
2026-02-16 09:02:07 -06:00
Calvin Rose
739d9d9fe3 Expose module/add-syspath and update CHANGELOG.md 2026-02-15 22:20:54 -06:00
Calvin Rose
1557f9da78 Don't reference argv after fiber may have been resized. 2026-02-15 21:54:42 -06:00
Calvin Rose
529d8c9e4a Improve ability to load modules by full path.
Be explicit when we are including this functionality. Add a function
module/add-file-extension that can do this programatically.
2026-02-15 21:10:26 -06:00
Calvin Rose
2df16e5a48 Allow garbage collection to be called inside the module entry.
This usually shouldn't be needed, but in the case that it is, or if
garbage collection is triggered manually, we can prevent use-after-free.
2026-02-15 18:46:21 -06:00
Calvin Rose
b0db2b22d6 Remove macos-13 2026-02-15 11:18:40 -06:00
Calvin Rose
8b6d56edae Patch release to 1.41.1 v1.41.1 2026-02-15 10:36:46 -06:00
Calvin Rose
a2a7e9f01e Add explicit include of inttypes.h 2026-02-15 10:24:56 -06:00
Calvin Rose
4b078e7a45 Use correct format specifier on windows if missing message. 2026-02-15 10:17:16 -06:00
Calvin Rose
5c0bb4b385 Cosmo libc builds were not working. 2026-02-15 09:57:10 -06:00
Calvin Rose
2aaa7dfa10 Sort keys when compiling struct and table literals.
Order of evaluation becomes more clear in some cases.
2026-02-15 09:42:55 -06:00
Calvin Rose
10bb17199c Prepare for 1.41.0 release v1.41.0 2026-02-15 08:45:56 -06:00
Calvin Rose
0aa7dfeb9a Work on windows for WSAConnect not working.
For remote connections, if you did not manually wait for the connection
to settle, the programmer would see unspecified network errors. This is
is because the underlying TCP Connection had not been established yet.
The correct way to deal with this is to use ConnectEx if available
instead of WSAConnect.
2026-02-14 21:11:28 -06:00
Calvin Rose
8f7c32e5cb Update for msvc build. 2026-02-14 18:31:57 -06:00
sogaiu
abd7bb1110 Use snprintf instead of sprintf (#1711)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-02-14 09:04:33 -06:00
Calvin Rose
d81512723b When pretty printing, don't sort keys for huge tables.
This was exposed when printing `(invert (range 200000))`, which
isn't so large that we shouldn't be able to sort it, but was taking
far too long to compute.
2026-02-14 08:57:27 -06:00