Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/System.Formats.Tar/System.Formats.Tar.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Tests", "tests\System.Formats.Tar.Tests.csproj", "{6FD1E284-7B50-4077-B73A-5B31CB0E3577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Manual.Tests", "tests\Manual\System.Formats.Tar.Manual.Tests.csproj", "{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69}"
Expand DownExpand Up@@ -67,6 +69,10 @@ Global
{A00011A0-E609-4A49-B893-EBFC72C98707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.Build.0 = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All@@ -78,9 +84,12 @@ Global
{E0B882C6-2082-45F2-806E-568461A61975} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{9F751C2B-56DD-4604-A3F3-568627F8C006} = {55A8C7E4-925C-4F21-B68B-CEFC19137A4B}
{6FD1E284-7B50-4077-B73A-5B31CB0E3577} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{50E6D5FD-0E06-4D07-966E-C28E5448A1D3} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9B8DA67-C83B-466D-907C-9541CDBDCFEF}
Expand Down

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -283,8 +283,12 @@ private void WriteEntryInternal(TarEntry entry)

switch (entry.Format)
{
case TarEntryFormat.V7 or TarEntryFormat.Ustar:
entry._header.WriteAs(entry.Format, _archiveStream, buffer);
case TarEntryFormat.V7:
entry._header.WriteAsV7(_archiveStream, buffer);
break;

case TarEntryFormat.Ustar:
entry._header.WriteAsUstar(_archiveStream, buffer);
break;

case TarEntryFormat.Pax:
Expand DownExpand Up@@ -321,7 +325,8 @@ private async Task WriteEntryAsyncInternal(TarEntry entry, CancellationToken can

Task task = entry.Format switch
{
TarEntryFormat.V7 or TarEntryFormat.Ustar => entry._header.WriteAsAsync(entry.Format, _archiveStream, buffer, cancellationToken),
TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
Expand Down
93 changes: 93 additions & 0 deletions src/libraries/System.Formats.Tar/tests/Manual/ManualTests.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTests : TarTestsBase
{
public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS"));

public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryData()
{
foreach (bool unseekableStream in new[] { false, true })
{
foreach (TarEntryFormat entryFormat in new[] { TarEntryFormat.V7, TarEntryFormat.Ustar, TarEntryFormat.Gnu, TarEntryFormat.Pax })
{
yield return new object[] { entryFormat, LegacyMaxFileSize, unseekableStream };
}

// Pax supports unlimited size files.
yield return new object[] { TarEntryFormat.Pax, LegacyMaxFileSize + 1, unseekableStream };
}
}

[ConditionalTheory(nameof(ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryData))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public void WriteEntry_LongFileSize(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
writer.WriteEntry(writeEntry);
}

tarFile.Position = 0;

// Read archive back.
using TarReader reader = new TarReader(s);
TarEntry entry = reader.GetNextEntry();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlySpan<byte> dummyData = SimulatedDataStream.DummyData.Span;

// Read the first bytes.
Span<byte> buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Span<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = dataStream.Read(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(reader.GetNextEntry());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTestsAsync : TarTestsBase
{
public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryDataAsync()
// Fixes error xUnit1015: MemberData needs to be in the same class
=> ManualTests.WriteEntry_LongFileSize_TheoryData();

[ConditionalTheory(nameof(ManualTests.ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryDataAsync))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public async Task WriteEntry_LongFileSizeAsync(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
await using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

await using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
await writer.WriteEntryAsync(writeEntry);
}

tarFile.Position = 0;

// Read the archive back.
await using TarReader reader = new TarReader(s);
TarEntry entry = await reader.GetNextEntryAsync();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlyMemory<byte> dummyData = SimulatedDataStream.DummyData;

// Read the first bytes.
byte[] buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.AsSpan().Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Memory<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = await dataStream.ReadAsync(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(await reader.GetNextEntryAsync());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<ItemGroup>
<Compile Include="ManualTests.cs" />
<Compile Include="ManualTestsAsync.cs" />
<Compile Include="..\TarTestsBase.cs" />
<Compile Include="..\SimulatedDataStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
<Compile Include="$(CommonTestPath)System\IO\TempDirectory.cs" Link="Common\System\IO\TempDirectory.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
</ItemGroup>
</Project>
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,8 @@
<Compile Include="TarTestsBase.Ustar.cs" />
<Compile Include="TarTestsBase.V7.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.File.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Base.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Ustar.Tests.cs" />
Expand All@@ -74,7 +72,6 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\ReparsePointUtilities.cs" Link="Common\System\IO\ReparsePointUtilities.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
<!-- Windows specific files -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
Expand Down

This file was deleted.

Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Tar: Fix PAX regression when handling the size of really long unseekable data streams by carlossanlop · Pull Request #88280 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/System.Formats.Tar/System.Formats.Tar.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Tests", "tests\System.Formats.Tar.Tests.csproj", "{6FD1E284-7B50-4077-B73A-5B31CB0E3577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Manual.Tests", "tests\Manual\System.Formats.Tar.Manual.Tests.csproj", "{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69}"
Expand DownExpand Up@@ -67,6 +69,10 @@ Global
{A00011A0-E609-4A49-B893-EBFC72C98707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.Build.0 = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All@@ -78,9 +84,12 @@ Global
{E0B882C6-2082-45F2-806E-568461A61975} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{9F751C2B-56DD-4604-A3F3-568627F8C006} = {55A8C7E4-925C-4F21-B68B-CEFC19137A4B}
{6FD1E284-7B50-4077-B73A-5B31CB0E3577} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{50E6D5FD-0E06-4D07-966E-C28E5448A1D3} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9B8DA67-C83B-466D-907C-9541CDBDCFEF}
Expand Down

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -283,8 +283,12 @@ private void WriteEntryInternal(TarEntry entry)

switch (entry.Format)
{
case TarEntryFormat.V7 or TarEntryFormat.Ustar:
entry._header.WriteAs(entry.Format, _archiveStream, buffer);
case TarEntryFormat.V7:
entry._header.WriteAsV7(_archiveStream, buffer);
break;

case TarEntryFormat.Ustar:
entry._header.WriteAsUstar(_archiveStream, buffer);
break;

case TarEntryFormat.Pax:
Expand DownExpand Up@@ -321,7 +325,8 @@ private async Task WriteEntryAsyncInternal(TarEntry entry, CancellationToken can

Task task = entry.Format switch
{
TarEntryFormat.V7 or TarEntryFormat.Ustar => entry._header.WriteAsAsync(entry.Format, _archiveStream, buffer, cancellationToken),
TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
Expand Down
93 changes: 93 additions & 0 deletions src/libraries/System.Formats.Tar/tests/Manual/ManualTests.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTests : TarTestsBase
{
public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS"));

public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryData()
{
foreach (bool unseekableStream in new[] { false, true })
{
foreach (TarEntryFormat entryFormat in new[] { TarEntryFormat.V7, TarEntryFormat.Ustar, TarEntryFormat.Gnu, TarEntryFormat.Pax })
{
yield return new object[] { entryFormat, LegacyMaxFileSize, unseekableStream };
}

// Pax supports unlimited size files.
yield return new object[] { TarEntryFormat.Pax, LegacyMaxFileSize + 1, unseekableStream };
}
}

[ConditionalTheory(nameof(ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryData))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public void WriteEntry_LongFileSize(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
writer.WriteEntry(writeEntry);
}

tarFile.Position = 0;

// Read archive back.
using TarReader reader = new TarReader(s);
TarEntry entry = reader.GetNextEntry();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlySpan<byte> dummyData = SimulatedDataStream.DummyData.Span;

// Read the first bytes.
Span<byte> buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Span<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = dataStream.Read(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(reader.GetNextEntry());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTestsAsync : TarTestsBase
{
public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryDataAsync()
// Fixes error xUnit1015: MemberData needs to be in the same class
=> ManualTests.WriteEntry_LongFileSize_TheoryData();

[ConditionalTheory(nameof(ManualTests.ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryDataAsync))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public async Task WriteEntry_LongFileSizeAsync(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
await using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

await using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
await writer.WriteEntryAsync(writeEntry);
}

tarFile.Position = 0;

// Read the archive back.
await using TarReader reader = new TarReader(s);
TarEntry entry = await reader.GetNextEntryAsync();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlyMemory<byte> dummyData = SimulatedDataStream.DummyData;

// Read the first bytes.
byte[] buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.AsSpan().Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Memory<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = await dataStream.ReadAsync(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(await reader.GetNextEntryAsync());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<ItemGroup>
<Compile Include="ManualTests.cs" />
<Compile Include="ManualTestsAsync.cs" />
<Compile Include="..\TarTestsBase.cs" />
<Compile Include="..\SimulatedDataStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
<Compile Include="$(CommonTestPath)System\IO\TempDirectory.cs" Link="Common\System\IO\TempDirectory.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
</ItemGroup>
</Project>
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,8 @@
<Compile Include="TarTestsBase.Ustar.cs" />
<Compile Include="TarTestsBase.V7.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.File.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Base.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Ustar.Tests.cs" />
Expand All@@ -74,7 +72,6 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\ReparsePointUtilities.cs" Link="Common\System\IO\ReparsePointUtilities.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
<!-- Windows specific files -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
Expand Down

This file was deleted.

Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Tar: Fix PAX regression when handling the size of really long unseekable data streams by carlossanlop · Pull Request #88280 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/System.Formats.Tar/System.Formats.Tar.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Tests", "tests\System.Formats.Tar.Tests.csproj", "{6FD1E284-7B50-4077-B73A-5B31CB0E3577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Manual.Tests", "tests\Manual\System.Formats.Tar.Manual.Tests.csproj", "{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69}"
Expand DownExpand Up@@ -67,6 +69,10 @@ Global
{A00011A0-E609-4A49-B893-EBFC72C98707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.Build.0 = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All@@ -78,9 +84,12 @@ Global
{E0B882C6-2082-45F2-806E-568461A61975} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{9F751C2B-56DD-4604-A3F3-568627F8C006} = {55A8C7E4-925C-4F21-B68B-CEFC19137A4B}
{6FD1E284-7B50-4077-B73A-5B31CB0E3577} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{50E6D5FD-0E06-4D07-966E-C28E5448A1D3} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9B8DA67-C83B-466D-907C-9541CDBDCFEF}
Expand Down

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -283,8 +283,12 @@ private void WriteEntryInternal(TarEntry entry)

switch (entry.Format)
{
case TarEntryFormat.V7 or TarEntryFormat.Ustar:
entry._header.WriteAs(entry.Format, _archiveStream, buffer);
case TarEntryFormat.V7:
entry._header.WriteAsV7(_archiveStream, buffer);
break;

case TarEntryFormat.Ustar:
entry._header.WriteAsUstar(_archiveStream, buffer);
break;

case TarEntryFormat.Pax:
Expand DownExpand Up@@ -321,7 +325,8 @@ private async Task WriteEntryAsyncInternal(TarEntry entry, CancellationToken can

Task task = entry.Format switch
{
TarEntryFormat.V7 or TarEntryFormat.Ustar => entry._header.WriteAsAsync(entry.Format, _archiveStream, buffer, cancellationToken),
TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
Expand Down
93 changes: 93 additions & 0 deletions src/libraries/System.Formats.Tar/tests/Manual/ManualTests.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTests : TarTestsBase
{
public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS"));

public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryData()
{
foreach (bool unseekableStream in new[] { false, true })
{
foreach (TarEntryFormat entryFormat in new[] { TarEntryFormat.V7, TarEntryFormat.Ustar, TarEntryFormat.Gnu, TarEntryFormat.Pax })
{
yield return new object[] { entryFormat, LegacyMaxFileSize, unseekableStream };
}

// Pax supports unlimited size files.
yield return new object[] { TarEntryFormat.Pax, LegacyMaxFileSize + 1, unseekableStream };
}
}

[ConditionalTheory(nameof(ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryData))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public void WriteEntry_LongFileSize(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
writer.WriteEntry(writeEntry);
}

tarFile.Position = 0;

// Read archive back.
using TarReader reader = new TarReader(s);
TarEntry entry = reader.GetNextEntry();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlySpan<byte> dummyData = SimulatedDataStream.DummyData.Span;

// Read the first bytes.
Span<byte> buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Span<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = dataStream.Read(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(reader.GetNextEntry());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTestsAsync : TarTestsBase
{
public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryDataAsync()
// Fixes error xUnit1015: MemberData needs to be in the same class
=> ManualTests.WriteEntry_LongFileSize_TheoryData();

[ConditionalTheory(nameof(ManualTests.ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryDataAsync))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public async Task WriteEntry_LongFileSizeAsync(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
await using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

await using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
await writer.WriteEntryAsync(writeEntry);
}

tarFile.Position = 0;

// Read the archive back.
await using TarReader reader = new TarReader(s);
TarEntry entry = await reader.GetNextEntryAsync();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlyMemory<byte> dummyData = SimulatedDataStream.DummyData;

// Read the first bytes.
byte[] buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.AsSpan().Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Memory<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = await dataStream.ReadAsync(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(await reader.GetNextEntryAsync());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<ItemGroup>
<Compile Include="ManualTests.cs" />
<Compile Include="ManualTestsAsync.cs" />
<Compile Include="..\TarTestsBase.cs" />
<Compile Include="..\SimulatedDataStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
<Compile Include="$(CommonTestPath)System\IO\TempDirectory.cs" Link="Common\System\IO\TempDirectory.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
</ItemGroup>
</Project>
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,8 @@
<Compile Include="TarTestsBase.Ustar.cs" />
<Compile Include="TarTestsBase.V7.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.File.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Base.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Ustar.Tests.cs" />
Expand All@@ -74,7 +72,6 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\ReparsePointUtilities.cs" Link="Common\System\IO\ReparsePointUtilities.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
<!-- Windows specific files -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
Expand Down

This file was deleted.

Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Tar: Fix PAX regression when handling the size of really long unseekable data streams by carlossanlop · Pull Request #88280 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/System.Formats.Tar/System.Formats.Tar.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Tests", "tests\System.Formats.Tar.Tests.csproj", "{6FD1E284-7B50-4077-B73A-5B31CB0E3577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Manual.Tests", "tests\Manual\System.Formats.Tar.Manual.Tests.csproj", "{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69}"
Expand DownExpand Up@@ -67,6 +69,10 @@ Global
{A00011A0-E609-4A49-B893-EBFC72C98707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.Build.0 = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All@@ -78,9 +84,12 @@ Global
{E0B882C6-2082-45F2-806E-568461A61975} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{9F751C2B-56DD-4604-A3F3-568627F8C006} = {55A8C7E4-925C-4F21-B68B-CEFC19137A4B}
{6FD1E284-7B50-4077-B73A-5B31CB0E3577} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{50E6D5FD-0E06-4D07-966E-C28E5448A1D3} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9B8DA67-C83B-466D-907C-9541CDBDCFEF}
Expand Down

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -283,8 +283,12 @@ private void WriteEntryInternal(TarEntry entry)

switch (entry.Format)
{
case TarEntryFormat.V7 or TarEntryFormat.Ustar:
entry._header.WriteAs(entry.Format, _archiveStream, buffer);
case TarEntryFormat.V7:
entry._header.WriteAsV7(_archiveStream, buffer);
break;

case TarEntryFormat.Ustar:
entry._header.WriteAsUstar(_archiveStream, buffer);
break;

case TarEntryFormat.Pax:
Expand DownExpand Up@@ -321,7 +325,8 @@ private async Task WriteEntryAsyncInternal(TarEntry entry, CancellationToken can

Task task = entry.Format switch
{
TarEntryFormat.V7 or TarEntryFormat.Ustar => entry._header.WriteAsAsync(entry.Format, _archiveStream, buffer, cancellationToken),
TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
Expand Down
93 changes: 93 additions & 0 deletions src/libraries/System.Formats.Tar/tests/Manual/ManualTests.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTests : TarTestsBase
{
public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS"));

public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryData()
{
foreach (bool unseekableStream in new[] { false, true })
{
foreach (TarEntryFormat entryFormat in new[] { TarEntryFormat.V7, TarEntryFormat.Ustar, TarEntryFormat.Gnu, TarEntryFormat.Pax })
{
yield return new object[] { entryFormat, LegacyMaxFileSize, unseekableStream };
}

// Pax supports unlimited size files.
yield return new object[] { TarEntryFormat.Pax, LegacyMaxFileSize + 1, unseekableStream };
}
}

[ConditionalTheory(nameof(ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryData))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public void WriteEntry_LongFileSize(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
writer.WriteEntry(writeEntry);
}

tarFile.Position = 0;

// Read archive back.
using TarReader reader = new TarReader(s);
TarEntry entry = reader.GetNextEntry();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlySpan<byte> dummyData = SimulatedDataStream.DummyData.Span;

// Read the first bytes.
Span<byte> buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Span<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = dataStream.Read(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(reader.GetNextEntry());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTestsAsync : TarTestsBase
{
public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryDataAsync()
// Fixes error xUnit1015: MemberData needs to be in the same class
=> ManualTests.WriteEntry_LongFileSize_TheoryData();

[ConditionalTheory(nameof(ManualTests.ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryDataAsync))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public async Task WriteEntry_LongFileSizeAsync(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
await using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

await using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
await writer.WriteEntryAsync(writeEntry);
}

tarFile.Position = 0;

// Read the archive back.
await using TarReader reader = new TarReader(s);
TarEntry entry = await reader.GetNextEntryAsync();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlyMemory<byte> dummyData = SimulatedDataStream.DummyData;

// Read the first bytes.
byte[] buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.AsSpan().Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Memory<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = await dataStream.ReadAsync(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(await reader.GetNextEntryAsync());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<ItemGroup>
<Compile Include="ManualTests.cs" />
<Compile Include="ManualTestsAsync.cs" />
<Compile Include="..\TarTestsBase.cs" />
<Compile Include="..\SimulatedDataStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
<Compile Include="$(CommonTestPath)System\IO\TempDirectory.cs" Link="Common\System\IO\TempDirectory.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
</ItemGroup>
</Project>
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,8 @@
<Compile Include="TarTestsBase.Ustar.cs" />
<Compile Include="TarTestsBase.V7.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.File.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Base.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Ustar.Tests.cs" />
Expand All@@ -74,7 +72,6 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\ReparsePointUtilities.cs" Link="Common\System\IO\ReparsePointUtilities.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
<!-- Windows specific files -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
Expand Down

This file was deleted.

Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' Tar: Fix PAX regression when handling the size of really long unseekable data streams by carlossanlop · Pull Request #88280 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/System.Formats.Tar/System.Formats.Tar.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Tests", "tests\System.Formats.Tar.Tests.csproj", "{6FD1E284-7B50-4077-B73A-5B31CB0E3577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Manual.Tests", "tests\Manual\System.Formats.Tar.Manual.Tests.csproj", "{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69}"
Expand DownExpand Up@@ -67,6 +69,10 @@ Global
{A00011A0-E609-4A49-B893-EBFC72C98707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.Build.0 = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All@@ -78,9 +84,12 @@ Global
{E0B882C6-2082-45F2-806E-568461A61975} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{9F751C2B-56DD-4604-A3F3-568627F8C006} = {55A8C7E4-925C-4F21-B68B-CEFC19137A4B}
{6FD1E284-7B50-4077-B73A-5B31CB0E3577} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{50E6D5FD-0E06-4D07-966E-C28E5448A1D3} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9B8DA67-C83B-466D-907C-9541CDBDCFEF}
Expand Down

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -283,8 +283,12 @@ private void WriteEntryInternal(TarEntry entry)

switch (entry.Format)
{
case TarEntryFormat.V7 or TarEntryFormat.Ustar:
entry._header.WriteAs(entry.Format, _archiveStream, buffer);
case TarEntryFormat.V7:
entry._header.WriteAsV7(_archiveStream, buffer);
break;

case TarEntryFormat.Ustar:
entry._header.WriteAsUstar(_archiveStream, buffer);
break;

case TarEntryFormat.Pax:
Expand DownExpand Up@@ -321,7 +325,8 @@ private async Task WriteEntryAsyncInternal(TarEntry entry, CancellationToken can

Task task = entry.Format switch
{
TarEntryFormat.V7 or TarEntryFormat.Ustar => entry._header.WriteAsAsync(entry.Format, _archiveStream, buffer, cancellationToken),
TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
Expand Down
93 changes: 93 additions & 0 deletions src/libraries/System.Formats.Tar/tests/Manual/ManualTests.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTests : TarTestsBase
{
public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS"));

public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryData()
{
foreach (bool unseekableStream in new[] { false, true })
{
foreach (TarEntryFormat entryFormat in new[] { TarEntryFormat.V7, TarEntryFormat.Ustar, TarEntryFormat.Gnu, TarEntryFormat.Pax })
{
yield return new object[] { entryFormat, LegacyMaxFileSize, unseekableStream };
}

// Pax supports unlimited size files.
yield return new object[] { TarEntryFormat.Pax, LegacyMaxFileSize + 1, unseekableStream };
}
}

[ConditionalTheory(nameof(ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryData))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public void WriteEntry_LongFileSize(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
writer.WriteEntry(writeEntry);
}

tarFile.Position = 0;

// Read archive back.
using TarReader reader = new TarReader(s);
TarEntry entry = reader.GetNextEntry();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlySpan<byte> dummyData = SimulatedDataStream.DummyData.Span;

// Read the first bytes.
Span<byte> buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Span<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = dataStream.Read(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(reader.GetNextEntry());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTestsAsync : TarTestsBase
{
public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryDataAsync()
// Fixes error xUnit1015: MemberData needs to be in the same class
=> ManualTests.WriteEntry_LongFileSize_TheoryData();

[ConditionalTheory(nameof(ManualTests.ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryDataAsync))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public async Task WriteEntry_LongFileSizeAsync(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
await using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

await using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
await writer.WriteEntryAsync(writeEntry);
}

tarFile.Position = 0;

// Read the archive back.
await using TarReader reader = new TarReader(s);
TarEntry entry = await reader.GetNextEntryAsync();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlyMemory<byte> dummyData = SimulatedDataStream.DummyData;

// Read the first bytes.
byte[] buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.AsSpan().Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Memory<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = await dataStream.ReadAsync(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(await reader.GetNextEntryAsync());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<ItemGroup>
<Compile Include="ManualTests.cs" />
<Compile Include="ManualTestsAsync.cs" />
<Compile Include="..\TarTestsBase.cs" />
<Compile Include="..\SimulatedDataStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
<Compile Include="$(CommonTestPath)System\IO\TempDirectory.cs" Link="Common\System\IO\TempDirectory.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
</ItemGroup>
</Project>
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,8 @@
<Compile Include="TarTestsBase.Ustar.cs" />
<Compile Include="TarTestsBase.V7.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.File.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Base.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Ustar.Tests.cs" />
Expand All@@ -74,7 +72,6 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\ReparsePointUtilities.cs" Link="Common\System\IO\ReparsePointUtilities.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
<!-- Windows specific files -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
Expand Down

This file was deleted.

Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Tar: Fix PAX regression when handling the size of really long unseekable data streams by carlossanlop · Pull Request #88280 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/System.Formats.Tar/System.Formats.Tar.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Tests", "tests\System.Formats.Tar.Tests.csproj", "{6FD1E284-7B50-4077-B73A-5B31CB0E3577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Manual.Tests", "tests\Manual\System.Formats.Tar.Manual.Tests.csproj", "{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69}"
Expand DownExpand Up@@ -67,6 +69,10 @@ Global
{A00011A0-E609-4A49-B893-EBFC72C98707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.Build.0 = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All@@ -78,9 +84,12 @@ Global
{E0B882C6-2082-45F2-806E-568461A61975} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{9F751C2B-56DD-4604-A3F3-568627F8C006} = {55A8C7E4-925C-4F21-B68B-CEFC19137A4B}
{6FD1E284-7B50-4077-B73A-5B31CB0E3577} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{50E6D5FD-0E06-4D07-966E-C28E5448A1D3} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9B8DA67-C83B-466D-907C-9541CDBDCFEF}
Expand Down

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -283,8 +283,12 @@ private void WriteEntryInternal(TarEntry entry)

switch (entry.Format)
{
case TarEntryFormat.V7 or TarEntryFormat.Ustar:
entry._header.WriteAs(entry.Format, _archiveStream, buffer);
case TarEntryFormat.V7:
entry._header.WriteAsV7(_archiveStream, buffer);
break;

case TarEntryFormat.Ustar:
entry._header.WriteAsUstar(_archiveStream, buffer);
break;

case TarEntryFormat.Pax:
Expand DownExpand Up@@ -321,7 +325,8 @@ private async Task WriteEntryAsyncInternal(TarEntry entry, CancellationToken can

Task task = entry.Format switch
{
TarEntryFormat.V7 or TarEntryFormat.Ustar => entry._header.WriteAsAsync(entry.Format, _archiveStream, buffer, cancellationToken),
TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
Expand Down
93 changes: 93 additions & 0 deletions src/libraries/System.Formats.Tar/tests/Manual/ManualTests.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTests : TarTestsBase
{
public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS"));

public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryData()
{
foreach (bool unseekableStream in new[] { false, true })
{
foreach (TarEntryFormat entryFormat in new[] { TarEntryFormat.V7, TarEntryFormat.Ustar, TarEntryFormat.Gnu, TarEntryFormat.Pax })
{
yield return new object[] { entryFormat, LegacyMaxFileSize, unseekableStream };
}

// Pax supports unlimited size files.
yield return new object[] { TarEntryFormat.Pax, LegacyMaxFileSize + 1, unseekableStream };
}
}

[ConditionalTheory(nameof(ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryData))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public void WriteEntry_LongFileSize(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
writer.WriteEntry(writeEntry);
}

tarFile.Position = 0;

// Read archive back.
using TarReader reader = new TarReader(s);
TarEntry entry = reader.GetNextEntry();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlySpan<byte> dummyData = SimulatedDataStream.DummyData.Span;

// Read the first bytes.
Span<byte> buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Span<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = dataStream.Read(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(reader.GetNextEntry());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTestsAsync : TarTestsBase
{
public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryDataAsync()
// Fixes error xUnit1015: MemberData needs to be in the same class
=> ManualTests.WriteEntry_LongFileSize_TheoryData();

[ConditionalTheory(nameof(ManualTests.ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryDataAsync))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public async Task WriteEntry_LongFileSizeAsync(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
await using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

await using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
await writer.WriteEntryAsync(writeEntry);
}

tarFile.Position = 0;

// Read the archive back.
await using TarReader reader = new TarReader(s);
TarEntry entry = await reader.GetNextEntryAsync();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlyMemory<byte> dummyData = SimulatedDataStream.DummyData;

// Read the first bytes.
byte[] buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.AsSpan().Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Memory<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = await dataStream.ReadAsync(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(await reader.GetNextEntryAsync());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<ItemGroup>
<Compile Include="ManualTests.cs" />
<Compile Include="ManualTestsAsync.cs" />
<Compile Include="..\TarTestsBase.cs" />
<Compile Include="..\SimulatedDataStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
<Compile Include="$(CommonTestPath)System\IO\TempDirectory.cs" Link="Common\System\IO\TempDirectory.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
</ItemGroup>
</Project>
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,8 @@
<Compile Include="TarTestsBase.Ustar.cs" />
<Compile Include="TarTestsBase.V7.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.File.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Base.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Ustar.Tests.cs" />
Expand All@@ -74,7 +72,6 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\ReparsePointUtilities.cs" Link="Common\System\IO\ReparsePointUtilities.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
<!-- Windows specific files -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
Expand Down

This file was deleted.

Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Tar: Fix PAX regression when handling the size of really long unseekable data streams by carlossanlop · Pull Request #88280 · dotnet/runtime · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/libraries/System.Formats.Tar/System.Formats.Tar.sln
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar", "src\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Tests", "tests\System.Formats.Tar.Tests.csproj", "{6FD1E284-7B50-4077-B73A-5B31CB0E3577}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Formats.Tar.Manual.Tests", "tests\Manual\System.Formats.Tar.Manual.Tests.csproj", "{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComInterfaceGenerator", "..\System.Runtime.InteropServices\gen\ComInterfaceGenerator\ComInterfaceGenerator.csproj", "{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibraryImportGenerator", "..\System.Runtime.InteropServices\gen\LibraryImportGenerator\LibraryImportGenerator.csproj", "{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69}"
Expand DownExpand Up@@ -67,6 +69,10 @@ Global
{A00011A0-E609-4A49-B893-EBFC72C98707}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A00011A0-E609-4A49-B893-EBFC72C98707}.Release|Any CPU.Build.0 = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All@@ -78,9 +84,12 @@ Global
{E0B882C6-2082-45F2-806E-568461A61975} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{9F751C2B-56DD-4604-A3F3-568627F8C006} = {55A8C7E4-925C-4F21-B68B-CEFC19137A4B}
{6FD1E284-7B50-4077-B73A-5B31CB0E3577} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
{00477EA4-C3E5-48A9-8CA8-8CCF689E0DB4} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{E89FEF3E-E0B9-41C4-A51C-9759AD1A3B69} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{50E6D5FD-0E06-4D07-966E-C28E5448A1D3} = {0345BAA8-92BC-4499-B550-21AC44910FD2}
{A00011A0-E609-4A49-B893-EBFC72C98707} = {9BE8AFF4-D37B-49AF-AFD3-A15E514AC8AE}
{D2788A26-CDAE-4388-AE4B-A36B0E6DFF9D} = {6CF0D830-3EE9-44B1-B548-EA8750AD7B3E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F9B8DA67-C83B-466D-907C-9541CDBDCFEF}
Expand Down

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -283,8 +283,12 @@ private void WriteEntryInternal(TarEntry entry)

switch (entry.Format)
{
case TarEntryFormat.V7 or TarEntryFormat.Ustar:
entry._header.WriteAs(entry.Format, _archiveStream, buffer);
case TarEntryFormat.V7:
entry._header.WriteAsV7(_archiveStream, buffer);
break;

case TarEntryFormat.Ustar:
entry._header.WriteAsUstar(_archiveStream, buffer);
break;

case TarEntryFormat.Pax:
Expand DownExpand Up@@ -321,7 +325,8 @@ private async Task WriteEntryAsyncInternal(TarEntry entry, CancellationToken can

Task task = entry.Format switch
{
TarEntryFormat.V7 or TarEntryFormat.Ustar => entry._header.WriteAsAsync(entry.Format, _archiveStream, buffer, cancellationToken),
TarEntryFormat.V7 => entry._header.WriteAsV7Async(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Ustar => entry._header.WriteAsUstarAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Pax when entry._header._typeFlag is TarEntryType.GlobalExtendedAttributes => entry._header.WriteAsPaxGlobalExtendedAttributesAsync(_archiveStream, buffer, _nextGlobalExtendedAttributesEntryNumber++, cancellationToken),
TarEntryFormat.Pax => entry._header.WriteAsPaxAsync(_archiveStream, buffer, cancellationToken),
TarEntryFormat.Gnu => entry._header.WriteAsGnuAsync(_archiveStream, buffer, cancellationToken),
Expand Down
93 changes: 93 additions & 0 deletions src/libraries/System.Formats.Tar/tests/Manual/ManualTests.cs
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTests : TarTestsBase
{
public static bool ManualTestsEnabled => !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MANUAL_TESTS"));

public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryData()
{
foreach (bool unseekableStream in new[] { false, true })
{
foreach (TarEntryFormat entryFormat in new[] { TarEntryFormat.V7, TarEntryFormat.Ustar, TarEntryFormat.Gnu, TarEntryFormat.Pax })
{
yield return new object[] { entryFormat, LegacyMaxFileSize, unseekableStream };
}

// Pax supports unlimited size files.
yield return new object[] { TarEntryFormat.Pax, LegacyMaxFileSize + 1, unseekableStream };
}
}

[ConditionalTheory(nameof(ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryData))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public void WriteEntry_LongFileSize(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
writer.WriteEntry(writeEntry);
}

tarFile.Position = 0;

// Read archive back.
using TarReader reader = new TarReader(s);
TarEntry entry = reader.GetNextEntry();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlySpan<byte> dummyData = SimulatedDataStream.DummyData.Span;

// Read the first bytes.
Span<byte> buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Span<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = dataStream.Read(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(reader.GetNextEntry());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using Xunit;

namespace System.Formats.Tar.Tests;

[OuterLoop]
[Collection(nameof(DisableParallelization))] // don't create multiple large files at the same time
public class ManualTestsAsync : TarTestsBase
{
public static IEnumerable<object[]> WriteEntry_LongFileSize_TheoryDataAsync()
// Fixes error xUnit1015: MemberData needs to be in the same class
=> ManualTests.WriteEntry_LongFileSize_TheoryData();

[ConditionalTheory(nameof(ManualTests.ManualTestsEnabled))]
[MemberData(nameof(WriteEntry_LongFileSize_TheoryDataAsync))]
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.Android | TestPlatforms.Browser, "Needs too much disk space.")]
public async Task WriteEntry_LongFileSizeAsync(TarEntryFormat entryFormat, long size, bool unseekableStream)
{
// Write archive with a 8 Gb long entry.
await using FileStream tarFile = File.Open(GetTestFilePath(), new FileStreamOptions { Access = FileAccess.ReadWrite, Mode = FileMode.Create, Options = FileOptions.DeleteOnClose });
Stream s = unseekableStream ? new WrappedStream(tarFile, tarFile.CanRead, tarFile.CanWrite, canSeek: false) : tarFile;

await using (TarWriter writer = new(s, leaveOpen: true))
{
TarEntry writeEntry = InvokeTarEntryCreationConstructor(entryFormat, entryFormat is TarEntryFormat.V7 ? TarEntryType.V7RegularFile : TarEntryType.RegularFile, "foo");
writeEntry.DataStream = new SimulatedDataStream(size);
await writer.WriteEntryAsync(writeEntry);
}

tarFile.Position = 0;

// Read the archive back.
await using TarReader reader = new TarReader(s);
TarEntry entry = await reader.GetNextEntryAsync();
Assert.Equal(size, entry.Length);

Stream dataStream = entry.DataStream;
Assert.Equal(size, dataStream.Length);
Assert.Equal(0, dataStream.Position);

ReadOnlyMemory<byte> dummyData = SimulatedDataStream.DummyData;

// Read the first bytes.
byte[] buffer = new byte[dummyData.Length];
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(0, dataStream.ReadByte()); // check next byte is correct.
buffer.AsSpan().Clear();

// Read the last bytes.
long dummyDataOffset = size - dummyData.Length - 1;
if (dataStream.CanSeek)
{
Assert.False(unseekableStream);
dataStream.Seek(dummyDataOffset, SeekOrigin.Begin);
}
else
{
Assert.True(unseekableStream);
Memory<byte> seekBuffer = new byte[4_096];

while (dataStream.Position < dummyDataOffset)
{
int bufSize = (int)Math.Min(seekBuffer.Length, dummyDataOffset - dataStream.Position);
int res = await dataStream.ReadAsync(seekBuffer.Slice(0, bufSize));
Assert.True(res > 0, "Unseekable stream finished before expected - Something went very wrong");
}
}

Assert.Equal(0, dataStream.ReadByte()); // check previous byte is correct.
Assert.Equal(buffer.Length, dataStream.Read(buffer));
AssertExtensions.SequenceEqual(dummyData.Span, buffer);
Assert.Equal(size, dataStream.Position);

Assert.Null(await reader.GetNextEntryAsync());
}
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(NetCoreAppCurrent)</TargetFramework>
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
</PropertyGroup>
<ItemGroup>
<Compile Include="ManualTests.cs" />
<Compile Include="ManualTestsAsync.cs" />
<Compile Include="..\TarTestsBase.cs" />
<Compile Include="..\SimulatedDataStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
<Compile Include="$(CommonTestPath)System\IO\TempDirectory.cs" Link="Common\System\IO\TempDirectory.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
</ItemGroup>
</Project>
Original file line numberDiff line numberDiff line change
Expand Up@@ -53,10 +53,8 @@
<Compile Include="TarTestsBase.Ustar.cs" />
<Compile Include="TarTestsBase.V7.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.File.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntry.Base.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.LongFile.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Roundtrip.Tests.cs" />
<Compile Include="TarWriter\TarWriter.WriteEntryAsync.Entry.Ustar.Tests.cs" />
Expand All@@ -74,7 +72,6 @@
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs" Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\ReparsePointUtilities.cs" Link="Common\System\IO\ReparsePointUtilities.cs" />
<Compile Include="$(CommonTestPath)System\IO\WrappedStream.cs" Link="Common\System\IO\WrappedStream.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
<!-- Windows specific files -->
<ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
Expand Down

This file was deleted.

Loading