dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.71k stars 1.07k forks source link

`dotnet tool install` fails for some paths on Linux #16462

Open premun opened 3 years ago

premun commented 3 years ago

.NET 6 preview 2 fails to install dotnet tools on Linux in some paths and succeeds in other. I wasn't able to determine the key.

It succeeds to install to /mnt/d/a non-existent folder, it fails to install do /mnt/d/a/b. I verified that long path support is on and it also succeeded to install to /mnt/d/aaaa which is a longer path than /mnt/d/a/b. I also tried creating /mnt/d/a and installing into /mnt/d/a/b and it also failed.

Repro steps:

$ dotnet tool install --tool-path /mnt/d/a --version 1.0.0-prerelease.21162.1 --add-source https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet-eng/nuget/v3/index.json Microsoft.DotNet.XHarness.CLI
You can invoke the tool using the following command: xharness
Tool 'microsoft.dotnet.xharness.cli' (version '1.0.0-prerelease.21162.1') was successfully installed.
$ rm -rf /mnt/d/a
$ dotnet tool install --tool-path /mnt/d/a/b --version 1.0.0-prerelease.21162.1 --add-source https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet-eng/nuget/v3/index.json Microsoft.DotNet.XHarness.CLI
/mnt/d/github/arcade/.dotnet/sdk/6.0.100-preview.2.21155.3/NuGet.targets(131,5): error : Input/output error [/tmp/tkfebrrh.0kq/restore.csproj]
The tool package could not be restored.
Tool 'microsoft.dotnet.xharness.cli' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool

dotnet --info returns:

.NET SDK (reflecting any global.json):
 Version:   6.0.100-preview.2.21155.3
 Commit:    1a9103db2d

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /mnt/d/github/arcade/.dotnet/sdk/6.0.100-preview.2.21155.3/

Host (useful for support):
  Version: 6.0.0-preview.2.21154.6
  Commit:  3eaf1f316b

.NET SDKs installed:
  6.0.100-preview.2.21155.3 [/mnt/d/github/arcade/.dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0-preview.2.21154.6 [/mnt/d/github/arcade/.dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.0-preview.2.21154.6 [/mnt/d/github/arcade/.dotnet/shared/Microsoft.NETCore.App]

I see this happening across different machines and platforms (WSL, MacOS, AzDO Linux agents) but I still failed to determine when it would fail and when not. Path length doesn't seem to matter, I tried removing segments matching the package name or package version but the examples above show that these also doesn't matter.

dotnet-issue-labeler[bot] commented 3 years ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

sfoslund commented 3 years ago

FYI @wli3

premun commented 3 years ago

This is still happening on .NET 6 preview 7. I have the same repo, same script, fails on Windows 10 / Ubuntu WSL 2 and succeeds on MacOS 10.15.6

wli3 commented 3 years ago

Some thought: The error in the end is "Input/output error". Looks like from OS. https://unix.stackexchange.com/questions/39905/input-output-error-when-accessing-a-directory