diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2025-06-27 13:00:49 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-27 13:00:49 -0400 |
commit | 1c78b0077bce9f0ebf7ab472ba4fa8c2c0169ff8 (patch) | |
tree | d20c23757cb68f2b8d7a23edb49af9f6ca14cc75 | |
parent | cc9f67b49f6e4d3eecdbee5f8c83733f6925540d (diff) | |
parent | 2425ef83ac7c36947ee1119399b1e4155649ed80 (diff) | |
download | stasis-1c78b0077bce9f0ebf7ab472ba4fa8c2c0169ff8.tar.gz |
Merge pull request #111 from jhunkeler/bug-fixes-again
Bug fixes again
-rw-r--r-- | src/lib/delivery/delivery.c | 13 | ||||
-rw-r--r-- | src/lib/delivery/delivery_install.c | 6 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/delivery/delivery.c b/src/lib/delivery/delivery.c index d480ab4..7ec2e04 100644 --- a/src/lib/delivery/delivery.c +++ b/src/lib/delivery/delivery.c @@ -225,7 +225,15 @@ void delivery_defer_packages(struct Delivery *ctx, int type) { // Override test->version when a version is provided by the (pip|conda)_package list item guard_free(test->version); if (spec_begin && spec_end) { - test->version = strdup(spec_end); + char *version_at = strrchr(spec_end, '@'); + if (version_at) { + if (strlen(version_at)) { + version_at++; + } + test->version = strdup(version_at); + } else { + test->version = strdup(spec_end); + } } else { // There are too many possible default branches nowadays: master, main, develop, xyz, etc. // HEAD is a safe bet. @@ -233,6 +241,9 @@ void delivery_defer_packages(struct Delivery *ctx, int type) { } // Is the list item a git+schema:// URL? + // TODO: nametmp is just the name so this will never work. but do we want it to? this looks like + // TODO: an unsafe feature. We shouldn't be able to change what's in the config. we should + // TODO: be getting what we asked for, or exit the program with an error. if (strstr(nametmp, "git+") && strstr(nametmp, "://")) { char *xrepo = strstr(nametmp, "+"); if (xrepo) { diff --git a/src/lib/delivery/delivery_install.c b/src/lib/delivery/delivery_install.c index b1de992..7badecb 100644 --- a/src/lib/delivery/delivery_install.c +++ b/src/lib/delivery/delivery_install.c @@ -305,7 +305,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha return -1; } } - snprintf(args + strlen(args), required_len, fmt, req, info->version); + snprintf(args + strlen(args), required_len + 1, fmt, req, info->version); } else { fprintf(stderr, "Deferred package '%s' is not present in the tested package list!\n", name); guard_free(args); @@ -323,7 +323,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha return -1; } } - sprintf(args + strlen(args), fmt, name); + snprintf(args + strlen(args), required_len + 1, fmt, name); } else { const char *fmt_append = "%s '%s'"; const char *fmt = " '%s'"; @@ -335,7 +335,7 @@ int delivery_install_packages(struct Delivery *ctx, char *conda_install_dir, cha return -1; } } - sprintf(args + strlen(args), fmt, name); + snprintf(args + strlen(args), required_len + 1, fmt, name); } } } |