Skip to content

Commit d63d7c8

Browse files
committed
fixup! vfs fetch errors
Signed-off-by: Sam Gammon <[email protected]>
1 parent 7833338 commit d63d7c8

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

packages/cli/src/main/kotlin/elide/tool/cli/cmd/repl/ToolShellCommand.kt

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent
2222
import ch.qos.logback.core.ConsoleAppender
2323
import io.micronaut.core.annotation.Introspected
2424
import io.micronaut.core.io.IOUtils
25+
import org.graalvm.nativeimage.ImageInfo
2526
import org.graalvm.polyglot.PolyglotException
2627
import org.graalvm.polyglot.Source
2728
import org.graalvm.polyglot.Value

packages/graalvm/src/main/kotlin/elide/runtime/gvm/internals/vfs/AbstractDelegateVFS.kt

+12-10
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,21 @@ public abstract class AbstractDelegateVFS<VFS> protected constructor (
240240

241241
override fun readAttributes(path: Path, attributes: String, vararg options: LinkOption): MutableMap<String, Any> {
242242
enforce(type = AccessType.READ, domain = AccessDomain.GUEST, path = path)
243-
val getter = {
244-
debugLog { "Reading attributes for file at path: '$path'" }
245-
backing.provider().readAttributes(path, attributes, *options).toMutableMap().apply {
246-
if (containsKey("ino")) {
247-
// fix: convert `ino` to `long`, which gvm filesystems expect
248-
this["ino"] = when (val ino = this["ino"]) {
249-
is Int -> ino.toLong()
250-
else -> ino
251-
}
243+
val cached = attributesCache.getIfPresent(path to attributes)
244+
if (cached != null) {
245+
return cached
246+
}
247+
return backing.provider().readAttributes(path, attributes, *options).toMutableMap().apply {
248+
if (containsKey("ino")) {
249+
// fix: convert `ino` to `long`, which gvm filesystems expect
250+
this["ino"] = when (val ino = this["ino"]) {
251+
is Int -> ino.toLong()
252+
else -> ino
252253
}
253254
}
255+
}.also {
256+
attributesCache.put(path to attributes, it)
254257
}
255-
return attributesCache.get(path to attributes, getter)
256258
}
257259

258260
override fun setAttribute(path: Path, attribute: String, value: Any, vararg options: LinkOption) {

0 commit comments

Comments
 (0)