From 499310f3a00364fb68a744540f5474e865f48bc4 Mon Sep 17 00:00:00 2001 From: Damian Pietruchowski Date: Mon, 9 Oct 2017 11:38:01 +0200 Subject: [PATCH] Replace pkg_path with GetPkgPath() method in InstallerContext pkg_path is always equal to root_application_path + pkgid. Storing this information in separate variable is problematic, because it requires to remember to update pkg_path after root_application_path or pkgid is changed. Submit with: - https://review.tizen.org/gerrit/#/c/160353/ - https://review.tizen.org/gerrit/#/c/154904/ Change-Id: I8cc45cd003a642225be88669360b540186f8c678 Signed-off-by: Damian Pietruchowski --- src/common/installer_context.h | 22 ++++++------ src/common/step/backup/step_copy_backup.cc | 17 ++++----- src/common/step/configuration/step_configure.cc | 15 ++------ .../step/configuration/step_parse_manifest.cc | 14 +++----- .../step_change_ownership_and_permission.cc | 6 ++-- src/common/step/filesystem/step_copy.cc | 10 ++---- .../filesystem/step_copy_storage_directories.cc | 8 ++--- src/common/step/filesystem/step_copy_tep.cc | 6 +--- .../filesystem/step_create_storage_directories.cc | 4 +-- .../filesystem/step_create_storage_directories.h | 2 +- .../step_migrate_legacy_external_image.cc | 8 ++--- .../step/filesystem/step_move_installed_storage.cc | 4 +-- .../step/filesystem/step_recover_change_owner.cc | 8 ++--- .../filesystem/step_recover_external_storage.cc | 2 +- src/common/step/filesystem/step_recover_files.cc | 42 +++++----------------- src/common/step/filesystem/step_recover_files.h | 3 -- .../filesystem/step_recover_storage_directories.cc | 8 ++--- src/common/step/filesystem/step_remove_files.cc | 6 ++-- .../step/filesystem/step_remove_zip_image.cc | 2 +- .../filesystem/step_update_storage_directories.cc | 2 +- src/common/step/filesystem/step_update_tep.cc | 2 +- src/common/step/mount/step_mount_install.cc | 13 +++---- src/common/step/mount/step_mount_recover.cc | 6 ++-- src/common/step/mount/step_mount_update.cc | 15 ++++---- src/common/step/pkgmgr/step_check_force_clean.cc | 1 - src/common/step/rds/step_rds_modify.cc | 12 ++++--- src/common/step/security/step_recover_security.cc | 8 ++--- src/common/step/security/step_register_security.cc | 10 +++--- .../step/security/step_register_trust_anchor.cc | 4 +-- .../step_rollback_deinstallation_security.cc | 4 +-- src/common/step/security/step_update_security.cc | 8 ++--- 31 files changed, 109 insertions(+), 163 deletions(-) diff --git a/src/common/installer_context.h b/src/common/installer_context.h index 07620dd..a45f01c 100644 --- a/src/common/installer_context.h +++ b/src/common/installer_context.h @@ -180,6 +180,18 @@ class InstallerContext { ~InstallerContext(); /** + * \brief Returns package directory path containing app data + */ + inline boost::filesystem::path GetPkgPath() const { + return root_application_path.get() / pkgid.get(); + } + + /** + * \brief path to final location of installed package in filesystem + */ + Property pkgid; + + /** * \brief package type (string representing name of backend) */ Property pkg_type; @@ -218,16 +230,6 @@ class InstallerContext { Property backup_xml_path; /** - * \brief path to final location of installed package in filesystem - */ - Property pkgid; - - /** - * \brief package directory path containing app data - */ - Property pkg_path; - - /** * \brief file path used for installation or reinstallation process */ Property file_path; diff --git a/src/common/step/backup/step_copy_backup.cc b/src/common/step/backup/step_copy_backup.cc index 05805f7..4319f21 100644 --- a/src/common/step/backup/step_copy_backup.cc +++ b/src/common/step/backup/step_copy_backup.cc @@ -39,11 +39,8 @@ Step::Status StepCopyBackup::precheck() { return Step::Status::INVALID_VALUE; } - // set package path - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); - install_path_ = context_->pkg_path.get(); - backup_path_ = GetBackupPathForPackagePath(context_->pkg_path.get()); + install_path_ = context_->GetPkgPath(); + backup_path_ = GetBackupPathForPackagePath(context_->GetPkgPath()); return Status::OK; } @@ -103,7 +100,7 @@ bool StepCopyBackup::Backup() { } } // create copy of old package content skipping the external memory mount point - for (bf::directory_iterator iter(context_->pkg_path.get()); + for (bf::directory_iterator iter(context_->GetPkgPath()); iter != bf::directory_iterator(); ++iter) { if (iter->path().filename() == kExternalMemoryMountPoint) continue; @@ -214,20 +211,20 @@ bool StepCopyBackup::CleanBackupDirectory() { bool StepCopyBackup::RollbackApplicationDirectory() { bs::error_code error; - if (bf::exists(context_->pkg_path.get())) { - bf::remove_all(context_->pkg_path.get(), error); + if (bf::exists(context_->GetPkgPath())) { + bf::remove_all(context_->GetPkgPath(), error); if (error) { return false; } } - if (!MoveDir(backup_path_, context_->pkg_path.get())) { + if (!MoveDir(backup_path_, context_->GetPkgPath())) { return false; } uid_t uid = context_->uid.get(); // restore ownership changed during installation - if (!SetPackageDirectoryOwnerAndPermissions(context_->pkg_path.get(), uid)) + if (!SetPackageDirectoryOwnerAndPermissions(context_->GetPkgPath(), uid)) return false; return true; diff --git a/src/common/step/configuration/step_configure.cc b/src/common/step/configuration/step_configure.cc index 11a338b..e0b675d 100644 --- a/src/common/step/configuration/step_configure.cc +++ b/src/common/step/configuration/step_configure.cc @@ -49,7 +49,6 @@ Step::Status StepConfigure::process() { case RequestType::Install: case RequestType::Update: context_->file_path.set(pkgmgr_->GetRequestInfo()); - context_->pkgid.set(kStrEmpty); if (!pkgmgr_->GetTepPath().empty()) { context_->tep_path.set(pkgmgr_->GetTepPath()); context_->is_tep_move.set(pkgmgr_->GetIsTepMove()); @@ -73,7 +72,7 @@ Step::Status StepConfigure::process() { break; case RequestType::Delta: context_->unpacked_dir_path.set(kStrEmpty); - context_->pkgid.set(kStrEmpty); + context_->pkgid.set(pkgmgr_->GetRequestInfo()); context_->file_path.set(pkgmgr_->GetRequestInfo()); break; case RequestType::Move: @@ -83,12 +82,10 @@ Step::Status StepConfigure::process() { break; case RequestType::Recovery: context_->file_path.set(pkgmgr_->GetRequestInfo()); - context_->pkgid.set(kStrEmpty); break; case RequestType::MountInstall: case RequestType::MountUpdate: context_->file_path.set(pkgmgr_->GetRequestInfo()); - context_->pkgid.set(kStrEmpty); if (!pkgmgr_->GetTepPath().empty()) { context_->tep_path.set(pkgmgr_->GetTepPath()); context_->is_tep_move.set(pkgmgr_->GetIsTepMove()); @@ -100,21 +97,18 @@ Step::Status StepConfigure::process() { case RequestType::ManifestDirectInstall: case RequestType::ManifestDirectUpdate: { context_->pkgid.set(pkgmgr_->GetRequestInfo()); - bf::path package_directory = - context_->root_application_path.get() / context_->pkgid.get(); bf::path xml_path = bf::path(getUserManifestPath(context_->uid.get(), context_->is_readonly_package.get())) / bf::path(context_->pkgid.get()); xml_path += ".xml"; - context_->unpacked_dir_path.set(package_directory); - context_->pkg_path.set(package_directory); + context_->unpacked_dir_path.set(context_->GetPkgPath()); context_->xml_path.set(xml_path); break; } case RequestType::ReadonlyUpdateInstall: context_->file_path.set(pkgmgr_->GetRequestInfo()); - context_->pkgid.set(kStrEmpty); + context_->pkgid.set(pkgmgr_->GetRequestInfo()); if (!pkgmgr_->GetTepPath().empty()) { context_->tep_path.set(pkgmgr_->GetTepPath()); context_->is_tep_move.set(pkgmgr_->GetIsTepMove()); @@ -134,9 +128,6 @@ Step::Status StepConfigure::process() { break; case RequestType::MigrateExtImg: { context_->pkgid.set(pkgmgr_->GetRequestInfo()); - bf::path package_directory = - context_->root_application_path.get() / context_->pkgid.get(); - context_->pkg_path.set(package_directory); break; } default: diff --git a/src/common/step/configuration/step_parse_manifest.cc b/src/common/step/configuration/step_parse_manifest.cc index 79b8ef9..8e1a1bd 100644 --- a/src/common/step/configuration/step_parse_manifest.cc +++ b/src/common/step/configuration/step_parse_manifest.cc @@ -105,11 +105,9 @@ bool StepParseManifest::LocateConfigFile() { boost::filesystem::path manifest; switch (manifest_location_) { case ManifestLocation::RECOVERY: { - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); bf::path backup_path = common_installer::GetBackupPathForPackagePath( - context_->pkg_path.get()) / kManifestFileName; - bf::path in_package_path = context_->pkg_path.get() / kManifestFileName; + context_->GetPkgPath()) / kManifestFileName; + bf::path in_package_path = context_->GetPkgPath() / kManifestFileName; bf::path install_path = bf::path(getUserManifestPath(context_->uid.get(), context_->is_readonly_package.get())) @@ -390,7 +388,7 @@ bool StepParseManifest::FillPrivileges(manifest_x* manifest) { if (bf::path(priv.license).is_absolute()) privilege->license = strdup(priv.license.c_str()); else - privilege->license = strdup((context_->pkg_path.get() + privilege->license = strdup((context_->GetPkgPath() / priv.license).c_str()); } manifest->appdefined_privileges = @@ -426,7 +424,7 @@ bool StepParseManifest::FillProvidesAppDefinedPrivileges( if (bf::path(priv.license).is_absolute()) privilege->license = strdup(priv.license.c_str()); else - privilege->license = strdup((context_->pkg_path.get() + privilege->license = strdup((context_->GetPkgPath() / priv.license).c_str()); } manifest->provides_appdefined_privileges = @@ -945,7 +943,7 @@ void StepParseManifest::AppendSplashScreen(application_x* app, if (bf::path(src).is_absolute()) { splashscreen->src = strdup(src.c_str()); } else { - bf::path full_path = context_->pkg_path.get() / src; + bf::path full_path = context_->GetPkgPath() / src; splashscreen->src = strdup(full_path.string().c_str()); } if (src.substr(src.find_last_of(".") + 1) == "edj") @@ -1166,8 +1164,6 @@ Step::Status StepParseManifest::process() { parser_->GetManifestData(app_keys::kManifestKey)); context_->pkgid.set(info->package()); - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); manifest_x* manifest = static_cast(calloc(1, sizeof(manifest_x))); diff --git a/src/common/step/filesystem/step_change_ownership_and_permission.cc b/src/common/step/filesystem/step_change_ownership_and_permission.cc index 19e2bf8..e9dab43 100644 --- a/src/common/step/filesystem/step_change_ownership_and_permission.cc +++ b/src/common/step/filesystem/step_change_ownership_and_permission.cc @@ -195,14 +195,14 @@ Step::Status StepChangeOwnershipAndPermission::process() { return Status::ERROR; // Grant default permissions - if (!GrantDefaultPermissions(context_->pkg_path.get(), skip_symlink_)) + if (!GrantDefaultPermissions(context_->GetPkgPath(), skip_symlink_)) return Status::GRANT_PERMISSION_ERROR; // Change owner of files at root path - if (!ci::SetOwnershipAll(context_->pkg_path.get(), uid, *gid)) + if (!ci::SetOwnershipAll(context_->GetPkgPath(), uid, *gid)) return Status::ERROR; - if (!ChangeDataDir(context_->pkg_path.get(), uid)) + if (!ChangeDataDir(context_->GetPkgPath(), uid)) return Status::ERROR; // For icon files diff --git a/src/common/step/filesystem/step_copy.cc b/src/common/step/filesystem/step_copy.cc index e3a921d..f86f746 100644 --- a/src/common/step/filesystem/step_copy.cc +++ b/src/common/step/filesystem/step_copy.cc @@ -54,16 +54,12 @@ Step::Status StepCopy::precheck() { } Step::Status StepCopy::process() { - // set application path - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); - bf::path install_path; if (context_->storage.get() == Storage::EXTENDED) { install_path = bf::path(GetExtendedRootAppPath(context_->uid.get())) / context_->pkgid.get(); } else { - install_path = context_->pkg_path.get(); + install_path = context_->GetPkgPath(); } bs::error_code error; @@ -84,7 +80,7 @@ Step::Status StepCopy::process() { if (context_->storage.get() == Storage::EXTENDED) { bs::error_code error; - bf::create_symlink(install_path, context_->pkg_path.get(), error); + bf::create_symlink(install_path, context_->GetPkgPath(), error); if (error) { LOG(ERROR) << "Failed to create symlink for extended path: " << error.message(); @@ -109,7 +105,7 @@ Step::Status StepCopy::undo() { RemoveAll(install_path); } - if (!RemoveAll(context_->pkg_path.get())) + if (!RemoveAll(context_->GetPkgPath())) return Status::APP_DIR_ERROR; return Status::OK; } diff --git a/src/common/step/filesystem/step_copy_storage_directories.cc b/src/common/step/filesystem/step_copy_storage_directories.cc index 104474c..3781d57 100644 --- a/src/common/step/filesystem/step_copy_storage_directories.cc +++ b/src/common/step/filesystem/step_copy_storage_directories.cc @@ -41,7 +41,7 @@ bool StepCopyStorageDirectories::CopyAppStorage( common_installer::Step::Status StepCopyStorageDirectories::precheck() { backup_path_ = - common_installer::GetBackupPathForPackagePath(context_->pkg_path.get()); + common_installer::GetBackupPathForPackagePath(context_->GetPkgPath()); bs::error_code error_code; if (!bf::exists(backup_path_, error_code)) { @@ -56,14 +56,14 @@ common_installer::Step::Status StepCopyStorageDirectories::process() { if (context_->request_mode.get() == RequestMode::GLOBAL) return Status::OK; if (!CopyAppStorage(backup_path_, - context_->pkg_path.get(), + context_->GetPkgPath(), kDataLocation, true)) { LOG(ERROR) << "Failed to restore private directory for widget in update"; return Status::APP_DIR_ERROR; } if (!CopyAppStorage(backup_path_, - context_->pkg_path.get(), + context_->GetPkgPath(), kSharedResLocation, true)) { LOG(ERROR) << "Failed to restore shared directory for widget in update"; return Status::APP_DIR_ERROR; @@ -81,7 +81,7 @@ common_installer::Step::Status StepCopyStorageDirectories::undo() { bool StepCopyStorageDirectories::CacheDir() { bs::error_code error_code; - bf::path cache_path = context_->pkg_path.get() / kCache; + bf::path cache_path = context_->GetPkgPath() / kCache; bf::create_directory(cache_path, error_code); if (error_code) { LOG(ERROR) << "Failed to create cache directory for package"; diff --git a/src/common/step/filesystem/step_copy_tep.cc b/src/common/step/filesystem/step_copy_tep.cc index c357fd5..e6cce46 100644 --- a/src/common/step/filesystem/step_copy_tep.cc +++ b/src/common/step/filesystem/step_copy_tep.cc @@ -42,16 +42,12 @@ Step::Status StepCopyTep::precheck() { Step::Status StepCopyTep::process() { if (context_->tep_path.get().empty()) return Step::Status::OK; - - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); - bf::path tep_path; if (context_->external_storage) { tep_path = GetExternalTepPath(context_->request_mode.get(), context_->uid.get()); } else { - tep_path = GetInternalTepPath(context_->pkg_path.get()); + tep_path = GetInternalTepPath(context_->GetPkgPath()); } // Keep filename of app store supplied file. Filename contains hash that diff --git a/src/common/step/filesystem/step_create_storage_directories.cc b/src/common/step/filesystem/step_create_storage_directories.cc index e925010..b63e514 100644 --- a/src/common/step/filesystem/step_create_storage_directories.cc +++ b/src/common/step/filesystem/step_create_storage_directories.cc @@ -39,7 +39,7 @@ namespace filesystem { common_installer::Step::Status StepCreateStorageDirectories::process() { if (context_->request_mode.get() == RequestMode::GLOBAL) { // remove packaged RW diriectories - if (!common_installer::DeleteStorageDirectories(context_->pkg_path.get())) { + if (!common_installer::DeleteStorageDirectories(context_->GetPkgPath())) { LOG(ERROR) << "Failed to remove storage directories"; return Status::APP_DIR_ERROR; } @@ -53,7 +53,7 @@ common_installer::Step::Status StepCreateStorageDirectories::process() { break; } } - if (!common_installer::CreateStorageDirectories(context_->pkg_path.get(), + if (!common_installer::CreateStorageDirectories(context_->GetPkgPath(), manifest->api_version, true, has_priv)) { LOG(ERROR) << "Failed to create storage directories"; diff --git a/src/common/step/filesystem/step_create_storage_directories.h b/src/common/step/filesystem/step_create_storage_directories.h index c2ce49d..a1f9b77 100644 --- a/src/common/step/filesystem/step_create_storage_directories.h +++ b/src/common/step/filesystem/step_create_storage_directories.h @@ -21,7 +21,7 @@ namespace filesystem { * * Other methods are empty. * * CreateStorageDirectories works on below directories: - * * context_->pkg_path.get(), eg: + * * context_->GetPkgPath(), eg: * * TZ_SYS_RW/PKGID/ (/usr/apps/PKGID/) * * TZ_SER_APPS/PKGID/ (/{HOME}/apps_rw/PKGID/) */ diff --git a/src/common/step/filesystem/step_migrate_legacy_external_image.cc b/src/common/step/filesystem/step_migrate_legacy_external_image.cc index 6caa6d1..17970ff 100644 --- a/src/common/step/filesystem/step_migrate_legacy_external_image.cc +++ b/src/common/step/filesystem/step_migrate_legacy_external_image.cc @@ -34,13 +34,13 @@ Step::Status StepMigrateLegacyExtImage::precheck() { return Step::Status::INVALID_VALUE; } - if (context_->pkg_path.get().empty()) { + if (context_->GetPkgPath().empty()) { LOG(ERROR) << "pkg_path attribute is empty"; return Step::Status::INVALID_VALUE; } - if (!boost::filesystem::exists(context_->pkg_path.get())) { + if (!boost::filesystem::exists(context_->GetPkgPath())) { LOG(ERROR) << "pkg_path (" - << context_->pkg_path.get() + << context_->GetPkgPath() << ") path does not exist"; return Step::Status::INVALID_VALUE; } @@ -77,7 +77,7 @@ Step::Status StepMigrateLegacyExtImage::process() { std::string error_message; if (!RegisterSecurityContextForPathExternalOnly(pkgid, - context_->pkg_type.get(), context_->pkg_path.get(), + context_->pkg_type.get(), context_->GetPkgPath(), uid, &error_message)) { if (!error_message.empty()) { LOG(ERROR) << "error_message: " << error_message; diff --git a/src/common/step/filesystem/step_move_installed_storage.cc b/src/common/step/filesystem/step_move_installed_storage.cc index cd566c9..bf9a058 100644 --- a/src/common/step/filesystem/step_move_installed_storage.cc +++ b/src/common/step/filesystem/step_move_installed_storage.cc @@ -91,7 +91,7 @@ void StepMoveInstalledStorage::SetTepPaths() { context_->uid.get()); new_tep_location_ /= old_tep_location_.filename(); } else { - new_tep_location_ = GetInternalTepPath(context_->pkg_path.get()) / + new_tep_location_ = GetInternalTepPath(context_->GetPkgPath()) / old_tep_location_.filename(); } } @@ -168,7 +168,7 @@ bool StepMoveInstalledStorage::MoveBackExternal() { bool StepMoveInstalledStorage::MoveExtended() { if (move_type_ == MoveType::TO_EXTENDED) { - old_pkg_location_ = context_->pkg_path.get(); + old_pkg_location_ = context_->GetPkgPath(); new_pkg_location_ = bf::path(GetExtendedRootAppPath(context_->uid.get())) / context_->pkgid.get(); context_->storage.set(Storage::EXTENDED); diff --git a/src/common/step/filesystem/step_recover_change_owner.cc b/src/common/step/filesystem/step_recover_change_owner.cc index 9784518..59a6c7d 100644 --- a/src/common/step/filesystem/step_recover_change_owner.cc +++ b/src/common/step/filesystem/step_recover_change_owner.cc @@ -61,7 +61,7 @@ namespace filesystem { Step::Status StepRecoverChangeOwner::RecoveryUpdate() { uid_t uid = context_->uid.get(); // Change owner of files at root path - if (!ci::SetPackageDirectoryOwnerAndPermissions(context_->pkg_path.get(), + if (!ci::SetPackageDirectoryOwnerAndPermissions(context_->GetPkgPath(), uid)) return Step::Status::ERROR; @@ -75,7 +75,7 @@ Step::Status StepRecoverChangeOwner::RecoveryUpdate() { Step::Status StepRecoverChangeOwner::RecoveryMountUpdate() { uid_t uid = context_->uid.get(); // Change owner of files at root path - if (!ci::SetPackageDirectoryOwnerAndPermissions(context_->pkg_path.get(), + if (!ci::SetPackageDirectoryOwnerAndPermissions(context_->GetPkgPath(), uid)) return Step::Status::ERROR; @@ -84,10 +84,10 @@ Step::Status StepRecoverChangeOwner::RecoveryMountUpdate() { return Step::Status::ERROR; // Change owner of files at root path - if (!ci::SetOwnershipAll(context_->pkg_path.get(), uid, *gid)) + if (!ci::SetOwnershipAll(context_->GetPkgPath(), uid, *gid)) return Status::ERROR; - if (!ChangeDataDir(context_->pkg_path.get(), uid)) + if (!ChangeDataDir(context_->GetPkgPath(), uid)) return Status::ERROR; return ChangeOwnershipIconsAndManifest(gid, uid); diff --git a/src/common/step/filesystem/step_recover_external_storage.cc b/src/common/step/filesystem/step_recover_external_storage.cc index 46c7c0a..9941983 100644 --- a/src/common/step/filesystem/step_recover_external_storage.cc +++ b/src/common/step/filesystem/step_recover_external_storage.cc @@ -18,7 +18,7 @@ namespace filesystem { Step::Status StepRecoverExternalStorage::process() { if (!context_->manifest_data.get()) { - RemoveAll(context_->pkg_path.get()); + RemoveAll(context_->GetPkgPath()); } else { (void) StepAcquireExternalStorage::process(); } diff --git a/src/common/step/filesystem/step_recover_files.cc b/src/common/step/filesystem/step_recover_files.cc index 4da4b2b..4a36e8b 100644 --- a/src/common/step/filesystem/step_recover_files.cc +++ b/src/common/step/filesystem/step_recover_files.cc @@ -18,11 +18,7 @@ namespace common_installer { namespace filesystem { Step::Status StepRecoverFiles::RecoveryNew() { - if (!SetPackagePath()) { - LOG(DEBUG) << "Package files recovery not needed"; - return Status::OK; - } - if (!RemoveAll(context_->pkg_path.get())) + if (!RemoveAll(context_->GetPkgPath())) return Status::RECOVERY_ERROR; LOG(INFO) << "Package files recovery done"; @@ -30,42 +26,30 @@ Step::Status StepRecoverFiles::RecoveryNew() { } Step::Status StepRecoverFiles::RecoveryUpdate() { - if (!SetPackagePath()) { - LOG(DEBUG) << "Package files recovery not needed"; - return Status::OK; - } - bf::path backup_path = GetBackupPathForPackagePath(context_->pkg_path.get()); + bf::path backup_path = GetBackupPathForPackagePath(context_->GetPkgPath()); if (bf::exists(backup_path)) { - if (!RemoveAll(context_->pkg_path.get())) { + if (!RemoveAll(context_->GetPkgPath())) { LOG(ERROR) << "Cannot restore widget files to its correct location"; return Status::RECOVERY_ERROR; } - (void) MoveDir(backup_path, context_->pkg_path.get()); + (void) MoveDir(backup_path, context_->GetPkgPath()); } LOG(INFO) << "Package files recovery done"; return Status::OK; } Step::Status StepRecoverFiles::RecoveryMountNew() { - if (!SetPackagePath()) { - LOG(DEBUG) << "Package files recovery not needed"; - return Status::OK; - } bf::path zip_location = GetZipPackageLocation( - context_->pkg_path.get(), context_->pkgid.get()); + context_->GetPkgPath(), context_->pkgid.get()); Remove(zip_location); - RemoveAll(context_->pkg_path.get()); + RemoveAll(context_->GetPkgPath()); LOG(INFO) << "Package files recovery done"; return Status::OK; } Step::Status StepRecoverFiles::RecoveryMountUpdate() { - if (!SetPackagePath()) { - LOG(DEBUG) << "Package files recovery not needed"; - return Status::OK; - } bf::path zip_location = GetZipPackageLocation( - context_->pkg_path.get(), context_->pkgid.get()); + context_->GetPkgPath(), context_->pkgid.get()); bf::path backup_zip_location = GetBackupPathForZipFile(zip_location); if (bf::exists(backup_zip_location)) { Remove(zip_location); @@ -77,9 +61,9 @@ Step::Status StepRecoverFiles::RecoveryMountUpdate() { // directories without mounting zip package file. In other words in mount // install or mount update mode we don't mount everything - some files are // still unpacked due to necessity. - bf::path backup_path = GetBackupPathForPackagePath(context_->pkg_path.get()); + bf::path backup_path = GetBackupPathForPackagePath(context_->GetPkgPath()); if (bf::exists(backup_path)) { - if (!MoveDir(backup_path, context_->pkg_path.get(), + if (!MoveDir(backup_path, context_->GetPkgPath(), FS_MERGE_OVERWRITE | FS_COMMIT_COPY_FILE)) { LOG(ERROR) << "Failed to recovery backup file " << "in recovery of mount update"; @@ -91,14 +75,6 @@ Step::Status StepRecoverFiles::RecoveryMountUpdate() { return Status::OK; } -bool StepRecoverFiles::SetPackagePath() { - if (context_->pkgid.get().empty()) - return false; - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); - return true; -} - } // namespace filesystem } // namespace common_installer diff --git a/src/common/step/filesystem/step_recover_files.h b/src/common/step/filesystem/step_recover_files.h index 603757f..7895290 100644 --- a/src/common/step/filesystem/step_recover_files.h +++ b/src/common/step/filesystem/step_recover_files.h @@ -30,9 +30,6 @@ class StepRecoverFiles : public recovery::StepRecovery { Status RecoveryMountNew() override; Status RecoveryMountUpdate() override; - private: - bool SetPackagePath(); - STEP_NAME(RecoverFiles) }; diff --git a/src/common/step/filesystem/step_recover_storage_directories.cc b/src/common/step/filesystem/step_recover_storage_directories.cc index 087d1b2..082411a 100644 --- a/src/common/step/filesystem/step_recover_storage_directories.cc +++ b/src/common/step/filesystem/step_recover_storage_directories.cc @@ -36,12 +36,12 @@ bool StepRecoverStorageDirectories::MoveAppStorage( Step::Status StepRecoverStorageDirectories::RecoveryUpdate() { if (context_->request_mode.get() == RequestMode::GLOBAL) return Status::OK; - if (!context_->pkg_path.get().empty()) { + if (!context_->GetPkgPath().empty()) { bf::path backup_path = common_installer::GetBackupPathForPackagePath( - context_->pkg_path.get()); + context_->GetPkgPath()); if (bf::exists(backup_path)) { - MoveAppStorage(context_->pkg_path.get(), backup_path, kDataLocation); - MoveAppStorage(context_->pkg_path.get(), backup_path, kSharedResLocation); + MoveAppStorage(context_->GetPkgPath(), backup_path, kDataLocation); + MoveAppStorage(context_->GetPkgPath(), backup_path, kSharedResLocation); } } return Status::OK; diff --git a/src/common/step/filesystem/step_remove_files.cc b/src/common/step/filesystem/step_remove_files.cc index a49e6ad..807a6fd 100644 --- a/src/common/step/filesystem/step_remove_files.cc +++ b/src/common/step/filesystem/step_remove_files.cc @@ -50,11 +50,11 @@ Step::Status StepRemoveFiles::precheck() { // Even though, the below checks can fail, StepRemoveFiles should still try // to remove the files - if (context_->pkg_path.get().empty()) + if (context_->GetPkgPath().empty()) LOG(ERROR) << "pkg_path attribute is empty"; - else if (!bf::exists(context_->pkg_path.get())) + else if (!bf::exists(context_->GetPkgPath())) LOG(ERROR) << "pkg_path (" - << context_->pkg_path.get() + << context_->GetPkgPath() << ") path does not exist"; return Step::Status::OK; diff --git a/src/common/step/filesystem/step_remove_zip_image.cc b/src/common/step/filesystem/step_remove_zip_image.cc index 7a7a5aa..c09330a 100644 --- a/src/common/step/filesystem/step_remove_zip_image.cc +++ b/src/common/step/filesystem/step_remove_zip_image.cc @@ -30,7 +30,7 @@ Step::Status StepRemoveZipImage::precheck() { Step::Status StepRemoveZipImage::process() { bf::path zip_image_path = - GetZipPackageLocation(context_->pkg_path.get(), context_->pkgid.get()); + GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get()); if (bf::exists(zip_image_path)) { if (Remove(zip_image_path)) LOG(INFO) << "Zip image file removed: " << zip_image_path; diff --git a/src/common/step/filesystem/step_update_storage_directories.cc b/src/common/step/filesystem/step_update_storage_directories.cc index 292cb7b..8fe5860 100644 --- a/src/common/step/filesystem/step_update_storage_directories.cc +++ b/src/common/step/filesystem/step_update_storage_directories.cc @@ -51,7 +51,7 @@ Step::Status StepUpdateStorageDirectories::process() { std::string str_ver(manifest->api_version); utils::VersionNumber api_version(str_ver); - bf::path shared_data_path = context_->pkg_path.get() / kSharedData; + bf::path shared_data_path = context_->GetPkgPath() / kSharedData; if (api_version < ver30) { return CreateSharedDir(shared_data_path); } else { diff --git a/src/common/step/filesystem/step_update_tep.cc b/src/common/step/filesystem/step_update_tep.cc index 91ace28..d81e870 100644 --- a/src/common/step/filesystem/step_update_tep.cc +++ b/src/common/step/filesystem/step_update_tep.cc @@ -53,7 +53,7 @@ Step::Status StepUpdateTep::process() { bf::path new_path = context_->manifest_data.get()->tep_name; bf::path backup_path = GetInternalTepPath( - GetBackupPathForPackagePath(context_->pkg_path.get())); + GetBackupPathForPackagePath(context_->GetPkgPath())); backup_path /= new_path.filename(); if (!bf::exists(new_path.parent_path())) { bs::error_code error; diff --git a/src/common/step/mount/step_mount_install.cc b/src/common/step/mount/step_mount_install.cc index b6467a9..0714136 100644 --- a/src/common/step/mount/step_mount_install.cc +++ b/src/common/step/mount/step_mount_install.cc @@ -21,9 +21,6 @@ namespace common_installer { namespace mount { Step::Status StepMountInstall::process() { - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); - TzipInterface tzip_unpack(context_->unpacked_dir_path.get()); if (!tzip_unpack.UnmountZip()) { LOG(ERROR) << "Failed to unmount zip package from temporary path"; @@ -31,7 +28,7 @@ Step::Status StepMountInstall::process() { } bf::path zip_destination_path = - GetZipPackageLocation(context_->pkg_path.get(), context_->pkgid.get()); + GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get()); if (!bf::exists(zip_destination_path.parent_path())) { bs::error_code error; bf::create_directories(zip_destination_path.parent_path(), error); @@ -48,7 +45,7 @@ Step::Status StepMountInstall::process() { context_->manifest_data.get()->zip_mount_file = strdup(zip_destination_path.c_str()); - bf::path mount_point = GetMountLocation(context_->pkg_path.get()); + bf::path mount_point = GetMountLocation(context_->GetPkgPath()); TzipInterface tzip_final(mount_point); if (!tzip_final.MountZip(zip_destination_path)) { LOG(ERROR) << "Failed to mount zip package in installation path"; @@ -60,7 +57,7 @@ Step::Status StepMountInstall::process() { } Step::Status StepMountInstall::UmountPackagePath() { - bf::path mount_point = GetMountLocation(context_->pkg_path.get()); + bf::path mount_point = GetMountLocation(context_->GetPkgPath()); TzipInterface tzip_final(mount_point); if (!tzip_final.UnmountZip()) { LOG(ERROR) << "Failed to unmount zip package after installation"; @@ -77,13 +74,13 @@ Step::Status StepMountInstall::clean() { Step::Status StepMountInstall::undo() { bs::error_code error; UmountPackagePath(); - bf::remove(GetZipPackageLocation(context_->pkg_path.get(), + bf::remove(GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get()), error); if (error) { LOG(ERROR) << "Failed to remove zip package"; return Status::APP_DIR_ERROR; } - bf::remove_all(context_->pkg_path.get(), error); + bf::remove_all(context_->GetPkgPath(), error); if (error) { LOG(ERROR) << "Failed to remove package content"; return Status::APP_DIR_ERROR; diff --git a/src/common/step/mount/step_mount_recover.cc b/src/common/step/mount/step_mount_recover.cc index 4012357..445942c 100644 --- a/src/common/step/mount/step_mount_recover.cc +++ b/src/common/step/mount/step_mount_recover.cc @@ -17,11 +17,11 @@ namespace mount { Step::Status StepMountRecover::RecoveryMountUpdate() { bf::path zip_destination_path = - GetZipPackageLocation(context_->pkg_path.get(), context_->pkgid.get()); + GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get()); context_->manifest_data.get()->zip_mount_file = strdup(zip_destination_path.c_str()); - bf::path mount_point = GetMountLocation(context_->pkg_path.get()); + bf::path mount_point = GetMountLocation(context_->GetPkgPath()); TzipInterface tzip_final(mount_point); if (!tzip_final.MountZip(zip_destination_path)) { LOG(ERROR) << "Failed to mount zip package in installation path"; @@ -42,7 +42,7 @@ Step::Status StepMountRecover::undo() { } Step::Status StepMountRecover::UmountPackagePath() { - bf::path mount_point = GetMountLocation(context_->pkg_path.get()); + bf::path mount_point = GetMountLocation(context_->GetPkgPath()); TzipInterface tzip_final(mount_point); if (!tzip_final.UnmountZip()) { LOG(ERROR) << "Failed to unmount zip package after installation"; diff --git a/src/common/step/mount/step_mount_update.cc b/src/common/step/mount/step_mount_update.cc index 1915f3f..bca5093 100644 --- a/src/common/step/mount/step_mount_update.cc +++ b/src/common/step/mount/step_mount_update.cc @@ -21,9 +21,6 @@ namespace common_installer { namespace mount { Step::Status StepMountUpdate::process() { - context_->pkg_path.set( - context_->root_application_path.get() / context_->pkgid.get()); - TzipInterface tzip_unpack(context_->unpacked_dir_path.get()); if (!tzip_unpack.UnmountZip()) { LOG(ERROR) << "Failed to unmount zip package from temporary path"; @@ -31,7 +28,7 @@ Step::Status StepMountUpdate::process() { } bf::path zip_destination_path = - GetZipPackageLocation(context_->pkg_path.get(), context_->pkgid.get()); + GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get()); bf::path backup_zip_location = GetBackupPathForZipFile(zip_destination_path); if (!MoveFile(zip_destination_path, backup_zip_location)) { @@ -45,7 +42,7 @@ Step::Status StepMountUpdate::process() { context_->manifest_data.get()->zip_mount_file = strdup(zip_destination_path.c_str()); - bf::path mount_point = GetMountLocation(context_->pkg_path.get()); + bf::path mount_point = GetMountLocation(context_->GetPkgPath()); TzipInterface tzip_final(mount_point); if (!tzip_final.MountZip(zip_destination_path)) { LOG(ERROR) << "Failed to mount zip package in installation path"; @@ -59,11 +56,11 @@ Step::Status StepMountUpdate::process() { Step::Status StepMountUpdate::clean() { bf::path backup_zip_location = GetBackupPathForZipFile(GetZipPackageLocation( - context_->pkg_path.get(), context_->pkgid.get())); + context_->GetPkgPath(), context_->pkgid.get())); bs::error_code error; bf::remove(backup_zip_location, error); - bf::path mount_point = GetMountLocation(context_->pkg_path.get()); + bf::path mount_point = GetMountLocation(context_->GetPkgPath()); TzipInterface tzip_final(mount_point); if (!tzip_final.UnmountZip()) { LOG(ERROR) << "Failed to unmount zip package after installation"; @@ -73,7 +70,7 @@ Step::Status StepMountUpdate::clean() { } Step::Status StepMountUpdate::undo() { - bf::path mount_point = GetMountLocation(context_->pkg_path.get()); + bf::path mount_point = GetMountLocation(context_->GetPkgPath()); TzipInterface tzip_final(mount_point); if (!tzip_final.UnmountZip()) { LOG(ERROR) << "Failed to unmount zip package after installation"; @@ -81,7 +78,7 @@ Step::Status StepMountUpdate::undo() { } bf::path zip_location = GetZipPackageLocation( - context_->pkg_path.get(), context_->pkgid.get()); + context_->GetPkgPath(), context_->pkgid.get()); bf::path backup_zip_location = GetBackupPathForZipFile(zip_location); if (bf::exists(backup_zip_location)) { diff --git a/src/common/step/pkgmgr/step_check_force_clean.cc b/src/common/step/pkgmgr/step_check_force_clean.cc index 90be356..5490324 100644 --- a/src/common/step/pkgmgr/step_check_force_clean.cc +++ b/src/common/step/pkgmgr/step_check_force_clean.cc @@ -40,7 +40,6 @@ Step::Status StepCheckForceClean::process() { if (!PkgmgrGenerateManifestInfoFromDB(manifest, context_->pkgid.get(), context_->uid.get())) { context_->manifest_data.set(manifest); - context_->pkg_path.set(manifest->root_path); } } diff --git a/src/common/step/rds/step_rds_modify.cc b/src/common/step/rds/step_rds_modify.cc index f6d12a7..2b4b60c 100644 --- a/src/common/step/rds/step_rds_modify.cc +++ b/src/common/step/rds/step_rds_modify.cc @@ -31,6 +31,10 @@ Step::Status StepRDSModify::precheck() { << ") path does not exist"; return Step::Status::INVALID_VALUE; } + if (context_->root_application_path.get().empty()) { + LOG(ERROR) << "pkgid is not set"; + return Step::Status::PACKAGE_NOT_FOUND; + } if (context_->pkgid.get().empty()) { LOG(ERROR) << "pkgid is not set"; return Step::Status::PACKAGE_NOT_FOUND; @@ -48,9 +52,7 @@ Step::Status StepRDSModify::process() { LOG(ERROR) << "unable to setup temp directory"; return Step::Status::ERROR; } - context_->pkg_path.set( - context_->root_application_path.get() /context_->pkgid.get()); - bf::path install_path = context_->pkg_path.get(); + bf::path install_path = context_->GetPkgPath(); bf::path unzip_path = context_->unpacked_dir_path.get(); if (!AddFiles(unzip_path, install_path) || !ModifyFiles(unzip_path, install_path) || @@ -154,7 +156,7 @@ bool StepRDSModify::PerformBackup(std::string relative_path, if (backup_temp_dir_.empty()) return false; if (operation == Operation::DELETE || operation == Operation::MODIFY) { - bf::path app_path = context_->pkg_path.get(); + bf::path app_path = context_->GetPkgPath(); bf::path source_path = app_path / relative_path; if (bf::is_directory(source_path)) { if (!CreateDir(backup_temp_dir_ / relative_path)) { @@ -183,7 +185,7 @@ bool StepRDSModify::PerformBackup(std::string relative_path, void StepRDSModify::RestoreFiles() { LOG(ERROR) << "error occured about to restore files"; - bf::path app_path(context_->pkg_path.get()); + bf::path app_path(context_->GetPkgPath()); for (std::pair& modification : success_modifications_) { bf::path source_path(backup_temp_dir_ / modification.first); diff --git a/src/common/step/security/step_recover_security.cc b/src/common/step/security/step_recover_security.cc index 1a2ff5f..60114ce 100644 --- a/src/common/step/security/step_recover_security.cc +++ b/src/common/step/security/step_recover_security.cc @@ -13,9 +13,9 @@ namespace common_installer { namespace security { bool StepRecoverSecurity::Check(bool is_update) { - if (context_->pkg_path.get().empty()) + if (context_->GetPkgPath().empty()) return false; - if (!boost::filesystem::exists(context_->pkg_path.get()) && is_update) + if (!boost::filesystem::exists(context_->GetPkgPath()) && is_update) return false; if (context_->pkgid.get().empty()) return false; @@ -56,7 +56,7 @@ Step::Status StepRecoverSecurity::RecoveryUpdate() { } std::string error_message; if (!RegisterSecurityContextForManifest( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), &context_->certificate_info.get(), context_->manifest_data.get(), context_->cross_app_rules.get(), &error_message)) { LOG(ERROR) << "Unsuccessful update"; @@ -67,7 +67,7 @@ Step::Status StepRecoverSecurity::RecoveryUpdate() { return Status::RECOVERY_ERROR; } if (!RegisterSecurityContextForPath( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), context_->is_readonly_package.get(), &error_message)) { if (!error_message.empty()) { LOG(ERROR) << "error_message: " << error_message; diff --git a/src/common/step/security/step_register_security.cc b/src/common/step/security/step_register_security.cc index 875da58..83cd55b 100644 --- a/src/common/step/security/step_register_security.cc +++ b/src/common/step/security/step_register_security.cc @@ -13,13 +13,13 @@ namespace common_installer { namespace security { Step::Status StepRegisterSecurity::precheck() { - if (context_->pkg_path.get().empty()) { + if (context_->GetPkgPath().empty()) { LOG(ERROR) << "pkg_path attribute is empty"; return Step::Status::INVALID_VALUE; } - if (!boost::filesystem::exists(context_->pkg_path.get())) { + if (!boost::filesystem::exists(context_->GetPkgPath())) { LOG(ERROR) << "pkg_path (" - << context_->pkg_path.get() + << context_->GetPkgPath() << ") path does not exist"; return Step::Status::INVALID_VALUE; } @@ -41,7 +41,7 @@ Step::Status StepRegisterSecurity::process() { std::string error_message; if (context_->request_type.get() != RequestType::Move && !RegisterSecurityContextForManifest( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), &context_->certificate_info.get(), context_->manifest_data.get(), context_->cross_app_rules.get(), &error_message)) { if (!error_message.empty()) { @@ -53,7 +53,7 @@ Step::Status StepRegisterSecurity::process() { if (context_->partial_rw.get()) return Status::OK; if (!RegisterSecurityContextForPath( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), context_->is_readonly_package.get(), &error_message)) { if (!error_message.empty()) { LOG(ERROR) << "error_message: " << error_message; diff --git a/src/common/step/security/step_register_trust_anchor.cc b/src/common/step/security/step_register_trust_anchor.cc index 0a15d97..7b2f941 100644 --- a/src/common/step/security/step_register_trust_anchor.cc +++ b/src/common/step/security/step_register_trust_anchor.cc @@ -52,7 +52,7 @@ Step::Status StepRegisterTrustAnchor::precheck() { Step::Status StepRegisterTrustAnchor::process() { int ret; - bf::path pkg_certs_path = context_->pkg_path.get() / kTpkTrustAnchorPath; + bf::path pkg_certs_path = context_->GetPkgPath() / kTpkTrustAnchorPath; if (register_type_ == RegisterType::UPDATE) { ret = trust_anchor_uninstall(context_->pkgid.get().c_str(), context_->uid.get()); @@ -79,7 +79,7 @@ Step::Status StepRegisterTrustAnchor::process() { if (!common_installer::CreateDir(pkg_certs_path)) return Step::Status::APP_DIR_ERROR; bf::path pkg_certs_src_path = - context_->pkg_path.get() / "res/wgt" / kWgtTrustAnchorPath; + context_->GetPkgPath() / "res/wgt" / kWgtTrustAnchorPath; for (bf::directory_iterator file(pkg_certs_src_path); file != bf::directory_iterator(); ++file) { bf::path current(file->path()); diff --git a/src/common/step/security/step_rollback_deinstallation_security.cc b/src/common/step/security/step_rollback_deinstallation_security.cc index 8e2f21f..fbe4487 100644 --- a/src/common/step/security/step_rollback_deinstallation_security.cc +++ b/src/common/step/security/step_rollback_deinstallation_security.cc @@ -28,7 +28,7 @@ Step::Status StepRollbackDeinstallationSecurity::precheck() { Step::Status StepRollbackDeinstallationSecurity::undo() { std::string error_message; if (!RegisterSecurityContextForManifest( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), &context_->certificate_info.get(), context_->manifest_data.get(), context_->cross_app_rules.get(), &error_message)) { LOG(ERROR) << "Failure on re-installing security context for app " @@ -39,7 +39,7 @@ Step::Status StepRollbackDeinstallationSecurity::undo() { return Status::SECURITY_ERROR; } if (!RegisterSecurityContextForPath( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), context_->is_readonly_package.get(), &error_message)) { if (!error_message.empty()) { LOG(ERROR) << "error_message: " << error_message; diff --git a/src/common/step/security/step_update_security.cc b/src/common/step/security/step_update_security.cc index bc6c3bb..b796985 100644 --- a/src/common/step/security/step_update_security.cc +++ b/src/common/step/security/step_update_security.cc @@ -14,7 +14,7 @@ namespace security { Step::Status StepUpdateSecurity::process() { std::string error_message; if (!RegisterSecurityContextForManifest( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), &context_->certificate_info.get(), context_->manifest_data.get(), context_->cross_app_rules.get(), &error_message)) { if (!error_message.empty()) { @@ -25,7 +25,7 @@ Step::Status StepUpdateSecurity::process() { } if (context_->request_type.get() != RequestType::ReadonlyUpdateUninstall) { if (!RegisterSecurityContextForPath( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), context_->is_readonly_package.get(), &error_message)) { if (!error_message.empty()) { LOG(ERROR) << "error_message: " << error_message; @@ -41,7 +41,7 @@ Step::Status StepUpdateSecurity::process() { Step::Status StepUpdateSecurity::undo() { std::string error_message; if (!RegisterSecurityContextForManifest( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), &context_->certificate_info.get(), context_->old_manifest_data.get(), context_->cross_app_rules.get(), &error_message)) { if (!error_message.empty()) { @@ -50,7 +50,7 @@ Step::Status StepUpdateSecurity::undo() { return Status::SECURITY_ERROR; } if (!RegisterSecurityContextForPath( - context_->pkgid.get(), context_->pkg_path.get(), context_->uid.get(), + context_->pkgid.get(), context_->GetPkgPath(), context_->uid.get(), context_->is_readonly_package.get(), &error_message)) { if (!error_message.empty()) { LOG(ERROR) << "error_message: " << error_message; -- 2.7.4