From 834b7dd88de570c991821bda3e0890de889773b1 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 4 Jun 2026 13:34:58 -0400 Subject: delivery_conda_enable: always pin conda's version to the same version provided by the installer * Some commands upgrade conda whether it is configured to allow the behavior or not --- src/lib/delivery/delivery_conda.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/lib/delivery') diff --git a/src/lib/delivery/delivery_conda.c b/src/lib/delivery/delivery_conda.c index e1a07f1..3938842 100644 --- a/src/lib/delivery/delivery_conda.c +++ b/src/lib/delivery/delivery_conda.c @@ -120,6 +120,30 @@ void delivery_conda_enable(struct Delivery *ctx, char *conda_install_dir) { exit(1); } + char pinned[PATH_MAX]; + snprintf(pinned, sizeof(pinned), "%s/conda-meta/pinned", conda_install_dir); + touch(pinned); + if (errno == ENOENT) { + errno = 0; + } + + char *conda_version = strdup(ctx->conda.installer_version); + if (conda_version) { + char *rev = strpbrk(conda_version, "-"); + if (rev) { + *rev = '\0'; + } + + FILE *pinned_fp = fopen(pinned, "w+"); + if (!pinned_fp) { + SYSERROR("unable to open conda-meta/pinned file for writing: %s", strerror(errno)); + exit(1); + } + fprintf(pinned_fp, "conda=%s\n", conda_version); + fclose(pinned_fp); + guard_free(conda_version); + } + if (conda_capable(&ctx->conda.capabilities)) { SYSERROR("Conda capability check failed"); exit(1); -- cgit