diff --git a/VERSION b/VERSION index a3df0a6..6f4eebd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.0 +0.8.1 diff --git a/ci/tests/test.bats b/ci/tests/test.bats index dc9120d..3a62a80 100644 --- a/ci/tests/test.bats +++ b/ci/tests/test.bats @@ -81,6 +81,13 @@ EOF run_srun sh -c 'findmnt /user-environment && findmnt /user-profilers && findmnt /user-tools' } +@test "uenv_mount_list_environment_backward_compat" { + # older versions of squashfs-mount used `file://` prefix for in UENV_MOUNT_LIST + # check that if images have been mounted `uenv --uenv=...`, the slurm plugin recogines UENV_MOUNT_LIST and mounts the same images + export UENV_MOUNT_LIST="file://${SQFSDIR}/binaries.sqfs,${SQFSDIR}/profilers.sqfs:/user-profilers,file://${SQFSDIR}/tools.sqfs:/user-tools" + run_srun sh -c 'findmnt /user-environment && findmnt /user-profilers && findmnt /user-tools' +} + @test "sbatch_override_in_srun" { # check that images mounted via sbatch --uenv are overriden when `--uenv` flag is given to srun run_sbatch < do_mount(const std::vector &mount_entries) { - if (mount_entries.size() == 0) + if (mount_entries.size() == 0) { return "nothing to mount"; + } if (unshare(CLONE_NEWNS) != 0) { return util::unexpected("Failed to unshare the mount namespace"); } diff --git a/src/lib/parse_args.cpp b/src/lib/parse_args.cpp index 3bb024e..869adc1 100644 --- a/src/lib/parse_args.cpp +++ b/src/lib/parse_args.cpp @@ -16,7 +16,8 @@ namespace util { -const std::regex default_pattern("(" LINUX_ABS_FPATH ")" +const std::regex default_pattern("^(?:(file:\\/\\/))?" + "(" LINUX_ABS_FPATH ")" "(:" LINUX_ABS_FPATH ")?", std::regex::ECMAScript); // match /?:?:? @@ -72,7 +73,7 @@ parse_arg(const std::string &arg, std::optional uenv_repo_path, std::vector arguments = util::split(arg, ',', true); if (arguments.empty()) { - return util::unexpected("No mountpoints given."); + return {}; } auto get_mount_point = [](std::ssub_match sub_match) -> std::string { @@ -85,8 +86,8 @@ parse_arg(const std::string &arg, std::optional uenv_repo_path, std::vector mount_entries; for (auto &entry : arguments) { if (std::smatch match; std::regex_match(entry, match, default_pattern)) { - std::string image_path = match[1]; - std::string mount_point = get_mount_point(match[2]); + std::string image_path = match[2]; + std::string mount_point = get_mount_point(match[3]); mount_entries.emplace_back(util::mount_entry{image_path, mount_point}); } else if (std::smatch match; std::regex_match(entry, match, repo_pattern)) { diff --git a/src/plugin.cpp b/src/plugin.cpp index 82c1966..2ff0259 100644 --- a/src/plugin.cpp +++ b/src/plugin.cpp @@ -163,7 +163,9 @@ int init_post_opt_remote(spank_t sp, auto abs_mount = *util::realpath(entry.mount_point); env_var += "file://" + abs_image + ":" + abs_mount + ","; } - spank_setenv(sp, UENV_MOUNT_LIST, env_var.c_str(), 1); + if (mount_entries.size() > 0) { + spank_setenv(sp, UENV_MOUNT_LIST, env_var.c_str(), 1); + } return ESPANK_SUCCESS; }