-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Fix file size estimation when bundling symlinks #118732
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
Conversation
|
Tagging subscribers to this area: @vitek-karas, @agocke |
src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs
Outdated
Show resolved
Hide resolved
src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs
Outdated
Show resolved
Hide resolved
jtschuster
left a comment
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.
Could we also use this helper here
| long appHostSourceLength = new FileInfo(appHostSourceFilePath).Length; |
and here
| var hostLength = new FileInfo(hostSource).Length; |
I moved it to |
src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj
Outdated
Show resolved
Hide resolved
src/installer/managed/Microsoft.NET.HostModel/HostModelUtils.cs
Outdated
Show resolved
Hide resolved
src/installer/managed/Microsoft.NET.HostModel/Microsoft.NET.HostModel.csproj
Outdated
Show resolved
Hide resolved
1e5ebea to
3ccfafa
Compare
I switched the reference to |
8a2dff8 to
4f71141
Compare
be693dc to
7a503a7
Compare
|
@corngood To fix the build breaks, try changing Microsoft.IO.Redist version to 6.0.1 |
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
jtschuster
left a comment
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.
Thank you!
|
/backport to release/10.0 |
|
Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17501524581 |
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:
Which is a symlink to:
This can result in:
Fixes: b79c4fb