Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
e9fbcc9
Implement Tar APIs
carlossanlop Apr 13, 2022
0731cb2
Address some comment suggestions.
carlossanlop Apr 13, 2022
8f1f1af
Add SystemFormatsTarTestData package dependency entries and versions.
carlossanlop Apr 13, 2022
10df463
Merge the major and minor p/invokes into a single one.
carlossanlop Apr 14, 2022
da4af67
Address exception and nullability suggestions.
carlossanlop Apr 14, 2022
8710ceb
Adjust tests for the latest suggestions.
carlossanlop Apr 14, 2022
76e484c
Document elevation requirement to extract device files on Unix.
carlossanlop Apr 14, 2022
c9c4d85
Add tests to verify extraction without elevation throws for device fi…
carlossanlop Apr 14, 2022
e0dafda
Add separate expected mode for special files from assets (644).
carlossanlop Apr 14, 2022
5b8392b
Bump assets version to one with the fix
carlossanlop Apr 14, 2022
a16d4d9
Fix bugs and add tests for: timestamp conversion, extended attributes…
carlossanlop Apr 15, 2022
7ca674e
Validate entry.Name chars before extracting
carlossanlop Apr 15, 2022
560b789
Remove some minor todo comments
carlossanlop Apr 15, 2022
b3e5988
Add missing numeric value for PAL_S_IFCHR and its static assert
carlossanlop Apr 15, 2022
c22a8e7
Bug fixes:
carlossanlop Apr 16, 2022
d3e4f31
Bug fix: GNU can have two different metadata entries in a row if the …
carlossanlop Apr 16, 2022
23caa17
Add test to verify entry with subdir segments gets extracted by TarFi…
carlossanlop Apr 16, 2022
e0b0442
Rename UnknownFormat resource string to TarInvalidFormat, include for…
carlossanlop Apr 16, 2022
b682576
Bug fixes:
carlossanlop Apr 17, 2022
9fd01c3
Embed paths to exception message string when extracting file to diffe…
carlossanlop Apr 17, 2022
7b0d8c3
Bug fix: WriteEntry from file on Windows failing with V7 due to incom…
carlossanlop Apr 17, 2022
f1d9b7b
Bug fixes:
carlossanlop Apr 17, 2022
0980fbd
Use HAVE* in pal_io.c to detect library where makedev is available. D…
carlossanlop Apr 18, 2022
a28f3e5
Remove unnecessary TargetPlatformIdentifier override in src csproj.
carlossanlop Apr 18, 2022
7f2e516
Small refactor of VerifyOverwriteFileIsPossible
carlossanlop Apr 18, 2022
3f71b60
Remove parameter nullchecks.
carlossanlop Apr 18, 2022
cb855ed
Remove test method for attaching debugger.
carlossanlop Apr 18, 2022
dd40447
Remove devmajor and devminor duplicate todo message
carlossanlop Apr 18, 2022
9a28f12
Remove unused datetime method
carlossanlop Apr 19, 2022
40097c6
TMP exception with failed timestamp info
carlossanlop Apr 19, 2022
b1e8dfc
Remove failing device major/minor checks for now
carlossanlop Apr 19, 2022
c11e434
add FieldLocations static class, with position of first byte of each …
carlossanlop Apr 19, 2022
255ec96
Use InvariantCulture when converting the utf8 string to a double.
carlossanlop Apr 19, 2022
8ae7788
Copying file used by ExtractToDirectory test that throws, so it doesn…
carlossanlop Apr 19, 2022
d3cbdd2
Remove unused test method that opens and returns a filestream. We don…
carlossanlop Apr 19, 2022
6b5d078
Use a single rented buffer to read a whole header record. Convert rel…
carlossanlop Apr 19, 2022
19eb98d
Use ArrayPool for writing.
carlossanlop Apr 19, 2022
69ca3e7
Fix upper bound of DeviceMajor and DeviceMinor.
carlossanlop Apr 19, 2022
b1a2d5a
Remove async APIs from ref, comment them in src.
carlossanlop Apr 19, 2022
fb644dd
Add issue to TODO comments
carlossanlop Apr 19, 2022
cd40d62
Remove unused methods.
carlossanlop Apr 19, 2022
0ee2c33
Add InvariantCulture to double.ToString conversions.
carlossanlop Apr 19, 2022
58a3476
Fix test parsing a double, ensure it uses invariant culture.
carlossanlop Apr 20, 2022
fc0e568
More tests parsing a double, ensure invariant culture comparison.
carlossanlop Apr 20, 2022
5d81577
Verify link targets when extracting to directory. Disallow extracting…
carlossanlop Apr 20, 2022
a52dfe4
Avoid advancing stream anymore if end markers were found and GetNextE…
carlossanlop Apr 20, 2022
b227fa9
Add test that verifies stream is not advanced anymore after reading t…
carlossanlop Apr 20, 2022
5745b9f
Fix bug preventing correct generation of full path for extraction. Ad…
carlossanlop Apr 21, 2022
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
Prev Previous commit
Next Next commit
Remove async APIs from ref, comment them in src.
  • Loading branch information
