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

Support Long Paths #934

Closed
ryazanov-dmitry opened this issue Aug 30, 2016 · 12 comments
Closed

Support Long Paths #934

ryazanov-dmitry opened this issue Aug 30, 2016 · 12 comments

Comments

@ryazanov-dmitry
Copy link

ryazanov-dmitry commented Aug 30, 2016

Original Title: Uninstall backup files path too long - The fully qualified file name must be less than 260 characters

What You Are Seeing?

choco uninstall -y SitefinityCMS
Chocolatey uninstalled 1/1 packages. 0 packages failed.

"C:\ProgramData\chocolatey\choco.exe" install -y SitefinityCMS -source C:\Nuget -force -pre -params "/Environment:Cleanup /InstallRoot:D:\Solution"

What is Expected?

How Did You Get This To Happen? (Steps to Reproduce)

Yesterday worked fine with 0.9.8 version. Nothing was changed in scripts, just updated choco version and it failed.

Output Log

2016-08-30 07:37:36,752 [INFO ] - Chocolatey v0.10.0
2016-08-30 07:37:36,752 [DEBUG] - Chocolatey is running on Windows v 6.3.9600.0
2016-08-30 07:37:36,752 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2016-08-30 07:37:36,752 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2016-08-30 07:37:36,767 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" uninstall -y Company.Web.SitefinityCMS
2016-08-30 07:37:36,767 [DEBUG] - Received arguments: uninstall -y Company.Web.SitefinityCMS
2016-08-30 07:37:36,814 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2016-08-30 07:37:36,830 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2016-08-30 07:37:36,830 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2016-08-30 07:37:36,955 [DEBUG] - The source 'https://chocolatey.org/api/v2/' evaluated to a 'normal' source type
2016-08-30 07:37:36,955 [DEBUG] - 
NOTE: Hiding sensitive configuration data! Please double and triple 
 check to be sure no sensitive data is shown, especially if copying 
 output to a gist for review.
2016-08-30 07:37:36,970 [DEBUG] - Configuration: CommandName='uninstall'|
CacheLocation='C:\Users\S_JNKNS_SLAVE\AppData\Local\Temp\chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://chocolatey.org/api/v2/'|SourceType='normal'|
Debug='False'|Verbose='False'|Force='False'|Noop='False'|
HelpRequested='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='False'|AcceptLicense='True'|
AllowUnofficialBuild='False'|Input='Company.Web.SitefinityCMS'|
AllVersions='False'|SkipPackageInstallProvider='False'|
PackageNames='Company.Web.SitefinityCMS'|Prerelease='False'|
ForceX86='False'|OverrideArguments='False'|NotSilent='False'|
IgnoreDependencies='False'|AllowMultipleVersions='False'|
AllowDowngrade='False'|ForceDependencies='False'|
Information.PlatformType='Windows'|
Information.PlatformVersion='6.3.9600.0'|
Information.PlatformName='Windows Server 2012 R2'|
Information.ChocolateyVersion='0.10.0.0'|
Information.ChocolateyProductVersion='0.10.0'|
Information.FullName='choco, Version=0.10.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64Bit='True'|Information.IsInteractive='False'|
Information.IsUserAdministrator='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Features.AutoUninstaller='True'|
Features.ChecksumFiles='True'|Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseFipsCompliantChecksums='False'|
ListCommand.LocalOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|FeatureCommand.Command='unknown'|
ConfigCommand.Command='unknown'|PinCommand.Command='unknown'|
2016-08-30 07:37:36,970 [DEBUG] - _ Chocolatey:ChocolateyUninstallCommand - Normal Run Mode _
2016-08-30 07:37:36,986 [INFO ] - Uninstalling the following packages:
2016-08-30 07:37:36,986 [INFO ] - Company.Web.SitefinityCMS
2016-08-30 07:37:37,033 [DEBUG] - Running list with the following filter = ''
2016-08-30 07:37:37,033 [DEBUG] - --- Start of List ---
2016-08-30 07:37:37,330 [DEBUG] - Company.Web.SitefinityCMS 2.0.122-pre
2016-08-30 07:37:37,330 [DEBUG] - chocolatey 0.10.0
2016-08-30 07:37:37,330 [DEBUG] - notepadplusplus 6.7.4
2016-08-30 07:37:37,330 [DEBUG] - redis-64 2.8.2101
2016-08-30 07:37:37,330 [DEBUG] - sqlserverdatatools2012 11.1.41025
2016-08-30 07:37:37,330 [DEBUG] - --- End of List ---
2016-08-30 07:37:37,767 [DEBUG] - Backing up existing Company.Web.SitefinityCMS prior to upgrade.
2016-08-30 07:37:37,767 [DEBUG] - Moving 'C:\ProgramData\chocolatey\lib\Company.Web.SitefinityCMS'
 to 'C:\ProgramData\chocolatey\lib-bkp\Company.Web.SitefinityCMS'
 /*Deleted all package content*/
