-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[release/10.0] Fix file size estimation when bundling symlinks #119406
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
[release/10.0] Fix file size estimation when bundling symlinks #119406
Conversation
FileInfo.Length will return the size of a symlink, rather than the file itself. On a source-built dotnet SDK, a trivial test project will bundle files like: packs/Microsoft.NETCore.App.Runtime.linux-x64/10.0.0-preview.7.25380.108/runtimes/linux-x64/lib/net10.0/Microsoft.CSharp.dll Which is a symlink to: ../../../../../../../shared/Microsoft.NETCore.App/10.0.0-preview.7.25380.108/Microsoft.CSharp.dll This can result in: > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: The "GenerateBundle" task failed unexpectedly. [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: System.NotSupportedException: Unable to expand length of this stream beyond its capacity. [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at System.IO.UnmanagedMemoryStream.WriteCore(ReadOnlySpan`1 buffer) [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at System.IO.Stream.CopyTo(Stream destination, Int32 bufferSize) [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at Microsoft.NET.HostModel.Bundle.Bundler.AddToBundle(Stream bundle, FileStream file, FileType type) [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at Microsoft.NET.HostModel.Bundle.Bundler.GenerateBundle(IReadOnlyList`1 fileSpecs) [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at Microsoft.NET.Build.Tasks.GenerateBundle.ExecuteCore() [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() [/build/test/test.fsproj] > [...]/Microsoft.NET.Publish.targets(1132,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMo Fixes: b79c4fb
cc @jkoritzinsky @ViktorHofer Does the 'Microsoft.IO.Redist' version and PackageDownloadAndReference look okay? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved. we can merge when ready
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov |
/ba-g Failure is unrelated: #110173 |
Backport of #118732 to release/10.0
/cc @elinor-fung @corngood
Customer Impact
Publishing a single-file bundle fails when any file being bundled is a symlink. Reported (and fixed - thanks @corngood!) externally for source-build as well as internally for CloudBuild.
Regression
.NET 10 Preview 7: b79c4fb
Testing
Automated test added.
Risk
[High/Medium/Low. Justify the indication by mentioning how risks were measured and addressed.]