Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,9 @@ public void launchContainer(ContainerRuntimeContext ctx)
}
runCommand.addMountLocation(src, dst, mode);
}
long commaCount = environment.get(ENV_DOCKER_CONTAINER_MOUNTS).chars()
.filter(c -> c == ',').count();
if (mountCount != commaCount + 1) {
long semicolonCount = environment.get(ENV_DOCKER_CONTAINER_MOUNTS).chars()
.filter(c -> c == ';').count();
if (mountCount != semicolonCount + 1) {
// this means the matcher skipped an improperly formatted mount
throw new ContainerExecutionException(
"Unable to parse some mounts in user supplied mount list: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public abstract class OCIContainerRuntime implements LinuxContainerRuntime {
private static final Pattern HOSTNAME_PATTERN = Pattern.compile(
"^[a-zA-Z0-9][a-zA-Z0-9_.-]+$");
static final Pattern USER_MOUNT_PATTERN = Pattern.compile(
"(?<=^|,)([^:\\x00]+):([^:\\x00]+)" +
"(:(r[ow]|(r[ow][+])?(r?shared|r?slave|r?private)))?(?:,|$)");
"(?<=^|;)([^:\\x00]+):([^:\\x00]+)" +
"(:(r[ow]|(r[ow][+])?(r?shared|r?slave|r?private)))?(?:;|$)");
static final Pattern TMPFS_MOUNT_PATTERN = Pattern.compile(
"^/[^:\\x00]+$");
static final String PORTS_MAPPING_PATTERN =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ public void testMountMultiple()

env.put(
DockerLinuxContainerRuntime.ENV_DOCKER_CONTAINER_MOUNTS,
"test_dir/test_resource_file:test_mount1:ro," +
"test_dir/test_resource_file:test_mount1:ro;" +
"test_dir/test_resource_file:test_mount2:ro");

runtime.launchContainer(builder.build());
Expand Down Expand Up @@ -1395,8 +1395,8 @@ public void testUserMounts()

env.put(
DockerLinuxContainerRuntime.ENV_DOCKER_CONTAINER_MOUNTS,
"/tmp/foo:/tmp/foo:ro,/tmp/bar:/tmp/bar:rw,/tmp/baz:/tmp/baz," +
"/a:/a:shared,/b:/b:ro+shared,/c:/c:rw+rshared,/d:/d:private");
"/tmp/foo:/tmp/foo:ro;/tmp/bar:/tmp/bar:rw;/tmp/baz:/tmp/baz;" +
"/a:/a:shared;/b:/b:ro+shared;/c:/c:rw+rshared;/d:/d:private");

runtime.launchContainer(builder.build());
List<String> dockerCommands = readDockerCommands();
Expand Down Expand Up @@ -1444,7 +1444,7 @@ public void testUserMountInvalid() throws ContainerExecutionException {

env.put(
DockerLinuxContainerRuntime.ENV_DOCKER_CONTAINER_MOUNTS,
"/source:target:ro,/source:target:other,/source:target:rw");
"/source:target:ro;/source:target:other;/source:target:rw");

try {
runtime.launchContainer(builder.build());
Expand Down