Commit Graph

851 Commits

Author SHA1 Message Date
Kamron Bhavnagri 2995536882 Fix Linux executable path
Fixes a bug caused by an executable named identically to the directory
it is in, where then the parent of that directory is both on the path
and marked as executable
Avoid this via stat, as we can check we are working with a file which is
executable
2025-10-18 14:33:35 +11:00
Jeroen van Rijn 7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Jeroen van Rijn 8a35acd506 More package lines. 2025-10-09 20:11:06 +02:00
samwega 9da10dece2 fix: another itoa() used in path_linux.odin had to be replaced with write_int() 2025-10-03 22:26:24 +03:00
samwega 9e9d41ddfd fix: cars i64 instead of int 2025-10-03 22:17:25 +03:00
samwega 83d36451a3 os_linux.odin was using itoa, changed to use write_int() 2025-10-03 22:13:03 +03:00
Alex Riedl b9a09cebee fix for temp_file name prefix being deallocated before being used 2025-09-11 10:55:29 -05:00
Damian Tarnawski cdca345d74 Handle optional allocator error when appending read bytes in read_entire_file_from_file 2025-09-02 13:42:25 +02:00
gingerBill 8ff15eaf69 More contextless fixes 2025-08-08 13:02:37 +01:00
gingerBill 78290ceef3 Add contextless to another proc 2025-08-08 12:38:20 +01:00
gingerBill d3f649d244 Make get_args contextless 2025-08-08 12:25:58 +01:00
gingerBill 7642e0a0e0 Require @(init) and @(fini) to be proc "contextless" () 2025-08-08 12:10:01 +01:00
gingerBill eae43f1225 Merge branch 'master' into bill/utf16-strings 2025-08-05 15:07:06 +01:00
Jared Cone b1cda52fd6 Fixed delete-after-free in file_windows.odin 2025-08-04 19:42:23 -07:00
gingerBill 5aec40e3e0 Remove unneeded uses of intrinsics.constant_utf16_cstring 2025-08-02 12:55:05 +01:00
gingerBill c631a8eff5 os2 internals -> (c)string16 2025-08-02 12:47:03 +01:00
gingerBill bb4bc316a4 for in string16; Support string16 across core 2025-08-02 12:20:35 +01:00
WisonYe 4ccdb48044 Fixed the build check: ('arg' declared but not used) against the '-default-to-nil-allocator' fix for FreeBSD/OpenBSD/NetBSD/Linux. 2025-07-19 12:29:03 +12:00
WisonYe b9f08412ae Fixed Index 0 is out of range 0..<0' when using '-default-to-nil-allocator' for Linux/OpenBSD/NetBSD. 2025-07-19 12:03:22 +12:00
WisonYe 26e4104ac9 Fixed 'Odin/core/os/os_linux.odin(1104:7) Index 0 is out of range 0..<0' when using '-default-to-nil-allocator'. 2025-07-19 11:59:18 +12:00
WisonYe 80cd080175 Fixed 'Odin/core/os/os_freebsd.odin(971:7) Index 0 is out of range 0..<0' when using '-default-to-nil-allocator'. 2025-07-19 11:54:17 +12:00
Harold Brenes 219b0fe535 Replace system:System.framework imports with system:System
This makes the linker work for both macOS and iOS targets
2025-07-13 15:45:21 -04:00
Jeroen van Rijn 2e83e22141 Merge branch 'master' into args-leak 2025-06-27 01:20:37 +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 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
gingerBill 87247b8bb7 Merge pull request #5286 from Feoramund/no-san-mem
Add `@(no_sanitize_memory)` with additions to `base:sanitizer`
2025-06-09 12:46:22 +01:00
Jeroen van Rijn 77f4199af6 Simplify _xdg_user_dirs_lookup 2025-06-08 14:56:41 +02:00
Jeroen van Rijn 6d7f5baaf8 Merge pull request #5295 from elyalon/dirs
Fix user dirs, add docs
2025-06-07 11:13:40 +02:00
Ely Alon deeb9e2d12 remove fmt import 2025-06-07 01:40:43 +03:00
Ely Alon 17746db555 Fix user dirs, add docs 2025-06-07 01:22:30 +03:00
Jeroen van Rijn e870369c97 Merge pull request #5288 from Feoramund/strconv-append-to-write
Clarify `strconv.append_*` to `strconv.write_*`
2025-06-05 23:45:37 +02:00
Feoramund b7de15caa3 Clarify strconv.append_* to strconv.write_* 2025-06-05 16:56:00 -04:00
Jeroen van Rijn 108c8781c7 Factor out into helper. 2025-06-05 22:27:18 +02:00
Feoramund f8228a91d1 Mark some uninitialized memory as safe
Syscalls (but not C functions) are opaque to MemorySanitizer, thus some
memory addresses need to be manually marked as safe to access.
2025-06-05 16:06:44 -04:00
Jeroen van Rijn 90a1b0ec4b UAF 2025-06-05 21:45:36 +02:00
Jeroen van Rijn 2428fa37a9 tabs 2025-06-05 21:38:59 +02:00
Ely Alon a9cdb4f446 add more user dirs 2025-06-05 21:50:59 +03:00
Jeroen van Rijn a1759aa2fa Fix 2025-06-05 16:54:39 +02:00
Jeroen van Rijn 93e1c6593e Change os2.user_* on Windows to use SHGetKnownFolderPath.
Known folders can be redirected using `SHSetKnownFolderPath`, and it's a bit iffy to rely on environment variables.

This also more easily allows us to add `user_*_dir` procedures for the remaining 139 GUIDs in `known_folders.odin`, provided they have equivalents on other platforms.
2025-06-05 16:37:41 +02:00
Jeroen van Rijn da3b3a4139 Allocate return value on provided allocator 2025-06-05 15:16:35 +02:00
Jeroen van Rijn d4a1670b93 Fix core:log on -target:js_wasm32 2025-06-02 14:44:26 +02:00
Laytan Laats eab3e2be22 os2: remove libc use on Linux 2025-05-20 19:48:06 +02:00
Jeroen van Rijn d7a83a7a1f Revert "os2: Don't try to translate Windows file attributes to Unix mode flags"
This reverts commit 95923c2059.
It'll be updated later.
2025-05-12 23:34:12 +02:00
Jeroen van Rijn 30388cada3 Fix os2.clean_path on Windows 2025-05-11 15:35:52 +02:00