Uh oh!
There was an error while loading. Please reload this page.
Fix ResolveLinkTarget for intermediate symlinks - #132042
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
iamhaseebn
commented
Aug 8, 2026
@dotnet-policy-service agree. |
iamhaseebn
commented
Aug 8, 2026
@dotnet-policy-service agree |
teo-tsirpanis
commented
Aug 8, 2026
I wonder if this would solve the failures in dotnet/msbuild#14482. |
iamhaseebn
commented
Aug 8, 2026
Thanks for the pointer. I checked the failing Linux and macOS tests in dotnet/msbuild#14482. This change would not fix them: it follows intermediate links after the input path itself has been identified as a symbolic link. In #14482, |
jozkee
commented
Aug 11, 2026
On Windows, we try to open the final target and use GetFinalPathNameByHandle. If the target is unreachable, we fall back to manual traversal to preserve dangling-target behavior. What do you think about following the same approach on Unix—first trying realpath() and then falling back to manual traversal for unreachable targets? This would resolve intermediate symlinks and better align the two implementations. cc @tmds |
iamhaseebn
commented
Aug 11, 2026
Thanks - updated the Unix path to use |
…et-intermediate-symlinks
jeffhandley
commented
Aug 16, 2026
@jozkee -- assigning this to you to drive in for .NET 11 RC2 |
jozkee
commented
Aug 17, 2026
I'm moving this to 12.0, please see #118719 (comment). |
tmds
commented
Aug 24, 2026
For vardir=Directory.CreateTempSubdirectory();Directory.CreateDirectory($"{dir}/deep/deeper");Directory.CreateSymbolicLink($"{dir}/deep/deeper/link","../deeper");Directory.CreateSymbolicLink($"{dir}/a","deep/deeper");foreach(varfollowinnew[]{true,false}){vartarget=newDirectoryInfo($"{dir}/a/link").ResolveLinkTarget(follow);Console.WriteLine(target!.Exists);}With the changes from this PR, this prints: The problem is that the From a use-case perspective, I don't think users actually want/need |
tmds
commented
Aug 24, 2026
Also for |
Fixes#118719
ResolveLinkTarget(..., returnFinalTarget: true)followed a symlink chain only when each complete current path was itself a symbolic link. Kubernetes ConfigMap layouts use an intermediate..datadirectory symlink, so resolution stopped before reaching the final target.This change:
File,Directory,FileInfo, andDirectoryInfo.Validation: