Skip to content

Commit 2d4e421

Browse files
don't allow empty --uenv='' or --uenv=[,]*
1 parent 0842d0d commit 2d4e421

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

ci/tests/test.bats

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,13 @@ EOF
111111
run_srun_unchecked --uenv=a:b:c:/user-tools true
112112
assert_output --partial 'Invalid syntax for --uenv'
113113
}
114+
115+
@test "empty_argument1" {
116+
run_srun_unchecked --uenv='' true
117+
assert_output --partial 'No mountpoints given.'
118+
}
119+
120+
@test "empty_argument2" {
121+
run_srun_unchecked --uenv=,,, true
122+
assert_output --partial 'No mountpoints given.'
123+
}

src/parse_args.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ parse_arg(const std::string &arg) {
4242
std::vector<mount_entry> entries;
4343
std::vector<std::string> arguments = split(arg, ',');
4444

45+
if(arguments.empty()) {
46+
return util::unexpected("No mountpoints given.");
47+
}
48+
4549
for (auto &entry : arguments) {
4650
std::smatch match_pieces;
4751
if (std::regex_match(entry, match_pieces, protocol_pattern)) {

src/parser.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)