[PATCH] D121733: Clean pathnames in FileManager.

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 18 17:11:37 PDT 2022


dexonsmith added a comment.

In D121733#3393552 <https://reviews.llvm.org/D121733#3393552>, @bnbarham wrote:

> In D121733#3393546 <https://reviews.llvm.org/D121733#3393546>, @rnk wrote:
>
>> I've been somewhat afraid to touch this code because of symlinks. Is that something we need to worry about? Consider this path: root/symlink/../foo.h. remove_dots will turn this into root/foo.h, but if symlink points to some unrelated directory, the .. directory entry points to something other than root. I can't imagine that people rely on this behavior often, but I could be wrong.
>
> `remove_dots` doesn't remove `..` by default, it needs to be passed `true` to do that. This is only removing `.`.

Yeah, I'd be against doing `..`-removal unless we had a cheap-enough way to detect if that was symlink-incorrect and skipped it in that case. But maybe it'd be worth a comment here explicitly saying `..`s were intentionally not being canonicalized.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121733



More information about the cfe-commits mailing list