From 8079adc050f3f7159a9d6cc718d6146460938c74 Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Sat, 17 Dec 2022 11:21:57 +1300 Subject: [PATCH] libroot: fix path inconsistency in the find path API. With the package kit merge, settings from packages were placed into ~/config/settings/global for packages installed into the PackageFS Home mount. As a result, B_FIND_PATH_SETTINGS_DIRECTORY was returning a user settings path different to the find directory API, making transitioning from find directory to find path incompatible. This change also updates the package_daemon and packagefs to remove the remapping also occurring there. Change-Id: Id5d077503e177a5f7cbc48779c132160b0d01890 Reviewed-on: https://review.haiku-os.org/c/haiku/+/5941 Tested-by: Commit checker robot Reviewed-by: waddlesplash --- .../packagefs/package_links/PackageLinkSymlink.cpp | 2 +- src/servers/package/CommitTransactionHandler.cpp | 13 +------------ src/system/libroot/os/find_paths.cpp | 3 +-- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp b/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp index 681d6287a9..d3d8e8a190 100644 --- a/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp +++ b/src/add-ons/kernel/file_systems/packagefs/package_links/PackageLinkSymlink.cpp @@ -29,7 +29,7 @@ static const char* const kLinkPaths[PackageLinkSymlink::TYPE_ENUM_COUNT] }, { "../../../system/settings", - "../../../home/config/settings/global", + "../../../home/config/settings", kUnknownLinkTarget } }; diff --git a/src/servers/package/CommitTransactionHandler.cpp b/src/servers/package/CommitTransactionHandler.cpp index 9377c8dfa7..1e203a3acc 100644 --- a/src/servers/package/CommitTransactionHandler.cpp +++ b/src/servers/package/CommitTransactionHandler.cpp @@ -878,18 +878,6 @@ CommitTransactionHandler::_AddGlobalWritableFile(Package* package, const BGlobalWritableFileInfo& file, const BDirectory& rootDirectory, const BDirectory& extractedFilesDirectory) { - // Map the path name to the actual target location. Currently this only - // concerns "settings/", which is mapped to "settings/global/". - BString targetPath(file.Path()); - if (fVolume->MountType() == PACKAGE_FS_MOUNT_TYPE_HOME) { - if (targetPath == "settings" - || targetPath.StartsWith("settings/")) { - targetPath.Insert("/global", 8); - if (targetPath.Length() == file.Path().Length()) - throw std::bad_alloc(); - } - } - // open parent directory of the source entry const char* lastSlash = strrchr(file.Path(), '/'); const BDirectory* sourceDirectory; @@ -916,6 +904,7 @@ CommitTransactionHandler::_AddGlobalWritableFile(Package* package, } // open parent directory of the target entry -- create, if necessary + BString targetPath(file.Path()); FSUtils::Path relativeSourcePath(file.Path()); lastSlash = strrchr(targetPath, '/'); if (lastSlash != NULL) { diff --git a/src/system/libroot/os/find_paths.cpp b/src/system/libroot/os/find_paths.cpp index 6d613e4bef..4ff30f733b 100644 --- a/src/system/libroot/os/find_paths.cpp +++ b/src/system/libroot/os/find_paths.cpp @@ -216,8 +216,7 @@ get_relative_directory_path(size_t installationLocationIndex, case B_FIND_PATH_SERVERS_DIRECTORY: return "/servers"; case B_FIND_PATH_SETTINGS_DIRECTORY: - return installationLocationIndex == kHomeInstallationLocationIndex - ? "/settings/global" : "/settings"; + return "/settings"; case B_FIND_PATH_SOUNDS_DIRECTORY: return "/data/sounds"; case B_FIND_PATH_SPOOL_DIRECTORY: