chocolatey/choco

Write-FileUpdateLog fails when the path is more than 260 characters

Closed this issue · 13 comments

Update: Chocolatey 0.9.10.0+ does not use Write-FileUpdateLog and this function has been deprecated.

When I install mongodb with:

choco install -y mongodb

The following error appeared

Get-ChildItem : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the director
y name must be less than 248 characters.
At C:\ProgramData\chocolatey\chocolateyinstall\helpers\functions\Write-FileUpdateLog.ps1:12 char:23

$originalContents = Get-ChildItem -Recurse $locationToMonitor | Select-Object 

CategoryInfo : ReadError: (C:\CI-Cor\kexin...modules\bl\test:String) [Get-ChildItem], PathTooLongException
FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChildItemCommand

From #154

Thanks for splitting that up! :)

@ferventcoder do you know if mongodb will be correctly installed, regardless of this error?

@asgerhallas That's a good question. I don't know that this is called anymore in choco 0.9.9+. If it is, I want to remove it completely.

For whether mondodb, I can't say. If there is an error, choco considers the install not successful, but the software may be successfully installed on the machine.

@ferventcoder thank you for the reply! I'm running v0.9.9.11 so something seems to be called still... but I have not seen the message for other packages than mongodb, so far. I'm pretty new to chocolatey, but let me know if I can help with this issue in any way.

I wonder if the package itself calls the function then?

It does not look like it, but I'll try to run it again and see if I can get af stack trace.

@ferventcoder it doesn't really output a proper stack trace, but further inspection leads me to Install-ChocolateyZipPackage that still calls Write-FileUpdateLog. And Install-ChocolateyZipPackage is actually called by the mongodb script. Is that considered a problem with the mongo-script or chocolatey?

That would be Chocolatey. Thanks for tracing that.

@ferventcoder My pleasure :) Let me know if there's anything else I can do to resolve the issue.

For choco itself, this issue is fixed by no longer using this. Which was done as part of #616.

Deprioritizing from 0.9.10 and moved the priority to low as the Choco helpers no longer use this helper. We should move it to deprecated and remove it by v1.

Long Path Tool help me a lot when i have an issue like file deleting or renaming the file. Also good to use if file name and file extension is too long.

Since the cmdlet Write-FileUpdateLog is deprecated and will be removed as part of the next release of Chocolatey, this problem will not be fixed, unfortunately. As such I will be closing this issue now.

Please see #2469 to track which cmdlets will be removed in the next version of Chocolatey.