Fix installer backend crash issue 79/118779/2
authorJunghyun Yeon <jungh.yeon@samsung.com>
Tue, 14 Mar 2017 05:00:23 +0000 (14:00 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Fri, 17 Mar 2017 08:19:53 +0000 (01:19 -0700)
- Backend has crashed with some install cases while
undo StepUpdateApplication after failed to update app.
- It caused because old manifest data doesn't set properly.
- Fix it by checking manifest before use and
not performing undo() in some update cases

Change-Id: Ib0f10f151ef8ea87ada839bb897e081f2f8ecb33
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/pkgmgr_registration.cc
src/common/step/pkgmgr/step_update_app.cc

index f19d208..6fbc94c 100644 (file)
@@ -81,6 +81,9 @@ bool RegisterCertificates(
 // "removable" : this package can be removed.
 // "readonly" : this package exists in readonly location.
 bool AssignPackageTags(manifest_x* manifest) {
+  if (!manifest)
+    return false;
+
   // preload, removalbe and readonly : in parse_preload step.
   if (manifest->preload && !strcmp(manifest->preload, "true")) {
     if (manifest->removable && !strcmp(manifest->removable, "false"))
index af90d09..57129c4 100644 (file)
@@ -40,6 +40,11 @@ Step::Status StepUpdateApplication::process() {
 }
 
 Step::Status StepUpdateApplication::undo() {
+  RequestType req_type = context_->request_type.get();
+  if (req_type == RequestType::ManifestDirectUpdate ||
+      req_type == RequestType::ManifestPartialUpdate)
+    return Status::OK;
+
   // Prepare certification info for revert
   std::string base64 = QueryCertificateAuthorCertificate(context_->pkgid.get(),
                                                          context_->uid.get());