Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running into Windows path length limits for installer log files #2036

Open
mthalman opened this issue Mar 22, 2022 · 4 comments
Open

Running into Windows path length limits for installer log files #2036

mthalman opened this issue Mar 22, 2022 · 4 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@mthalman
Copy link
Member

mthalman commented Mar 22, 2022

Brief description of your issue

This is somewhat related to #1808 but for installer log files. Because winget sets the log location to an already deep path, the log files that get created by the installer can more easily run into the 260 path length limit of Windows.

In the repro below, the installer attempts to create a log with the path of C:\Users\WDAGUtilityAccount\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Microsoft.dotnet.6.1.322.12413-2022-03-22-14-16-07.487_013_Microsoft.NET.Sdk.Android.Manifest_6.0.100.31.0.101_preview.9.16_x64.msi.log which is over the path length limit.

Steps to reproduce

  1. git clone https://github.com/microsoft/winget-pkgs.git
  2. cd winget-pkgs
  3. git checkout 5e9640f
  4. .\Tools\SandboxTest.ps1 manifests\m\Microsoft\DotNet\6.1.322.12413

Expected behavior

.NET SDK should be successfully installed in Windows Sandbox environment.

Actual behavior

Install fails.

Output:

--> Installing WinGet
Tip: you can type 'Update-EnvironmentVariables' to update your environment variables, such as after installing a new software.

--> Configuring Winget
Admin setting enabled. 

--> Installing the Manifest 6.1.322.12413

Found Microsoft .NET SDK [Microsoft.dotnet] Version 6.1.322.12413
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://dotnetcli.azureedge.net/dotnet/Sdk/6.0.103/dotnet-sdk-6.0.103-win-x64.exe
  ██████████████████████████████   187 MB /  187 MB
Successfully verified installer hash
Starting package install...
Installer failed with exit code: 87
Installer log is available at: C:\Users\WDAGUtilityAccount\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Microsoft.dotnet.6.1.322.12413-2022-03-22-14-16-07.487.log

--> Refreshing environment variables

--> Comparing ARP Entries

DisplayName                                       DisplayVersion Publisher             ProductCode
-----------                                       -------------- ---------             -----------
Microsoft ASP.NET Core 6.0.3 Targeting Pack (x64) 6.0.3.22124    Microsoft Corporation {EA11EC08-4D6C-3AA8-86BB-3FC200EF074C}

Relevant output from the installer log file:

[02B0:02B8][2022-03-22T14:16:39]e000: Error 0x80070057: Failed to enable logging for package: Microsoft.NET.Sdk.Android.Manifest_6.0.100.31.0.101_preview.9.16_x64.msi to: C:\Users\WDAGUtilityAccount\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Microsoft.dotnet.6.1.322.12413-2022-03-22-14-16-07.487_013_Microsoft.NET.Sdk.Android.Manifest_6.0.100.31.0.101_preview.9.16_x64.msi.log
[02B0:02B8][2022-03-22T14:16:39]e000: Error 0x80070057: Failed to execute MSI package.
[13C0:13C4][2022-03-22T14:16:39]e000: Error 0x80070057: Failed to configure per-machine MSI package.

Environment

Windows Package Manager v1.2.10271
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22000.556
Package: Microsoft.DesktopAppInstaller v1.17.10271.0
@ghost ghost added the Needs-Triage Issue need to be triaged label Mar 22, 2022
@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage Issue need to be triaged labels Mar 23, 2022
@JohnMcPMS
Copy link
Member

This looks like a dotnet installer bug. We send it the log path:

C:\Users\WDAGUtilityAccount\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Microsoft.dotnet.6.1.322.12413-2022-03-22-14-16-07.487.log

As seen above in the winget output. This is 185 characters. That exe then appears to add its own sub filename part before the extension for the MSI installation that it invokes (presumed):

_013_Microsoft.NET.Sdk.Android.Manifest_6.0.100.31.0.101_preview.9.16_x64.msi

Which is 77 characters long and takes it over the MAX_PATH limit. If the dotnet installer is going to add characters to the filename, it needs to use the appropriate prepends or APIs to enable longer filenames.

I'm not sure exactly which project this should be moved to though, or if one can even move it across organizations if https://github.com/dotnet/sdk is appropriate.

@anatolybolshakov
Copy link

Faced with this issue too - the same error happens while trying to install .NET 7 via winget install Microsoft.DotNet.SDK.7:

e000: Error 0x80070057: Failed to enable logging for package: Microsoft.NET.Sdk.Android.Manifest_7.0.100_rc.1.33.0.0_rc.1.136_x64.msi to: C:\Users\<user_name>\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir\WinGet-Microsoft.DotNet.SDK.7.7.0.100-2022-11-29-18-22-45.809_012_Microsoft.NET.Sdk.Android.Manifest_7.0.100_rc.1.33.0.0_rc.1.136_x64.msi.log
e000: Error 0x80070057: Failed to execute MSI package.
e000: Error 0x80070057: Failed to configure per-machine MSI package.
i319: Applied execute package: Microsoft.NET.Sdk.Android.Manifest_7.0.100_rc.1.33.0.0_rc.1.136_x64.msi, result: 0x80070057, restart: None
e000: Error 0x80070057: Failed to execute MSI package.

@Khaos66
Copy link

Khaos66 commented Mar 8, 2023

As mentioned here #97379

You can use the --log option to change the log path to a shorter one.

Eg.

winget install --id Microsoft.DotNet.SDK.7 --source winget --log C:\temp\install.log

@denelon denelon modified the milestones: v1.5-Client, v.Next-Client Apr 18, 2023
@AnthonyMastrean
Copy link

The workaround doesn't seem accessible if you're using a winget configure manifest file. At least, I don't see the log option exposed on the DSC resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

No branches or pull requests

6 participants