michael-jabbour-sonarsource wrote:

Thank you very much @compnerd and @tristanlabelle for the information. I am 
writing my thoughts below:

> Everything is being built in S:, there is no reason that the path should be 
> "canonicalised" to %UserProfile%\SourceCache\llvm-project\llvm\... instead of 
> X:\llvm-project which is what you told the tools the path is.

I feel I am missing why being inside `X:` is any different from being inside a 
symlink to another directory. For me, both cases should be treated similarly: 
The canonical path of a file is the one inside `%UserProfile%`. The parts of 
the compiler that don't need the canonical path should always see `X:`, whereas 
the ones that ask for the canonical path should see `%UserProfile%`. Could you 
clarify why should a substituted drive be treated differently from any symlink?

> I agree with that intended definition, but that is not the usage in practice. 
> Code will arbitrarily canonicalize some paths and keep going, rather than 
> using canonicalized paths only for comparisons.

I agree with this, and for me it sounds more like it is a problem in how the 
function is used, not how it behaves. The fix should be to go through the 
usages and make sure they really need to canonicalize IMO.

> I do not know if there is an API that will let you resolve a path into a 
> particular drive, but if so, that would likely be the proper tool to use here.

> In the presence of chains of filesystem decorators, we'll undo the real-path 
> mapping of the entire chain if it changes the drive, whereas we just want the 
> real filesystem at the bottom of the chain to be decorated to avoid changing 
> the drive.

IIUC, both these suggestions aim to address points "1" and "2" in my previous 
response. This might be an improvement over the existing patch (as it would 
start resolving symlinks inside the drive), but concern "3" remains. I would 
still be concerned about calling such functionality a "canonical" path, as it 
doesn't satisfy the canonical property: One may still get different canonical 
paths for the same file, depending on whether they access 
`%UserProfile%/SourceCache/file` and `X:/file`. In other words, I don't agree 
with calling this "root-preserving transformation" a "canonicalization". Could 
you clarify if I am missing something here?

Best regards,
Michael

https://github.com/llvm/llvm-project/pull/139739
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to