Skip to content

A rootless Android app that boots Alpine Linux: run containers (Podman/Docker/LXC) and GUI desktop apps.

fix(avf): report real 9p errors and set the smoke test's parameters

ExTv8f3e4d81a53c
diff --git a/app/src/main/java/com/excp/podroid/engine/avf/AvfDiagnostics.kt b/app/src/main/java/com/excp/podroid/engine/avf/AvfDiagnostics.kt
index 5fd34d6..8ed6a3f 100644
--- a/app/src/main/java/com/excp/podroid/engine/avf/AvfDiagnostics.kt
+++ b/app/src/main/java/com/excp/podroid/engine/avf/AvfDiagnostics.kt
@@ -256,7 +256,7 @@ object AvfDiagnostics {
invokeSetter(builderCls, builder, "setKernelPath", String::class.java, kernelPath)
invokeSetter(builderCls, builder, "setInitrdPath", String::class.java, initrdPath)
runCatching {
- invokeSetter(builderCls, builder, "setParams", String::class.java, "console=hvc0 panic=1")
+ AvfReflect.addParams(builder, "console=hvc0 panic=1")
}
val buildM = builderCls.getDeclaredMethod("build").apply { isAccessible = true }
return buildM.invoke(builder)
diff --git a/app/src/main/java/com/excp/podroid/engine/avf/ninep/Ninep2000LServer.kt b/app/src/main/java/com/excp/podroid/engine/avf/ninep/Ninep2000LServer.kt
index d75ccd5..e413757 100644
--- a/app/src/main/java/com/excp/podroid/engine/avf/ninep/Ninep2000LServer.kt
+++ b/app/src/main/java/com/excp/podroid/engine/avf/ninep/Ninep2000LServer.kt
@@ -9,8 +9,10 @@ import java.io.InputStream
import java.io.OutputStream
import java.nio.ByteBuffer
import java.nio.channels.FileChannel
+import java.nio.file.DirectoryNotEmptyException
import java.nio.file.FileAlreadyExistsException
import java.nio.file.Files
+import java.nio.file.NoSuchFileException
import java.nio.file.StandardCopyOption
import java.nio.file.StandardOpenOption
import java.nio.file.attribute.BasicFileAttributeView
@@ -40,6 +42,7 @@ private const val S_IFLNK = 0xA000L
private const val ENOENT = 2
private const val EIO = 5
private const val EEXIST = 17
+private const val ENOTEMPTY = 39
private const val EOPNOTSUPP = 95
/** P9_GETATTR_BASIC: the field set filled in by Rgetattr below. */
@@ -424,6 +427,9 @@ class Ninep2000LServer(
} catch (e: FileAlreadyExistsException) {
replyError(frame.tag, output, EEXIST)
return
+ } catch (e: NoSuchFileException) {
+ replyError(frame.tag, output, ENOENT)
+ return
} catch (e: Exception) {
replyError(frame.tag, output, EIO)
return
@@ -624,6 +630,9 @@ class Ninep2000LServer(
} catch (e: FileAlreadyExistsException) {
replyError(frame.tag, output, EEXIST)
return
+ } catch (e: NoSuchFileException) {
+ replyError(frame.tag, output, ENOENT)
+ return
} catch (e: IOException) {
replyError(frame.tag, output, EIO)
return
@@ -661,6 +670,9 @@ class Ninep2000LServer(
replyError(frame.tag, output, ENOENT)
return
}
+ } catch (e: DirectoryNotEmptyException) {
+ replyError(frame.tag, output, ENOTEMPTY)
+ return
} catch (e: IOException) {
replyError(frame.tag, output, EIO)
return
@@ -710,6 +722,12 @@ class Ninep2000LServer(
try {
Files.move(source.toPath(), target.toPath(), StandardCopyOption.REPLACE_EXISTING)
+ } catch (e: NoSuchFileException) {
+ replyError(frame.tag, output, ENOENT)
+ return
+ } catch (e: DirectoryNotEmptyException) {
+ replyError(frame.tag, output, ENOTEMPTY)
+ return
} catch (e: IOException) {
replyError(frame.tag, output, EIO)
return