Skip dependency ckecking when backend has executed as root 19/211719/1
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 8 Aug 2019 08:59:36 +0000 (17:59 +0900)
committerJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 8 Aug 2019 08:59:36 +0000 (17:59 +0900)
Change-Id: I42a89ac1d5cc17d754c6580b9c650cad18473e01
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/step/pkgmgr/step_check_installable.cc
src/common/step/pkgmgr/step_check_removable.cc
src/common/step/pkgmgr/step_check_upgradable.cc

index d02c6d7..7e5f647 100644 (file)
@@ -8,6 +8,7 @@
 #include <pkgmgr-info.h>
 #include <sys/types.h>
 #include <tzplatform_config.h>
+#include <unistd.h>
 
 #include <string>
 #include <vector>
@@ -57,6 +58,10 @@ Step::Status StepCheckInstallable::process() {
     }
   }
 
+  // Don't check dependency if backend has executed as root
+  if (getuid () == 0)
+    return Status::OK;
+
   bool installable = true;
   manifest_x* manifest = context_->manifest_data.get();
   for (const auto& dep : GListRange<dependency_x*>(manifest->dependencies)) {
index 2ee4627..e9e92ca 100644 (file)
@@ -4,6 +4,9 @@
 
 #include "common/step/pkgmgr/step_check_removable.h"
 
+#include <sys/types.h>
+#include <unistd.h>
+
 #include <string>
 #include <vector>
 
@@ -32,6 +35,10 @@ Step::Status StepCheckRemovable::process() {
     return Status::OPERATION_NOT_ALLOWED;
   }
 
+  // Don't check dependency if backend has executed as root
+  if (getuid() == 0)
+    return Status::OK;
+
   std::vector<PkgQueryInterface::DependencyInfo> depends_on;
   if (!pkg_query.PackagesDependsOn(&depends_on))
     return Status::INVALID_VALUE;
index 0e1a7ec..aad7a3e 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <manifest_parser/utils/version_number.h>
 #include <pkgmgrinfo_basic.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include <string>
 #include <vector>
@@ -34,6 +36,10 @@ Step::Status StepCheckUpgradable::process() {
     return Status::INVALID_VALUE;
   }
 
+  // Don't check dependency if backend has executed as root
+  if (getuid() == 0)
+    return Status::OK;
+
   std::vector<PkgQueryInterface::DependencyInfo> depends_on;
   if (!pkg_query.PackagesDependsOn(&depends_on))
     return Status::INVALID_VALUE;