kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

commit c346c505e43d82f2b3ff1141d9fcae1a5927e903
parent b02403a3bef7110de12cc1abf50be58fdb36f6cd
Author: Ryan Sepassi <rsepassi@gmail.com>
Date:   Thu, 16 Jul 2026 10:10:58 -0700

install: repair durable platform aliases

Diffstat:
Mdriver/cmd/install.c | 8+++++++-
Mdriver/lib/install_links.c | 19+++++++++++++++----
2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/driver/cmd/install.c b/driver/cmd/install.c @@ -140,10 +140,16 @@ int driver_install(int argc, char** argv) { /* Validate explicit tool names up front so a typo fails before we touch the * filesystem. */ for (i = 0; i < nexplicit; ++i) { - if (driver_tool_find(explicit_tools[i]) < 0) { + int tool_index = driver_tool_find(explicit_tools[i]); + if (tool_index < 0) { driver_errf(INSTALL_TOOL, "no such tool: %s", explicit_tools[i]); goto done; } + if (driver_tool_groups((unsigned)tool_index) == 0u) { + driver_errf(INSTALL_TOOL, "tool is not installable: %s", + explicit_tools[i]); + goto done; + } } if (want_hard < 0) diff --git a/driver/lib/install_links.c b/driver/lib/install_links.c @@ -2,15 +2,22 @@ #include <stddef.h> -/* Join DIR + "/" + NAME into a freshly allocated, NUL-terminated path. Returns - * NULL on allocation failure; on success stores the allocation size in - * *out_size for driver_free. */ +/* Join DIR + "/" + NAME into a freshly allocated, NUL-terminated path. + * Windows executable aliases carry the ordinary .exe suffix so CreateProcess, + * cmd, and PowerShell all recognize them as programs; argv[0] dispatch strips + * that suffix in driver/main.c. Returns NULL on allocation failure; on success + * stores the allocation size in *out_size for driver_free. */ static char* install_join(DriverEnv* env, const char* dir, const char* name, size_t* out_size) { + static const char windows_suffix[] = ".exe"; + const char* suffix = driver_host_target().os == KIT_OS_WINDOWS + ? windows_suffix + : ""; size_t dl = driver_strlen(dir); size_t nl = driver_strlen(name); + size_t sl = driver_strlen(suffix); int slash = dl > 0 && dir[dl - 1u] != '/'; - size_t size = dl + (slash ? 1u : 0u) + nl + 1u; + size_t size = dl + (slash ? 1u : 0u) + nl + sl + 1u; size_t off; char* p = (char*)driver_alloc(env, size); if (!p) return NULL; @@ -19,6 +26,10 @@ static char* install_join(DriverEnv* env, const char* dir, const char* name, if (slash) p[off++] = '/'; driver_memcpy(p + off, name, nl); off += nl; + if (sl) { + driver_memcpy(p + off, suffix, sl); + off += sl; + } p[off] = '\0'; *out_size = size; return p;