carlossanlop committed Apr 19, 2022
commit b1a2d5a6b2e2538ad285de2c4c85c0a5d8d77da0
14 changes: 2 additions & 12 deletions src/libraries/System.Formats.Tar/ref/System.Formats.Tar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ internal TarEntry() { }
public string Name { get { throw null; } set { } }
public int Uid { get { throw null; } set { } }
public void ExtractToFile(string destinationFileName, bool overwrite) { }
public System.Threading.Tasks.Task ExtractToFileAsync(string destinationFileName, bool overwrite, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public override string ToString() { throw null; }
}
public enum TarEntryType : byte
Expand Down Expand Up @@ -68,12 +67,8 @@ public static partial class TarFile
{
public static void CreateFromDirectory(string sourceDirectoryName, System.IO.Stream destination, bool includeBaseDirectory) { }
public static void CreateFromDirectory(string sourceDirectoryName, string destinationFileName, bool includeBaseDirectory) { }
public static System.Threading.Tasks.Task CreateFromDirectoryAsync(string sourceDirectoryName, System.IO.Stream destination, bool includeBaseDirectory, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task CreateFromDirectoryAsync(string sourceDirectoryName, string destinationFileName, bool includeBaseDirectory, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static void ExtractToDirectory(System.IO.Stream source, string destinationDirectoryName, bool overwriteFiles) { }
public static void ExtractToDirectory(string sourceFileName, string destinationDirectoryName, bool overwriteFiles) { }
public static System.Threading.Tasks.Task ExtractToDirectoryAsync(System.IO.Stream source, string destinationDirectoryName, bool overwriteFiles, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task ExtractToDirectoryAsync(string sourceFileName, string destinationDirectoryName, bool overwriteFiles, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
[System.FlagsAttribute]
public enum TarFileMode
Expand All @@ -100,27 +95,22 @@ public enum TarFormat
Pax = 3,
Gnu = 4,
}
public sealed partial class TarReader : System.IAsyncDisposable, System.IDisposable
public sealed partial class TarReader : System.IDisposable
{
public TarReader(System.IO.Stream archiveStream, bool leaveOpen = false) { }
public System.Formats.Tar.TarFormat Format { get { throw null; } }
public System.Collections.Generic.IReadOnlyDictionary<string, string>? GlobalExtendedAttributes { get { throw null; } }
public void Dispose() { }
public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public System.Formats.Tar.TarEntry? GetNextEntry(bool copyData = false) { throw null; }
public System.Threading.Tasks.ValueTask<System.Formats.Tar.TarEntry?> GetNextEntryAsync(bool copyData = false, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public sealed partial class TarWriter : System.IAsyncDisposable, System.IDisposable
public sealed partial class TarWriter : System.IDisposable
{
public TarWriter(System.IO.Stream archiveStream, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>? globalExtendedAttributes = null, bool leaveOpen = false) { }
public TarWriter(System.IO.Stream archiveStream, System.Formats.Tar.TarFormat archiveFormat, bool leaveOpen = false) { }
public System.Formats.Tar.TarFormat Format { get { throw null; } }
public void Dispose() { }
public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
public void WriteEntry(System.Formats.Tar.TarEntry entry) { }
public void WriteEntry(string fileName, string? entryName) { }
public System.Threading.Tasks.Task WriteEntryAsync(System.Formats.Tar.TarEntry entry, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public System.Threading.Tasks.Task WriteEntryAsync(string fileName, string? entryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public sealed partial class UstarTarEntry : System.Formats.Tar.PosixTarEntry
{
Expand Down
50 changes: 24 additions & 26 deletions src/libraries/System.Formats.Tar/src/System/Formats/Tar/TarEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;

namespace System.Formats.Tar
Expand Down Expand Up @@ -235,36 +233,36 @@ public void ExtractToFile(string destinationFileName, bool overwrite)
}
}

/// <summary>
/// Asynchronously extracts the current entry to the filesystem.
/// </summary>
/// <param name="destinationFileName">The path to the destination file.</param>
/// <param name="overwrite"><see langword="true"/> if this method should overwrite any existing filesystem object located in the <paramref name="destinationFileName"/> path; <see langword="false"/> to prevent overwriting.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
/// <returns>A task that represents the asynchronous extraction operation.</returns>
/// <remarks><para>Files of type <see cref="TarEntryType.BlockDevice"/>, <see cref="TarEntryType.CharacterDevice"/> or <see cref="TarEntryType.Fifo"/> can only be extracted in Unix platforms.</para>
/// <para>Elevation is required to extract a <see cref="TarEntryType.BlockDevice"/> or <see cref="TarEntryType.CharacterDevice"/> to disk.</para></remarks>
/// <exception cref="ArgumentException"><paramref name="destinationFileName"/> is <see langword="null"/> or empty.</exception>
/// <exception cref="IOException"><para>The parent directory of <paramref name="destinationFileName"/> does not exist.</para>
/// <para>-or-</para>
/// <para><paramref name="overwrite"/> is <see langword="false"/> and a file already exists in <paramref name="destinationFileName"/>.</para>
/// <para>-or-</para>
/// <para>A directory exists with the same name as <paramref name="destinationFileName"/>.</para>
/// <para>-or-</para>
/// <para>An I/O problem occurred.</para></exception>
/// <exception cref="InvalidOperationException">Attempted to extract an unsupported entry type.</exception>
/// <exception cref="UnauthorizedAccessException">Operation not permitted due to insufficient permissions.</exception>
public Task ExtractToFileAsync(string destinationFileName, bool overwrite, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
}
// /// <summary>
// /// Asynchronously extracts the current entry to the filesystem.
// /// </summary>
// /// <param name="destinationFileName">The path to the destination file.</param>
// /// <param name="overwrite"><see langword="true"/> if this method should overwrite any existing filesystem object located in the <paramref name="destinationFileName"/> path; <see langword="false"/> to prevent overwriting.</param>
// /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
// /// <returns>A task that represents the asynchronous extraction operation.</returns>
// /// <remarks><para>Files of type <see cref="TarEntryType.BlockDevice"/>, <see cref="TarEntryType.CharacterDevice"/> or <see cref="TarEntryType.Fifo"/> can only be extracted in Unix platforms.</para>
// /// <para>Elevation is required to extract a <see cref="TarEntryType.BlockDevice"/> or <see cref="TarEntryType.CharacterDevice"/> to disk.</para></remarks>
// /// <exception cref="ArgumentException"><paramref name="destinationFileName"/> is <see langword="null"/> or empty.</exception>
// /// <exception cref="IOException"><para>The parent directory of <paramref name="destinationFileName"/> does not exist.</para>
// /// <para>-or-</para>
// /// <para><paramref name="overwrite"/> is <see langword="false"/> and a file already exists in <paramref name="destinationFileName"/>.</para>
// /// <para>-or-</para>
// /// <para>A directory exists with the same name as <paramref name="destinationFileName"/>.</para>
// /// <para>-or-</para>
// /// <para>An I/O problem occurred.</para></exception>
// /// <exception cref="InvalidOperationException">Attempted to extract an unsupported entry type.</exception>
// /// <exception cref="UnauthorizedAccessException">Operation not permitted due to insufficient permissions.</exception>
// public Task ExtractToFileAsync(string destinationFileName, bool overwrite, CancellationToken cancellationToken = default)
// {
// throw new NotImplementedException();
// }

/// <summary>
/// The data section of this entry. If the <see cref="EntryType"/> does not support containing data, then returns <see langword="null"/>.
/// </summary>
/// <value><para>Gets a stream that represents the data section of this entry.</para>
/// <para>Sets a new stream that represents the data section, if it makes sense for the <see cref="EntryType"/> to contain data; if a stream already existed, the old stream gets disposed before substituting it with the new stream. Setting a <see langword="null"/> stream is allowed.</para></value>
/// <remarks>If you write data to this data stream, make sure to rewind it to the desired start position before writing this entry into an archive using <see cref="TarWriter.WriteEntry(TarEntry)"/> or <see cref="TarWriter.WriteEntryAsync(TarEntry, CancellationToken)"/>.</remarks>
/// <remarks>If you write data to this data stream, make sure to rewind it to the desired start position before writing this entry into an archive using <see cref="TarWriter.WriteEntry(TarEntry)"/>.</remarks>
/// <exception cref="InvalidOperationException">Setting a data section is not supported because the <see cref="EntryType"/> is not <see cref="TarEntryType.RegularFile"/> (or <see cref="TarEntryType.V7RegularFile"/> for an archive of <see cref="TarFormat.V7"/> format).</exception>
/// <exception cref="IOException"><para>Cannot set an unreadable stream.</para>
/// <para>-or-</para>
Expand Down
Loading