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

pull/80/head
cfig 4 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 entry.statMode = itemConfig[0].statMode
} }
else -> { else -> {
//Issue #73: https://github.com/cfig/Android_boot_image_editor/issues/73 //Issue #75: https://github.com/cfig/Android_boot_image_editor/issues/75
//Reason: cpio may have multiple entries with the same name, that's ugly! //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") throw IllegalArgumentException("${entry.name} has multiple exact-match fsConfig, " +
log.warn("${entry.name} has multiple exact-match fsConfig") "check https://github.com/cfig/Android_boot_image_editor/issues/75")
entry.statMode = itemConfig[0].statMode
} }
} }
} }

@ -2,32 +2,41 @@ package bcb
import cfig.bcb.VirtualABMsg import cfig.bcb.VirtualABMsg
import cfig.bootimg.Common.Companion.deleleIfExists import cfig.bootimg.Common.Companion.deleleIfExists
import cfig.helper.Helper
import cfig.helper.Helper.Companion.check_call import cfig.helper.Helper.Companion.check_call
import org.junit.After import org.apache.commons.exec.CommandLine
import org.junit.Before import org.junit.*
import org.junit.Ignore
import org.junit.Test
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import java.io.File import java.io.File
import java.io.FileInputStream import java.io.FileInputStream
import java.io.IOException
class VirtualABMsgTest { class VirtualABMsgTest {
private val log = LoggerFactory.getLogger(VirtualABMsgTest::class.java) private val log = LoggerFactory.getLogger(VirtualABMsgTest::class.java)
@Before @Before
fun setUp() { 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 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 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() "adb pull /data/vendor/debug.misc".check_call()
} }
@Test @Test
@Ignore
fun parseVAB() { fun parseVAB() {
val vab = VirtualABMsg(FileInputStream("debug.misc")) FileInputStream("debug.misc").use {
log.info("VAB msg: $vab") val vab = VirtualABMsg(it)
log.info("VAB msg: $vab")
}
} }
@After @After

Loading…
Cancel
Save