Loading CMake/gkfs-options.cmake +1 −1 Original line number Diff line number Diff line Loading @@ -237,7 +237,7 @@ gkfs_define_option( # use old resolve function gkfs_define_option( GKFS_USE_OLD_PATH_RESOLVE GKFS_USE_LEGACY_PATH_RESOLVE HELP_TEXT "Use the old implementation of the resolve function" DEFAULT_VALUE OFF ) Loading CMakeLists.txt +2 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,8 @@ if (GKFS_SYMLINK_SUPPORT) add_definitions(-DHAS_SYMLINKS) endif () if (GKFS_USE_OLD_PATH_RESOLVE) add_definitions(-DGKFS_USE_OLD_PATH_RESOLVE) if (GKFS_USE_LEGACY_PATH_RESOLVE) add_definitions(-DGKFS_USE_LEGACY_PATH_RESOLVE) endif () if (GKFS_FOLLOW_EXTERNAL_SYMLINKS) Loading include/client/path.hpp +5 −3 Original line number Diff line number Diff line Loading @@ -36,14 +36,16 @@ unsigned int match_components(const std::string& path, unsigned int& path_components, const std::vector<std::string>& components); /// @resolve_last_link is used only for the old implementation: GKFS_USE_OLD_PATH_RESOLVE /// @resolve_last_link is used only for the old implementation: /// GKFS_USE_LEGACY_PATH_RESOLVE std::pair<bool, std::string> resolve(const std::string& path, bool resolve_last_link = true); std::pair<bool, std::string> resolve_new(const std::string& path); resolve_new(const std::string& path, const std::string& mountdir); [[deprecated("Use GKFS_USE_OLD_PATH_RESOLVE to use old implementation")]] bool [[deprecated( "Use GKFS_USE_LEGACY_PATH_RESOLVE to use old implementation")]] bool resolve(const std::string& path, std::string& resolved, bool resolve_last_link = true); Loading src/client/path.cpp +4 −6 Original line number Diff line number Diff line Loading @@ -126,18 +126,17 @@ follow_symlinks(const string& path) { pair<bool, string> resolve(const string& path, bool resolve_last_link) { #ifdef GKFS_USE_OLD_PATH_RESOLVE #ifdef GKFS_USE_LEGACY_PATH_RESOLVE string resolved; bool is_in_path = resolve(path, resolved, resolve_last_link); return make_pair(is_in_path, resolved); #else return resolve_new(path); return resolve_new(path, CTX->mountdir()); #endif } pair<bool, string> resolve_new(const string& path) { const string& mountdir = CTX->mountdir(); resolve_new(const string& path, const string& mountdir) { LOG(DEBUG, "path: \"{}\", mountdir: \"{}\"", path, mountdir); string resolved = ""; stack<size_t> last_component_pos; Loading @@ -156,8 +155,7 @@ resolve_new(const string& path) { if(comp_size == 2 && path.at(start) == '.' && path.at(start + 1) == '.') { // component is '..', we skip it LOG(DEBUG, "path: \"{}\", mountdir: \"{}\"", path, mountdir); LOG(DEBUG, "path: \"{}\", mountdir: \"{}\"", path, mountdir); resolved.erase(last_component_pos.top()); last_component_pos.pop(); continue; Loading src/client/preload_context.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -318,9 +318,10 @@ PreloadContext::relativize_fd_path(int dirfd, const char* raw_path, path = raw_path; } std::pair<bool, std::string> resolved_path = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path.second; if(resolved_path.first) { auto [is_in_path, resolved_path] = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path; if(is_in_path) { return RelativizeStatus::internal; } return RelativizeStatus::external; Loading Loading @@ -350,10 +351,10 @@ PreloadContext::relativize_path(const char* raw_path, path = raw_path; } std::pair<bool, std::string> resolved_path = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path.second; return resolved_path.first; auto [is_in_path, resolved_path] = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path; return is_in_path; } const std::string& Loading Loading
CMake/gkfs-options.cmake +1 −1 Original line number Diff line number Diff line Loading @@ -237,7 +237,7 @@ gkfs_define_option( # use old resolve function gkfs_define_option( GKFS_USE_OLD_PATH_RESOLVE GKFS_USE_LEGACY_PATH_RESOLVE HELP_TEXT "Use the old implementation of the resolve function" DEFAULT_VALUE OFF ) Loading
CMakeLists.txt +2 −2 Original line number Diff line number Diff line Loading @@ -272,8 +272,8 @@ if (GKFS_SYMLINK_SUPPORT) add_definitions(-DHAS_SYMLINKS) endif () if (GKFS_USE_OLD_PATH_RESOLVE) add_definitions(-DGKFS_USE_OLD_PATH_RESOLVE) if (GKFS_USE_LEGACY_PATH_RESOLVE) add_definitions(-DGKFS_USE_LEGACY_PATH_RESOLVE) endif () if (GKFS_FOLLOW_EXTERNAL_SYMLINKS) Loading
include/client/path.hpp +5 −3 Original line number Diff line number Diff line Loading @@ -36,14 +36,16 @@ unsigned int match_components(const std::string& path, unsigned int& path_components, const std::vector<std::string>& components); /// @resolve_last_link is used only for the old implementation: GKFS_USE_OLD_PATH_RESOLVE /// @resolve_last_link is used only for the old implementation: /// GKFS_USE_LEGACY_PATH_RESOLVE std::pair<bool, std::string> resolve(const std::string& path, bool resolve_last_link = true); std::pair<bool, std::string> resolve_new(const std::string& path); resolve_new(const std::string& path, const std::string& mountdir); [[deprecated("Use GKFS_USE_OLD_PATH_RESOLVE to use old implementation")]] bool [[deprecated( "Use GKFS_USE_LEGACY_PATH_RESOLVE to use old implementation")]] bool resolve(const std::string& path, std::string& resolved, bool resolve_last_link = true); Loading
src/client/path.cpp +4 −6 Original line number Diff line number Diff line Loading @@ -126,18 +126,17 @@ follow_symlinks(const string& path) { pair<bool, string> resolve(const string& path, bool resolve_last_link) { #ifdef GKFS_USE_OLD_PATH_RESOLVE #ifdef GKFS_USE_LEGACY_PATH_RESOLVE string resolved; bool is_in_path = resolve(path, resolved, resolve_last_link); return make_pair(is_in_path, resolved); #else return resolve_new(path); return resolve_new(path, CTX->mountdir()); #endif } pair<bool, string> resolve_new(const string& path) { const string& mountdir = CTX->mountdir(); resolve_new(const string& path, const string& mountdir) { LOG(DEBUG, "path: \"{}\", mountdir: \"{}\"", path, mountdir); string resolved = ""; stack<size_t> last_component_pos; Loading @@ -156,8 +155,7 @@ resolve_new(const string& path) { if(comp_size == 2 && path.at(start) == '.' && path.at(start + 1) == '.') { // component is '..', we skip it LOG(DEBUG, "path: \"{}\", mountdir: \"{}\"", path, mountdir); LOG(DEBUG, "path: \"{}\", mountdir: \"{}\"", path, mountdir); resolved.erase(last_component_pos.top()); last_component_pos.pop(); continue; Loading
src/client/preload_context.cpp +8 −7 Original line number Diff line number Diff line Loading @@ -318,9 +318,10 @@ PreloadContext::relativize_fd_path(int dirfd, const char* raw_path, path = raw_path; } std::pair<bool, std::string> resolved_path = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path.second; if(resolved_path.first) { auto [is_in_path, resolved_path] = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path; if(is_in_path) { return RelativizeStatus::internal; } return RelativizeStatus::external; Loading Loading @@ -350,10 +351,10 @@ PreloadContext::relativize_path(const char* raw_path, path = raw_path; } std::pair<bool, std::string> resolved_path = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path.second; return resolved_path.first; auto [is_in_path, resolved_path] = gkfs::path::resolve(path, resolve_last_link); relative_path = resolved_path; return is_in_path; } const std::string& Loading