aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-11-13 00:54:27 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-11-13 00:54:27 -0500
commit233e06aff49a8a4603814cd6c1c0e62167518e2b (patch)
tree13ac78b811a36b872c69aabd583fb7dad1bbff37
parent47c74c23d5a04c4a6d22276e99d0e486a9a8f151 (diff)
downloadstasis-233e06aff49a8a4603814cd6c1c0e62167518e2b.tar.gz
When conda's prefix is too long, die.
-rw-r--r--src/cli/stasis/stasis_main.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c
index e188b2e..2a2ed3b 100644
--- a/src/cli/stasis/stasis_main.c
+++ b/src/cli/stasis/stasis_main.c
@@ -225,14 +225,6 @@ int main(int argc, char *argv[]) {
exit(1);
}
- msg(STASIS_MSG_L1, "Conda setup\n");
- delivery_get_conda_installer_url(&ctx, installer_url);
- msg(STASIS_MSG_L2, "Downloading: %s\n", installer_url);
- if (delivery_get_conda_installer(&ctx, installer_url)) {
- msg(STASIS_MSG_ERROR, "download failed: %s\n", installer_url);
- exit(1);
- }
-
// Unlikely to occur: this should help prevent rmtree() from destroying your entire filesystem
// if path is "/" then, die
// or if empty string, die
@@ -241,6 +233,30 @@ int main(int argc, char *argv[]) {
exit(1);
}
+ // 2 = #!
+ // 5 = /bin\n
+ const size_t prefix_len = strlen(ctx.storage.conda_install_prefix) + 2 + 5;
+ const size_t prefix_len_max = 127;
+ msg(STASIS_MSG_L1, "Checking length of conda installation prefix\n");
+ if (!strcmp(ctx.system.platform[DELIVERY_PLATFORM], "Linux") && prefix_len > prefix_len_max) {
+ msg(STASIS_MSG_L2 | STASIS_MSG_ERROR,
+ "The shebang, '#!%s/bin/python\\n' is too long (%zu > %zu).\n",
+ ctx.storage.conda_install_prefix, prefix_len, prefix_len_max);
+ msg(STASIS_MSG_L2 | STASIS_MSG_ERROR,
+ "Conda's workaround to handle long path names does not work consistently within STASIS.\n");
+ msg(STASIS_MSG_L2 | STASIS_MSG_ERROR,
+ "Please try again from a different, \"shorter\", directory.\n");
+ exit(1);
+ }
+
+ msg(STASIS_MSG_L1, "Conda setup\n");
+ delivery_get_conda_installer_url(&ctx, installer_url);
+ msg(STASIS_MSG_L2, "Downloading: %s\n", installer_url);
+ if (delivery_get_conda_installer(&ctx, installer_url)) {
+ msg(STASIS_MSG_ERROR, "download failed: %s\n", installer_url);
+ exit(1);
+ }
+
msg(STASIS_MSG_L2, "Installing: %s\n", ctx.conda.installer_name);
delivery_install_conda(ctx.conda.installer_path, ctx.storage.conda_install_prefix);