2016-08-30 07:38:08,798 [INFO ] - 
Company.Web.SitefinityCMS v2.0.122-pre
2016-08-30 07:38:08,876 [DEBUG] - Removing shim for WebConfigTransformRunner.exe at 'C:\ProgramData\chocolatey\bin\WebConfigTransformRunner.exe
2016-08-30 07:38:08,876 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\bin\WebConfigTransformRunner.exe".
2016-08-30 07:38:08,876 [DEBUG] - Removing shim for WebConfigTransformRunner.vshost.exe at 'C:\ProgramData\chocolatey\bin\WebConfigTransformRunner.vshost.exe
2016-08-30 07:38:08,892 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\bin\WebConfigTransformRunner.vshost.exe".
2016-08-30 07:38:08,923 [INFO ] -  Skipping auto uninstaller - No registry snapshot.
2016-08-30 07:38:08,923 [DEBUG] - Calling command ['"C:\Windows\System32\shutdown.exe" /a']
2016-08-30 07:38:08,954 [DEBUG] - Command ['"C:\Windows\System32\shutdown.exe" /a'] exited with '1116'
2016-08-30 07:38:08,954 [DEBUG] - Attempting to delete directory "C:\ProgramData\chocolatey\.chocolatey\Company.Web.SitefinityCMS.2.0.122-pre".
2016-08-30 07:38:08,954 [DEBUG] - Attempting to delete directory "C:\ProgramData\chocolatey\lib-bkp\Company.web.sitefinitycms".
2016-08-30 07:38:16,173 [ERROR] - Company.Web.SitefinityCMS not uninstalled. An error occurred during uninstall:
 The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2016-08-30 07:38:16,204 [WARN ] - 
Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
2016-08-30 07:38:16,219 [INFO ] - 
2016-08-30 07:38:16,219 [ERROR] - Failures
2016-08-30 07:38:16,235 [ERROR] -  - Company.web.sitefinitycms (exited 1) - Company.Web.SitefinityCMS not uninstalled. An error occurred during uninstall:
 The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
2016-08-30 07:38:16,235 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2016-08-30 07:38:17,298 [DEBUG] - Exiting with 1
2016-08-30 07:38:17,563 [DEBUG] - Configured chocolatey.infrastructure.logging.log4net.config.xml from assembly choco, Version=0.10.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb
2016-08-30 07:38:17,563 [DEBUG] - Configured chocolatey.infrastructure.logging.log4net.config.xml from assembly choco, Version=0.10.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb
2016-08-30 07:38:17,594 [DEBUG] - XmlConfiguration is now operational
2016-08-30 07:38:17,813 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\config\chocolatey.config.update".
2016-08-30 07:38:17,829 [INFO ] - ============================================================
2016-08-30 07:38:17,829 [INFO ] - Chocolatey v0.10.0
2016-08-30 07:38:17,844 [DEBUG] - Chocolatey is running on Windows v 6.3.9600.0
2016-08-30 07:38:17,844 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2016-08-30 07:38:17,844 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2016-08-30 07:38:17,844 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" install -y Company.Web.SitefinityCMS -source C:\Nuget -force -pre -params "/Environment:Cleanup /InstallRoot:D:\Solution\"
2016-08-30 07:38:17,844 [DEBUG] - Received arguments: install -y Company.Web.SitefinityCMS -source C:\Nuget -force -pre -params /Environment:Cleanup /InstallRoot:D:\Solution"

Config

NOTE: Hiding sensitive configuration data! Please double and triple 
 check to be sure no sensitive data is shown, especially if copying 
 output to a gist for review.
2016-08-30 13:08:29,551 [DEBUG] - Configuration: CommandName='install'|
CacheLocation='C:\Users\%user%\AppData\Local\Temp\chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='C:\Nuget'|SourceType='normal'|Debug='False'|Verbose='False'|
Force='True'|Noop='False'|HelpRequested='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='False'|AcceptLicense='True'|
AllowUnofficialBuild='False'|Input='SitefinityCMS'|
AllVersions='False'|SkipPackageInstallProvider='False'|
PackageNames='SitefinityCMS'|Prerelease='True'|
ForceX86='False'|OverrideArguments='False'|NotSilent='False'|
PackageParameters='/Environment:Cleanup /InstallRoot:D:\Solution"'|

IgnoreDependencies='False'|AllowMultipleVersions='False'|
AllowDowngrade='False'|ForceDependencies='False'|
Information.PlatformType='Windows'|
Information.PlatformVersion='6.3.9600.0'|
Information.PlatformName='Windows Server 2012 R2'|
Information.ChocolateyVersion='0.10.0.0'|
Information.ChocolateyProductVersion='0.10.0'|
Information.FullName='choco, Version=0.10.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64Bit='True'|Information.IsInteractive='True'|
Information.IsUserAdministrator='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Features.AutoUninstaller='True'|
Features.ChecksumFiles='True'|Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseFipsCompliantChecksums='False'|
ListCommand.LocalOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|FeatureCommand.Command='unknown'|
ConfigCommand.Command='unknown'|PinCommand.Command='unknown'|
@ferventcoder
Copy link
Member

Hello @dmitrijs-rjazanovs - we need to see full output log please (minus any sensitive data). It will help us see what is running and what the script looks like so we can provide support.

