-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
untriagedRequest triage from a team memberRequest triage from a team member
Description
Describe the bug
There are assumptions baked into Get:DotnetExeDirectory, especially for linux arm64 hosts.
SDK function GetDotnetExeDirectory
contains the line:
dotnetRootPath = Path.GetFileName(dotnetRootPath).Contains("dotnet") || Path.GetFileName(dotnetRootPath).Contains("x64") || Path.GetFileName(dotnetRootPath).Equals("d") ? dotnetRootPath : Path.Combine(dotnetRootPath, "dotnet");
There are lots of things wrong here:
- The line is too long (too many characters; source code style)
- There's an assumption that the directory holding the executable (we're given the name of the executable) contains "dotnet". For the latest SDK+runtime, directory names seem to be of the form "net7.0-linux" or "net7.0-Linux-Release-arm64". So why are you looking for "dotnet" rather than just "net"?
- There's an assumption that x64 host is handled differently than arm64. Why aren't these handled identically, at least for the *nix hosts? I'm told this is a windows architecture issue)
- You're fishing for substrings in the directory holding the executable. Perhaps fish for all substrings that are plausibly part of a RID.
- Why the special case assumption for "d" ? If this is a test harness issue, fix it over there, not in this general code.
- You aren't testing to ensure that the directory name you return is indeed a directory
- You aren't testing to ensure that every intermediate directory on the proposed path is a directory. So you'll return a path like "..../dotnet/sdk" where "..../dotnet" exists and is an executable file, but is not a directory like you assume in what is returned.
- Catch the thrown error and make an error message that is a little more appropriate, and perhaps rethrow the error.
- You implement a naming protocol. Is this protocol documented in "official" docs on the SDK? If so, please add to the comment a citation of the official filenaming docs for the SDK.
To Reproduce
Exceptions (if any)
Further technical details
- I build dotnet runtime in a variety of ways using a variety of gcc versions and a variety of gcc flags. I compare results on x64 host vs arm64 hosts.
Metadata
Metadata
Assignees
Labels
untriagedRequest triage from a team memberRequest triage from a team member