icsharpcode / SharpZipLib

#ziplib is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform.
http://icsharpcode.github.io/SharpZipLib/
MIT License
3.7k stars 976 forks source link

It's not possible to tar files starting with "system" in the file name. #859

Open mrconter1 opened 7 months ago

mrconter1 commented 7 months ago

Describe the bug

I am trying to tar a folder that contains a file that is called "system.xml". It doesn't work. If I however change the name of the file to "ssystem.xml" it works. But if I choose the name "system2.xml" or "system.txt" it doesn't work. So in other words, when I try to create an archive of files and one of the files starts with "system" it isn't added to the archive. Here is my code:

        static Task<string> CompressLocalTest()
        {
            return Task.Run(() =>
            {
                string sourcePath = @"C:\Users\bla\Documents\Backup";
                string destPath = @"C:\Users\bla\Documents\ssss\dd\fck.tar";

                using (var outStream = File.Create(destPath))
                {
                    var tarArchive = TarArchive.CreateOutputTarArchive(outStream);
                    AddDirectoryFilesToTar(tarArchive, sourcePath, true);
                }

                return destPath;
            });
        }

        public static void AddDirectoryFilesToTar(TarArchive tarArchive, string sourceDirectory, bool recurse)
        {
            TarEntry tarEntry = TarEntry.CreateEntryFromFile(sourceDirectory);
            tarArchive.WriteEntry(tarEntry, recurse);
        }

Reproduction Code

No response

Steps to reproduce

  1. Make a folder that contains a file that has a name that starts with "system"
  2. Try to make a tar archive using the SharpZipLib code.

Expected behavior

It should add the system.xml file like any other file. When I for instance tar with 7zip it works.

Operating System

Windows

Framework Version

.NET Framework 4.x

Tags

Tar

Additional context

I am using SharpZipLib 1.4.2.