Commit Graph
5047 Commits
Author SHA1 Message Date
sogaiuandsogaiu ecadc17e2a Modify debug/unbreak and tuple/setmap docstrings (#1864)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 18:40:01 -05:00
sogaiuandsogaiu 71f9535509 Modify string/find* docstrings (#1863)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 18:39:54 -05:00
sogaiuandsogaiu 2851d26802 Modify os/clock and string/format docstrings (#1860)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 18:39:44 -05:00
McSinyx d89d2910d5 Remove dangling janet_getfloat declaration (#1874)
It was not removed along with the function definition.

Fixes: ec48673f7c ("Revert float interface")
References: 23e4ad4bd3 ("Add ... float getters for consistency")
2026-09-12 18:39:10 -05:00
Calvin Rose 053d6084b8 Fix bug for PR #1849 - IPV6+windows+getlocalname
Use AF_INET6 for creating windows sockets by default. AF_INET6 on
windows will by default create dual-mode sockets that will support both
address families.

Use old behavior if IPV6 support is disabled, though.

Thanks to Pietro Cerutti for the investigation here.
2026-09-12 18:09:58 -05:00
Calvin Rose c8c8afedd2 Reduce spurious error messages in test suite.
Prevent the possibility of closing the server socket
before calling net/accept-loop in net/server by adding
a call to (ev/sleep 0).
2026-09-12 14:11:05 -05:00
sogaiuandsogaiu 716d9f7b5b Tweak some buffer parameter docstrings (#1859)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 11:02:10 -05:00
sogaiuandsogaiu 8650fad90c Change os/stat and os/lstat docstrings (#1870)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 11:01:49 -05:00
sogaiuandsogaiu 14b990f123 Choose parameter names that don't shadow builtins (#1871)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:55:06 -05:00
sogaiuandsogaiu 0d89db6967 Modify bit manipulation function doctrings (#1868)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:54:54 -05:00
sogaiuandsogaiu 48c72abf37 Rename channel parameter as chan (#1865)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:06:25 -05:00
sogaiuandsogaiu e112113069 Rename some parameters (#1869)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-12 10:04:00 -05:00
Calvin Rose 9ed76f42fb Bytecode improvements. Add jump threading and better dead code
elimination to our bytecode compiler. Also iterate it to a fixpoint.

Last, add a total instruction counter during bootstrap so we can easily
see how many instructions are in the core library.

These simple passes were factored out of some more involved bytecode
optimization work as easy wins without much code.
2026-09-11 21:00:45 -05:00
sogaiuandsogaiu a9625276be Unify assignment operator docstrings (#1857)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:56:06 -05:00
sogaiuandsogaiu 9f53b90dea Tweak ffi/defbind-alias docstring (#1853)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:55:41 -05:00
sogaiuandsogaiu 5deff0f13c Modify array/ docstrings (#1866)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:55:28 -05:00
sogaiuandsogaiu 6bbdfd0e0c Surround more things with backticks (#1862)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-11 20:50:08 -05:00
sogaiuandsogaiu e6194a8188 Improve docstring for doc (#1852)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 19:32:48 -05:00
sogaiuandsogaiu 9bc56342a8 Improve docstring for zipcoll (#1854)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 17:14:08 -05:00
sogaiuandsogaiu 112f5aef7d Use backticks for nicer site rendering (#1856)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 17:13:47 -05:00
sogaiuandsogaiu cae73db4af Fix misc docstring typos (#1855)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-10 17:13:30 -05:00
Pietro Cerutti 0bfcc9fc97 Fix a couple of imprecisions in the file/ docs (#1848)
* Fix a couple of imprecisions in the file/ docs

The `+` flag to `(file/open)` was incorrectly documented as being for
appending. Instead, this allows to read to files opened with `:w` or
`:a`, and to write to files opened with `:r`. This is the same as the
`+` flag in `fopen(3)`.

The `(file/seek)` function was documented as having both `whence` and
`n` as optional arguments. It also didn't say what the default for `n`
was. Anyway, this doesn't make sense, as a default of `:cur` and `0`
would effectively make `(file/seek f)` a no-op. I also amended a test so
both `(file/seek f :set 0)` and `(file/seek f :set)` are covered and
checked to move to the beginning of the file.

* Remove useless check for argc >= 2

We already determined it is between 2 and 3 with `janet_arity(argc, 2, 3)`.

* Dump args in assertion

* Unroll loop in test

* Differentiate failure messages
2026-09-10 17:12:54 -05:00
Calvin Rose e1963cdfe0 Prepare for version 1.42.1 v1.42.1 2026-09-10 16:45:02 -05:00
sogaiuandsogaiu 359d9f9d49 Improve docstring for run-context (#1846)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-07 18:09:44 -05:00
sogaiuandsogaiu d1d7170304 Improve docstring for getproto (#1847)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-09-07 18:08:30 -05:00
tranzystorekk 587468d3f4 add long options to shell completion scripts (#1842) 2026-09-04 09:43:37 -05:00
Calvin Rose aa157d9375 Update SONAME to 1.42 2026-09-02 18:15:48 -05:00
Jacob Mealey 94eba7a808 Fix typo for in docstring (#1840) 2026-09-02 18:15:37 -05:00
Calvin Rose 7fd75f34ea 1.42.0 Changelog update v1.42.0 2026-08-31 18:24:25 -05:00
Calvin Rose fa617d84c1 Fix warning in pp.c for msvc 2026-08-31 18:15:47 -05:00
Calvin Rose a6564ba448 Fix msvc warning with bad casts. 2026-08-31 18:14:41 -05:00
Calvin Rose 6615ef0718 Next release will be 1.42.0 2026-08-31 18:11:34 -05:00
Calvin Rose 7575929fe3 Lead users to os/execute over os/shell for most cases. 2026-08-30 10:54:24 -05:00
Calvin Rose ee5d2cd99c Address #1838
Add testcase for os/shell to test/suite-ev.janet

While we may not want to completely deprecate os/shell, we should at
least try to redirect users to better and safer interfaces like
os/execute.
2026-08-30 10:49:05 -05:00
Calvin Rose 6e04aaaa59 Add test-case for os/shell.
At the very least, add test case for valgrind/sanitizer targets.
2026-08-30 10:41:23 -05:00
Tw 38c555a6d3 ev: bugfix for free on invalid pointer (#1838)
I encountered this issue with `janet -e '(os/shell "echo")'` on Mac, system malloc lib will complain as follows:

```
janet(42817,0x7ff854547780) malloc: *** error for object 0x60000000b730: pointer being freed was not allocated
janet(42817,0x7ff854547780) malloc: *** set a breakpoint in malloc_error_break to debug
```

So I followed the suggestion and here's the backtrace:

```
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x00007ff810cb6883 libsystem_malloc.dylib`malloc_error_break
    frame #1: 0x00007ff810ca76d3 libsystem_malloc.dylib`malloc_vreport + 761
    frame #2: 0x00007ff810caab31 libsystem_malloc.dylib`malloc_report + 151
    frame #3: 0x0000000100025402 janet`janet_ev_default_threaded_callback(return_value=JanetEVGenericMessage @ 0x00007ff7bfefad90) at ev.c:2412:13 [opt]
    frame #4: 0x0000000100024b1f janet`janet_loop1_impl [inlined] janet_ev_handle_selfpipe at ev.c:1643:13 [opt]
    frame #5: 0x0000000100024ac9 janet`janet_loop1_impl(has_timeout=<unavailable>, timeout=0) at ev.c:2028:13 [opt]
    frame #6: 0x0000000100024714 janet`janet_loop1 at ev.c:1588:13 [opt]
    frame #7: 0x00000001000497f5 janet`janet_loop_fiber at ev.c:1609:41 [opt]
    frame #8: 0x00000001000497b3 janet`janet_loop_fiber(fiber=0x0000600002903790) at run.c:150:5 [opt]
    frame #9: 0x0000000100075266 janet`main(argc=<unavailable>, argv=0x00007ff7bfeff210) at shell.c:1284:14 [opt]
    frame #10: 0x00007ff810b1041f dyld`start + 1903
```

Found out that it's actually a missing break in the code which leads to double free.

BTW, I'm thinking that if we can implement a debug allocator to be used in the test, so maybe this kind of bugs can be captured earlier.


Change-Id: I74d324b70b39ddc7d6f509b0382e2be36a6a6964

Signed-off-by: Tw <tw19881113@gmail.com>
2026-08-30 10:26:33 -05:00
Yohanan 710bfd0b2b add tests for nested declarations (#1837) 2026-08-29 18:58:24 -05:00
Calvin Rose 5f702d57f6 Add more sandbox asserts in os/open 2026-08-29 07:50:18 -05:00
Khang Nguyen Duy b534bd11e3 free realpath() result with libc allocator (#1836) 2026-08-29 06:28:35 -05:00
sogaiuandsogaiu 4d91c507c4 Make table/to-struct's docstring less wordy (#1834)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-08-26 20:07:02 -05:00
Calvin Rose 6e75146a8f Replace janet_malloc(A * X) with array_allocate(A, X) to avoid overflow
on 32 bit systems in some cases.

Since most internal arrays in Janet have 32 bit limits, this is is not
hit in practice on 64 bit systems, except in cases of user input. Apply
a fix more generally to simply avoid the issue by coding "defensively".
Some applications are not strictly needed.
2026-08-26 19:16:07 -05:00
Calvin Rose 9d14e34596 Avoid array underflow in marsh.c 2026-08-26 18:55:02 -05:00
Calvin Rose b5f40c5f73 Add sandboxing for os/setlocale and calls to janet_sandbox_assert in
several other places.

Address oversight of os/rm and os/readlink especially.
2026-08-26 18:27:13 -05:00
sogaiuandsogaiu 71f7e43009 Align local names in merge and merge-into (#1833)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-08-26 17:15:31 -05:00
sogaiuandsogaiu 5e23c99b0b Improve docstring for struct/with-proto (#1832)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-08-26 17:14:58 -05:00
sogaiuandsogaiu fbd313976c Improve docstring for table/to-struct (#1831)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
2026-08-26 17:14:45 -05:00
Calvin Rose cea6dd2261 Handle degnerate range case gracefully. 2026-08-23 13:25:54 -05:00
Calvin Rose 021a17cda1 Fix stack overflow in deeply nested destructuring.
Instead, do a recursion depth check and give a normal compile error.
2026-08-23 13:14:47 -05:00
Calvin Rose d177131c84 Handle empty tuple as lhs in def/var without fatal error.
While an odd construct, this should not cause an abort in the
interpeter. Instead, we should just create no bindings and compile as
normal.
2026-08-23 13:14:47 -05:00
Calvin Rose 5b07408181 Undefined shift (literal 1 should be unsigned) 2026-08-23 13:14:47 -05:00