diff --git a/libraries/internal/src/main/kotlin/org/foedusprogramme/alexandrite/internal/floor/Floor.kt b/libraries/internal/src/main/kotlin/org/foedusprogramme/alexandrite/internal/floor/Floor.kt index 90640b69..56c3f07a 100644 --- a/libraries/internal/src/main/kotlin/org/foedusprogramme/alexandrite/internal/floor/Floor.kt +++ b/libraries/internal/src/main/kotlin/org/foedusprogramme/alexandrite/internal/floor/Floor.kt @@ -189,7 +189,16 @@ private fun isMagic(path: CanonicalPath): Boolean { private fun standardRoots(home: Path?, environment: Map): List = home?.let { CREDENTIAL_STORES.map { (name, kind) -> DenyRoot(home.resolve(name), kind) } }.orEmpty() + movedStores(environment) + - DenyRoot(Path.of("/dev"), "devices") + DEVICES + +/** + * The device tree, on the hosts that have one. + * + * `/dev` is the device tree of a POSIX system and means nothing on a host without one: there it names a path that has + * no root of its own, which no check can canonicalize. + */ +private val DEVICES: List = + if (java.io.File.separatorChar == '/') listOf(DenyRoot(Path.of("/dev"), "devices")) else emptyList() /** The credential stores at the absolute places that the variables of [environment] name. */ private fun movedStores(environment: Map): List {