Allow creation of a logical partition
- InstallPlan: allow source partition to be missing if size == 0
- DeltaPerformer: don't open source partition if size == 0
Also:
- DeltaPerformer: test for source_fd_ before using it
(to avoid segfault)
- Fix DeltaPerformerTest to generate payloads with correct
source sizes and paths. Previously, this works because source_path
is always set even when source_size = 0.
Bug: 124958572
Test: python system/update_engine/scripts/update_device.py <ota-img>
Test: update_engine_unittests
Change-Id: I53bda1d12accdf91e7fa616be5da562e189038d5
diff --git a/payload_consumer/install_plan.cc b/payload_consumer/install_plan.cc
index f52cd2d..2e7b6d4 100644
--- a/payload_consumer/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -98,7 +98,8 @@
bool InstallPlan::LoadPartitionsFromSlots(BootControlInterface* boot_control) {
bool result = true;
for (Partition& partition : partitions) {
- if (source_slot != BootControlInterface::kInvalidSlot) {
+ if (source_slot != BootControlInterface::kInvalidSlot &&
+ partition.source_size > 0) {
result = boot_control->GetPartitionDevice(
partition.name, source_slot, &partition.source_path) &&
result;