@ryazanov-dmitry
Copy link
Author

@ferventcoder Hi Rob. Updated output log. It is all i can get. Thanks.

@ferventcoder
Copy link
Member

Okay, the problem appears to be that there are some files inside the package that have a path much longer than the .NET framework (and by extension Chocolatey) can deal with. So we'll need to find a way around that.

@ferventcoder
Copy link
Member

ferventcoder commented Sep 1, 2016

Slightly OT- I did notice this issue for install:

PackageParameters='/Environment:Cleanup /InstallRoot:D:\Solution"'| Note the extra double quote here.

choco install -y Company.Web.SitefinityCMS -source C:\Nuget -force -pre -params "/Environment:Cleanup /InstallRoot:D:\Solution\"

Should be passed as:
choco install -y Company.Web.SitefinityCMS -source C:\Nuget -force -pre -params "'/Environment:Cleanup /InstallRoot:D:\Solution\'" - see https://chocolatey.org/docs/commands-reference#how-to-pass-options-switches (quote values)

@ferventcoder ferventcoder modified the milestones: 0.10.2, 0.10.1 Sep 15, 2016
@ferventcoder ferventcoder changed the title After 0.10.0 upgrade "install" command fails with "%packagename% not uninstalled" error Uninstall backup files path too long - The fully qualified file name must be less than 260 characters Sep 15, 2016
@ferventcoder ferventcoder modified the milestones: 0.10.1, 0.10.2 Sep 15, 2016
@ferventcoder ferventcoder changed the title Uninstall backup files path too long - The fully qualified file name must be less than 260 characters Support Long Paths Sep 17, 2016
@ferventcoder
Copy link
Member

This is fixed for 0.10.1

ferventcoder added a commit that referenced this issue Sep 17, 2016
Installing a package or working with packaging could mean paths that
are over 260 characters (MAX_PATH). Sometimes backing up a path will
take it over 260 characters resulting in errors when attempting to
upgrade/uninstall packages that have pretty long paths.

This is done by using the AlphaFS library. Unfortunately it doesn't use
the .NET Framework methods and check lengths before it uses its
implementation with native calls so it doesn't appear to be Mono safe.
This meant the implementation of IFileSystem that is being used will
need to perform those checks and fall back on errors.

This also means the addition of dynamics to support switching between
two interpretations of FileInfo and DirectoryInfo.
ferventcoder added a commit that referenced this issue Sep 17, 2016
* stable:
  (GH-934) Support Paths > 260 Characters
  (GH-943) Skip Locked Pending Files
  (GH-943) Lock Pending File Until Operation Completes
  (GH-943) IFileSystem - Open File Exclusively
  (GH-839) More switch names for dependency apply
@queensengineer
Copy link

queensengineer commented Nov 1, 2016

Leaving this here for people to find:

Chocolatey NuGet.Core first unzips the package to a temp folder as follows:
C:\Users\xxxxx.xxxxxxx\AppData\Local\Temp\2\chocolatey\NuGetScratch\49722c8a-b74e-4980-a050-39817cee9965\5vptb40r.ne1\ .....your package path here...
That is a 120 path characters that you can't use in side the package.
Path lengths in the package are limited to 140 unless you change the cacheLocation like so
"choco config set cachelocation c:\temp"
for example.

@nmulvihill
Copy link

This has been closed and labelled as fixed. However I still get errors with applications with paths longer than 260 characters.

@ferventcoder
Copy link
Member

@nmulvihill Chocolatey supports longer paths, but that doesn't mean that Windows or other things do. If you have a log, can you show the relevant parts of the error message (along with other messages surrounding it)? There may be an issue where it sees an error, but handles it without issue by flipping over to long paths.

@nmulvihill
Copy link

Chocolatey v0.10.7
Installing the following packages:
bmc
By installing you accept licenses for the packages.
Progress: Downloading bmc 9.0... 100%
bmc not installed. An error occurred during installation:
The specified path, file name, or both are too long. The fully qualified file n
ame must be less than 260 characters, and the directory name must be less than 2
48 characters.
bmc package files install completed. Performing other installation steps.
The install of bmc was NOT successful.
bmc not installed. An error occurred during installation:
The specified path, file name, or both are too long. The fully qualified file n
ame must be less than 260 characters, and the directory name must be less than 2
48 characters.

Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures

  • bmc (exited 1) - bmc not installed. An error occurred during installation:
    The specified path, file name, or both are too long. The fully qualified file n
    ame must be less than 260 characters, and the directory name must be less than 2
    48 characters.

@ferventcoder
Copy link
Member

@nmulvihill That is likely in the NuGet.Core codebase. We'll need to get in there and fix it to support this as well. Would it be too much trouble to have you open a new issue with that log?

@nmulvihill
Copy link

Not at all!
Here is the issue: #1361

@rockobonaparte
Copy link

I was curious where this stands because we are internally about to get into a situation where this might matter. We have some custom packages with grotesque filenames to contain very specific information about the nature of the files inside. The current sample of filenames won't currently exceed 260 characters, but the combination of the filename with their path probably would.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants