[PATCH] D121423: [VFS] OverlayFileSystem should consistently use the last-added FS first

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 14:53:40 PST 2022


dexonsmith added a comment.

In D121423#3376212 <https://reviews.llvm.org/D121423#3376212>, @dexonsmith wrote:

> However, I'm concerned that the combination of the changes here will make the following do the wrong thing:
>
>   overlay:
>     in-memory #1: (base)
>       /a/x
>     in-memory #2:
>       /c/a/x
>
> operations:
>
>   cd /
>   cd /c
>   cat a/x
>
> IIUC the combined effect of your changes, this "should" print `/c/a/x` from in-memory-v2, but instead it'll print `/a/x` from in-memory-v1. And I think before this patch, it would have done the right thing.

I think my explanation was a bit muddled.

- Before this patch:
  - `cd /c` would have returned "directory not found". Clients think we're in `/`.
  - `cat a/x` will give content aligning with `/a/x`.
  - This seems correct.
- After this patch:
  - `cd /c` has no error. Clients think we're in `/c`.
  - `cat a/x` will give content aligning with `/a/x/`.
  - This seems incorrect. Since the `cd /c` succeeded, we should get `/c/a/x`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121423/new/

https://reviews.llvm.org/D121423



More information about the llvm-commits mailing list