Issue #75: do not alllow duplicated fsconfig when packing cpio

pull/80/head
cfig 3 years ago
parent a358bd6a7b
commit 7a783acb27
No known key found for this signature in database
GPG Key ID: B104C307F0FDABB7

@ -147,11 +147,10 @@ class AndroidCpio {
entry.statMode = itemConfig[0].statMode
}
else -> {
//Issue #73: https://github.com/cfig/Android_boot_image_editor/issues/73
//Reason: cpio may have multiple entries with the same name, that's ugly!
//throw IllegalArgumentException("${entry.name} has multiple exact-match fsConfig")
log.warn("${entry.name} has multiple exact-match fsConfig")
entry.statMode = itemConfig[0].statMode
//Issue #75: https://github.com/cfig/Android_boot_image_editor/issues/75
//Reason: cpio may have multiple entries with the same name, that's caused by man-made errors
throw IllegalArgumentException("${entry.name} has multiple exact-match fsConfig, " +
"check https://github.com/cfig/Android_boot_image_editor/issues/75")
}
}
}

@ -2,32 +2,41 @@ package bcb
import cfig.bcb.VirtualABMsg
import cfig.bootimg.Common.Companion.deleleIfExists
import cfig.helper.Helper
import cfig.helper.Helper.Companion.check_call
import org.junit.After
import org.junit.Before
import org.apache.commons.exec.CommandLine
import org.junit.*
import org.junit.Ignore
import org.junit.Test
import org.slf4j.LoggerFactory
import java.io.File
import java.io.FileInputStream
import java.io.IOException
class VirtualABMsgTest {
private val log = LoggerFactory.getLogger(VirtualABMsgTest::class.java)
@Before
fun setUp() {
"adb root".check_call()
Assume.assumeTrue(
try {
"adb --version".check_call()
true
} catch (e: IOException) {
false
}
)
Assume.assumeTrue(Helper.powerRun3(CommandLine.parse("adb root"), null)[0] as Boolean)
"adb wait-for-device".check_call()
"adb shell dd if=/dev/block/by-name/misc of=/data/vendor/debug.misc skip=512 bs=64 count=1".check_call()
"adb pull /data/vendor/debug.misc".check_call()
}
@Test
@Ignore
fun parseVAB() {
val vab = VirtualABMsg(FileInputStream("debug.misc"))
log.info("VAB msg: $vab")
FileInputStream("debug.misc").use {
val vab = VirtualABMsg(it)
log.info("VAB msg: $vab")
}
}
@After

Loading…
Cancel
Save