From 8477ef0afa4eb5f739b7a10795fdf08f11d2f414 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 13 Feb 2026 16:19:57 -0500 Subject: Fix memory leak when reading a comment --- src/lib/core/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/core/utils.c b/src/lib/core/utils.c index 2cfebdf..00d747f 100644 --- a/src/lib/core/utils.c +++ b/src/lib/core/utils.c @@ -1017,6 +1017,7 @@ static int read_vcs_records(const size_t line, char **data) { // Ignore file comment(s) if (startswith(data_local, "#") || startswith(data_local, ";")) { // continue + guard_free(data_local); return 1; } -- cgit From 301815e7532aa3828fd3c6aa0688adac3509297d Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 13 Feb 2026 16:20:49 -0500 Subject: Install cibuildwheel --- src/cli/stasis/stasis_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c index 44ee6d7..633d014 100644 --- a/src/cli/stasis/stasis_main.c +++ b/src/cli/stasis/stasis_main.c @@ -309,6 +309,10 @@ static void install_build_package() { msg(STASIS_MSG_ERROR | STASIS_MSG_L2, "'build' tool installation failed\n"); exit(1); } + if (pip_exec("install cibuildwheel")) { + msg(STASIS_MSG_ERROR | STASIS_MSG_L2, "'cibuildwheel' tool installation failed\n"); + exit(1); + } } static void configure_package_overlay(struct Delivery *ctx, const char *env_name) { -- cgit From 6dd938bad2a88adf28bd3fd15cbb71076065081d Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 13 Feb 2026 16:21:27 -0500 Subject: Tentative solution for building wheels on modern OSes --- src/lib/delivery/delivery_build.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/delivery/delivery_build.c b/src/lib/delivery/delivery_build.c index c5093d4..5edcb6d 100644 --- a/src/lib/delivery/delivery_build.c +++ b/src/lib/delivery/delivery_build.c @@ -168,10 +168,9 @@ struct StrList *delivery_build_wheels(struct Delivery *ctx) { if (!pushd(srcdir)) { char dname[NAME_MAX]; char outdir[PATH_MAX]; - char cmd[PATH_MAX * 2]; + char *cmd = NULL; memset(dname, 0, sizeof(dname)); memset(outdir, 0, sizeof(outdir)); - memset(cmd, 0, sizeof(outdir)); const int dep_status = check_python_package_dependencies("."); if (dep_status) { @@ -194,11 +193,18 @@ struct StrList *delivery_build_wheels(struct Delivery *ctx) { return NULL; } - sprintf(cmd, "-m build -w -o %s", outdir); + if (!strcmp(ctx->system.platform[DELIVERY_PLATFORM], "Linux")) { + asprintf(&cmd, "-m cibuildwheel --output-dir %s --only cp%s-manylinux_%s", outdir, ctx->meta.python_compact, ctx->system.arch); + } else { + asprintf(&cmd, "-m cibuildwheel --output-dir %s", outdir); + } + + //sprintf(cmd, "-m build -w -o %s", outdir); if (python_exec(cmd)) { fprintf(stderr, "failed to generate wheel package for %s-%s\n", ctx->tests[i].name, ctx->tests[i].version); guard_strlist_free(&result); + guard_free(cmd); return NULL; } popd(); -- cgit From 5a79c9d0bcc8ec9de216dca49cf160d38f3c6118 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 13 Feb 2026 17:01:07 -0500 Subject: Only utilize cibuildwheel on linux --- src/lib/delivery/delivery_build.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/delivery/delivery_build.c b/src/lib/delivery/delivery_build.c index 5edcb6d..d1239e4 100644 --- a/src/lib/delivery/delivery_build.c +++ b/src/lib/delivery/delivery_build.c @@ -196,10 +196,9 @@ struct StrList *delivery_build_wheels(struct Delivery *ctx) { if (!strcmp(ctx->system.platform[DELIVERY_PLATFORM], "Linux")) { asprintf(&cmd, "-m cibuildwheel --output-dir %s --only cp%s-manylinux_%s", outdir, ctx->meta.python_compact, ctx->system.arch); } else { - asprintf(&cmd, "-m cibuildwheel --output-dir %s", outdir); + asprintf(&cmd, "-m build -w -o %s", outdir); } - //sprintf(cmd, "-m build -w -o %s", outdir); if (python_exec(cmd)) { fprintf(stderr, "failed to generate wheel package for %s-%s\n", ctx->tests[i].name, ctx->tests[i].version); -- cgit From bddde6dde420ae9d0bc6d8c2ad6865de7e90c73e Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 18 Feb 2026 18:02:11 -0500 Subject: Error checking and sequencing * Add error checks for allocations * Check docker is usable on Linux, if not fall back to the host tools * check_system_requirements initializes the docker capabilities struct --- src/cli/stasis/system_requirements.c | 16 ++++++++-------- src/lib/delivery/delivery_build.c | 17 +++++++++++++---- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/cli/stasis/system_requirements.c b/src/cli/stasis/system_requirements.c index d8d7df3..cb0ebd5 100644 --- a/src/cli/stasis/system_requirements.c +++ b/src/cli/stasis/system_requirements.c @@ -38,18 +38,18 @@ void check_system_requirements(struct Delivery *ctx) { delivery_init_tmpdir(ctx); } - struct DockerCapabilities dcap; - if (!docker_capable(&dcap)) { + if (!docker_capable(&ctx->deploy.docker.capabilities)) { + struct DockerCapabilities *dcap = &ctx->deploy.docker.capabilities; msg(STASIS_MSG_L2 | STASIS_MSG_WARN, "Docker is broken\n"); - msg(STASIS_MSG_L3, "Available: %s\n", dcap.available ? "Yes" : "No"); - msg(STASIS_MSG_L3, "Usable: %s\n", dcap.usable ? "Yes" : "No"); - msg(STASIS_MSG_L3, "Podman [Docker Emulation]: %s\n", dcap.podman ? "Yes" : "No"); + msg(STASIS_MSG_L3, "Available: %s\n", dcap->available ? "Yes" : "No"); + msg(STASIS_MSG_L3, "Usable: %s\n", dcap->usable ? "Yes" : "No"); + msg(STASIS_MSG_L3, "Podman [Docker Emulation]: %s\n", dcap->podman ? "Yes" : "No"); msg(STASIS_MSG_L3, "Build plugin(s): "); - if (dcap.usable) { - if (dcap.build & STASIS_DOCKER_BUILD) { + if (dcap->usable) { + if (dcap->build & STASIS_DOCKER_BUILD) { printf("build "); } - if (dcap.build & STASIS_DOCKER_BUILD_X) { + if (dcap->build & STASIS_DOCKER_BUILD_X) { printf("buildx "); } puts(""); diff --git a/src/lib/delivery/delivery_build.c b/src/lib/delivery/delivery_build.c index d1239e4..2f31b33 100644 --- a/src/lib/delivery/delivery_build.c +++ b/src/lib/delivery/delivery_build.c @@ -193,10 +193,19 @@ struct StrList *delivery_build_wheels(struct Delivery *ctx) { return NULL; } - if (!strcmp(ctx->system.platform[DELIVERY_PLATFORM], "Linux")) { - asprintf(&cmd, "-m cibuildwheel --output-dir %s --only cp%s-manylinux_%s", outdir, ctx->meta.python_compact, ctx->system.arch); - } else { - asprintf(&cmd, "-m build -w -o %s", outdir); + if (asprintf(&cmd, "-m build -w -o %s", outdir) < 0) { + SYSERROR("%s", "Unable to allocate memory for build command"); + return NULL; + } + if (!strcmp(ctx->system.platform[DELIVERY_PLATFORM], "Linux") + && globals.enable_docker + && ctx->deploy.docker.capabilities.usable) { + guard_free(cmd); + if (asprintf(&cmd, "-m cibuildwheel --output-dir %s --only cp%s-manylinux_%s", + outdir, ctx->meta.python_compact, ctx->system.arch) < 0) { + SYSERROR("%s", "Unable to allocate memory for cibuildwheel command"); + return NULL; + } } if (python_exec(cmd)) { -- cgit