SharpZipLib icon indicating copy to clipboard operation
SharpZipLib copied to clipboard

Symlink creation not possible with `TarArchive.WriteEntry()`.

Open nptr opened this issue 2 years ago • 1 comments

Describe the bug

Creating a symlink with TarArchive.WriteEntry() fails with an ArgumentNullException which i think is unfounded. Reason seems to be, that WriteEntry() expected file data where there should't be any. Creating a directory (where there also isn't data) succeeds because there is a separate code path to handle this case. I would expect that LF_SYMLINK is also exempted.

Reproduction Code

https://dotnetfiddle.net/faKmUo

Steps to reproduce

  1. Open the link to the reproduction at dotnetfiddle.
  2. Run the code.
  3. Observe that SymlinkWithArchiveClass() failed.

Expected behavior

I would expect that SymlinkWithArchiveClass() succeeds, just like the lower level example SymlinkWithStreamClass(), that directly utilized TarOutputStream, does.

Operating System

Windows, macOS, Linux

Framework Version

.NET 7, .NET 6, .NET Framework 4.x

Tags

Tar

Additional context

No response

nptr avatar Oct 16 '23 19:10 nptr

This is more of a feature request, I think. TarArchive does more of the heavy lifting, but at a cost of less flexibility. It shouldn't be much of a problem to skip reading the source if the size is set to 0, though...

piksel avatar Oct 17 '23 08:10 piksel