Commit d3517cd3 authored by Ramon Nou's avatar Ramon Nou
Browse files

Merge branch 'rnou/315-lstat-inf-loop-on-resolve_new' into 'master'

Resolve "lstat inf loop on resolve_new"

Closes #315

Closes #315

See merge request !209
parents 75f6bdc9 66b11f1a
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
  - Tests check ret for -1 instead of 10000 fd ([!320](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/320))
    - Allow some more script tests to run as pthread_at_fork solved some issues.
  - Return EINVAL is better than ENOTSUP on internal readlink ([!223](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/223))
  - resolve_new accepts the parameter resolve_last_link,([!209](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/209))
    - This solves an issue with the ci when looks at gcl-build directory (mainly lxstat) 
  
### Fixed

+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ 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, bool resolve_last_link = true);

[[deprecated(
        "Use GKFS_USE_LEGACY_PATH_RESOLVE to use old implementation")]] bool
+5 −3
Original line number Diff line number Diff line
@@ -141,12 +141,12 @@ resolve(const string& path, bool resolve_last_link) {
    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, resolve_last_link);
#endif
}

pair<bool, string>
resolve_new(const string& path) {
resolve_new(const string& path, bool resolve_last_link) {
    LOG(DEBUG, "path: \"{}\", mountdir: \"{}\"", path, CTX->mountdir());

    if(path.empty()) {
@@ -193,7 +193,9 @@ resolve_new(const string& path) {
        start = end;

#ifdef GKFS_FOLLOW_EXTERNAL_SYMLINKS
        if(resolve_last_link) {
            resolved = follow_symlinks(resolved);
        }
#endif
    }