fix(spoof): propagate read errors out of mergedContents

A read failure (partial-write race during user edit, SELinux
denial, or any other IOException) used to fall through the
runCatching and rewrite the file with only the global block,
silently destroying every existing [pkg] override. Drop the
runCatching so the failure bubbles to atomicWrite, where the M3
guard in updateTo logs and returns without applyToProps, leaving
both file and props untouched.
This commit is contained in:
Enginex0
2026-05-19 05:35:13 +01:00
parent 52ff39d130
commit 1446090da9
@@ -146,9 +146,7 @@ object PatchLevelManager {
private fun mergedContents(target: File, date: String): String {
val globalBlock = "system=$date\nboot=$date\nvendor=$date\n"
if (!target.exists()) return globalBlock
val tail =
runCatching { stripGlobalAssignments(target.readLines()) }.getOrNull()
?: return globalBlock
val tail = stripGlobalAssignments(target.readLines())
if (tail.isEmpty()) return globalBlock
return globalBlock + tail.joinToString("\n", prefix = "\n", postfix = "\n")
}