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

choco pack command fails with error on Linux when using file greater than 2 GB #2278

Closed
amanbansal86 opened this issue May 23, 2021 · 4 comments

Comments

@amanbansal86
Copy link

Running this on latest stable version of mono and choco with 64 bit. System have enough resources still we are facing this issue.

System.IO.IOException: Stream was too long.
at System.IO.MemoryStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00067] in :0
at System.IO.Packaging.ZipPartStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00027] in <900d166c3e9f4f979a5029af353f68ca>:0
at System.IO.Stream.CopyTo (System.IO.Stream destination, System.Int32 bufferSize) [0x00016] in :0
at System.IO.Stream.CopyTo (System.IO.Stream destination) [0x00007] in :0
at (wrapper remoting-invoke-with-check) System.IO.Stream.CopyTo(System.IO.Stream)
at NuGet.PackageBuilder.CreatePart (System.IO.Packaging.Package package, System.String path, System.IO.Stream sourceStream) [0x00031] in <23136ac9008c43ea82679714836f769c>:0
at NuGet.PackageBuilder.WriteFiles (System.IO.Packaging.Package package) [0x00043] in <23136ac9008c43ea82679714836f769c>:0
at NuGet.PackageBuilder.Save (System.IO.Stream stream) [0x000ca] in <23136ac9008c43ea82679714836f769c>:0
at chocolatey.infrastructure.app.nuget.NugetPack.BuildPackage (NuGet.PackageBuilder builder, chocolatey.infrastructure.filesystem.IFileSystem fileSystem, System.String outputPath) [0x00044] in <208749e11a5d442db77f2fd2ce0f8b25>:0
at chocolatey.infrastructure.app.services.NugetService.pack_run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config) [0x00219] in <208749e11a5d442db77f2fd2ce0f8b25>:0
at chocolatey.infrastructure.app.services.ChocolateyPackageService.pack_run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config) [0x00020] in <208749e11a5d442db77f2fd2ce0f8b25>:0
at chocolatey.infrastructure.app.commands.ChocolateyPackCommand.run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration configuration) [0x00000] in <208749e11a5d442db77f2fd2ce0f8b25>:0
at chocolatey.infrastructure.app.runners.GenericRunner.run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config, SimpleInjector.Container container, System.Boolean isConsole, System.Action`1[T] parseArgs) [0x000e4] in <208749e11a5d442db77f2fd2ce0f8b25>:0
at chocolatey.infrastructure.app.runners.ConsoleApplication.run (System.String[] args, chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config, SimpleInjector.Container container) [0x000d6] in <208749e11a5d442db77f2fd2ce0f8b25>:0
at chocolatey.console.Program.Main (System.String[] args) [0x0036a] in <51670c769f7b4c16baf62bcf1e2167c6>:0
Exiting with 1

@TheCakeIsNaOH
Copy link
Member

TheCakeIsNaOH commented Feb 5, 2022

I am able to reproduce this. I created a 3gb file with fallocate -l 3G file.exe and tried to pack it into a package, and it failed.

Log

choco pack --verbose --debug
Chocolatey v0.12.1
Chocolatey is running on Linux v 5.15.0.0
Attempting to delete file "/opt/chocolatey/chocolatey.dll.old".
Attempting to delete file "/opt/chocolatey/choco.exe.old".
Command line: /opt/chocolatey/choco.exe pack --verbose --debug
Received arguments: pack --verbose --debug
RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
Sending message 'PreRunMessage' out if there are subscribers...
[Pending] Removing all pending packages that should not be considered installed...
Performing validation checks.
Global Configuration Validation Checks:
 - Package Exit Code / Exit On Reboot = Checked
System State Validation Checks:
The source 'https://community.chocolatey.org/api/v2/' evaluated to a 'normal' source type

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.
Configuration: CommandName='pack'|CacheLocation='/tmp/chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://community.chocolatey.org/api/v2/'|SourceType='normal'|
Debug='True'|Verbose='True'|Trace='False'|Force='False'|Noop='False'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|AllVersions='False'|
SkipPackageInstallProvider='False'|Prerelease='False'|ForceX86='False'|
OverrideArguments='False'|NotSilent='False'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Linux'|
Information.PlatformVersion='5.15.0.0'|
Information.PlatformName='Linux'|
Information.ChocolateyVersion='0.12.1.0'|
Information.ChocolateyProductVersion='0.12.1'|
Information.FullName='chocolatey, Version=0.12.1.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='False'|
redacted
Information.IsUserAdministrator='False'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='False'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory=''|

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.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
ListCommand.LocalOnly='False'|ListCommand.IdOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.ByTagOnly='False'|ListCommand.IdStartsWith='False'|
ListCommand.OrderByPopularity='False'|ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
TemplateCommand.Command='unknown'|
_ Chocolatey:ChocolateyPackCommand - Normal Run Mode _
Attempting to build package from 'package.nuspec'.
tools/file.exe
Attempting to delete file "package.nupkg".
Sending message 'PostRunMessage' out if there are subscribers...
Chocolatey had an error occur:
System.IO.IOException: Stream was too long.
  at System.IO.MemoryStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00067] in <533173d24dae460899d2b10975534bb0>:0
  at System.IO.Packaging.ZipPartStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00027] in <8f8261ee75c34c9cb0a71d0993973faa>:0
  at System.IO.Stream.CopyTo (System.IO.Stream destination, System.Int32 bufferSize) [0x00016] in <533173d24dae460899d2b10975534bb0>:0
  at System.IO.Stream.CopyTo (System.IO.Stream destination) [0x00007] in <533173d24dae460899d2b10975534bb0>:0
  at (wrapper remoting-invoke-with-check) System.IO.Stream.CopyTo(System.IO.Stream)
  at NuGet.PackageBuilder.CreatePart (System.IO.Packaging.Package package, System.String path, System.IO.Stream sourceStream) [0x00031] in <019794aec39c494eaec480b808a55c43>:0
  at NuGet.PackageBuilder.WriteFiles (System.IO.Packaging.Package package) [0x00043] in <019794aec39c494eaec480b808a55c43>:0
  at NuGet.PackageBuilder.Save (System.IO.Stream stream) [0x000ca] in <019794aec39c494eaec480b808a55c43>:0
  at chocolatey.infrastructure.app.nuget.NugetPack.BuildPackage (NuGet.PackageBuilder builder, chocolatey.infrastructure.filesystem.IFileSystem fileSystem, System.String outputPath) [0x00056] in <042f1531e430495a81c1ebd4c856ce6a>:0
  at chocolatey.infrastructure.app.services.NugetService.pack_run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config) [0x001fb] in <042f1531e430495a81c1ebd4c856ce6a>:0
  at chocolatey.infrastructure.app.services.ChocolateyPackageService.pack_run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config) [0x00020] in <042f1531e430495a81c1ebd4c856ce6a>:0
  at chocolatey.infrastructure.app.commands.ChocolateyPackCommand.run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration configuration) [0x00000] in <042f1531e430495a81c1ebd4c856ce6a>:0
  at chocolatey.infrastructure.app.runners.GenericRunner.run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config, SimpleInjector.Container container, System.Boolean isConsole, System.Action`1[T] parseArgs) [0x000e4] in <042f1531e430495a81c1ebd4c856ce6a>:0
  at chocolatey.infrastructure.app.runners.ConsoleApplication.run (System.String[] args, chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config, SimpleInjector.Container container) [0x000d6] in <042f1531e430495a81c1ebd4c856ce6a>:0
  at chocolatey.console.Program.Main (System.String[] args) [0x0036a] in <37043d6ac0644556bcd47f72b2e44318>:0
Exiting with 1

@TheCakeIsNaOH
Copy link
Member

This appears to be an issue with mono:
mono/mono#21424

@TheCakeIsNaOH
Copy link
Member

This was fixed by #2740, as the new NuGet Client libraries use a different method to write the .nupkg.
I created a 3gb file with actual pusdorandom data using head -c 3G </dev/urandom >file.exe, and a build of choco from dev was able to pack it into a package.

@TheCakeIsNaOH TheCakeIsNaOH added this to the 2.0.0 milestone Jan 4, 2023
@gep13 gep13 changed the title Choco Pack command fails with error stream too long on linux with single file greater than 2 GB choco pack command fails with error on Linux when using file greater than 2 GB Jan 24, 2023
@gep13 gep13 changed the title choco pack command fails with error on Linux when using file greater than 2 GB choco pack command fails with error on Linux when using file greater than 2 GB Jan 24, 2023
@pauby pauby changed the title choco pack command fails with error on Linux when using file greater than 2 GB choco pack command fails with error on Linux when using file greater than 2 GB May 31, 2023
@choco-bot
Copy link

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

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

4 participants