[Lldb-commits] [PATCH] D55827: Update current working directory to avoid test crashes

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 18 13:16:08 PST 2018

JDevlieghere added a comment.

In D55827#1334671 <https://reviews.llvm.org/D55827#1334671>, @labath wrote:

> Hm... this seems like an important issue in the `RealFileSystem` (or our usage of it), and I'm not sure it should be papered over like that. I mean, lldb is a library, and requiring every call to `chdir` in the whole process go through "our" implementation is not very friendly towards everyone else we happen to be sharing a process with.

On the other hand (playing the devil's advocate) it could be considered nice that lldb as a library isn't affected by that if we explicitly set the cwd?

> It sounds like we want a VFS that is slightly more "real" than the RealFileSystem, and which shares the notion of the CWD with the OS.

Did you have a look at the comment in `VirtualFileSystem.cpp` that explains why they went this route?

  // FIXME: chdir is thread hostile; on the other hand, creating the same
  // behavior as chdir is complex: chdir resolves the path once, thus
  // guaranteeing that all subsequent relative path operations work
  // on the same path the original chdir resulted in. This makes a
  // difference for example on network filesystems, where symlinks might be
  // switched during runtime of the tool. Fixing this depends on having a
  // file system abstraction that allows openat() style interactions.

Wouldn't we encounter the same problem?




More information about the lldb-commits mailing list