DiscUtils icon indicating copy to clipboard operation
DiscUtils copied to clipboard

Building SquashFS using AddFile results in corrupted file

Open SuperJMN opened this issue 11 months ago • 5 comments

Repro:

Run this code.

var builder = new DiscUtils.SquashFs.SquashFileSystemBuilder();
var f1 = new MemoryStream(System.Text.Encoding.UTF8.GetBytes("This is file 1."));
var f2 = new MemoryStream(System.Text.Encoding.UTF8.GetBytes("This is file 2."));
builder.AddFile("1.txt", f1);
builder.AddFile("2.txt", f2);
builder.Build("TestDiscUtils.squashfs");

The resulting file cannot be open.

Using DiscUtils.SquashFs version 0.16.13 in Windows 11 x64.

Please, check this issue for more info: https://github.com/DiscUtils/DiscUtils/issues/56

SuperJMN avatar Apr 02 '24 12:04 SuperJMN

I think I found why this happens and made a fix that seems to help, at least for simple tests like this. I am a bit unsure though and it probably needs more testing to verify. https://github.com/LTRData/DiscUtils/commit/cc31cce1b9706ff1a179512223948cd95b8a8bfb

LTRData avatar Apr 05 '24 12:04 LTRData

Wow, nice. I will take a look and see if it works. Thanks for your time, @LTRData !

SuperJMN avatar Apr 08 '24 11:04 SuperJMN

Wow, nice. I will take a look and see if it works. Thanks for your time, @LTRData !

If you want to use it as NuGet packages, my packages are prefixed LTRData. name such as LTRData.DiscUtils.SquashFs. There are some breaking changes compared to this repo, but typically easy to migrate to.

LTRData avatar Apr 08 '24 11:04 LTRData

Wow, nice. I will take a look and see if it works. Thanks for your time, @LTRData !

If you want to use it as NuGet packages, my packages are prefixed LTRData. name such as LTRData.DiscUtils.SquashFs. There are some breaking changes compared to this repo, but typically easy to migrate to.

Thanks for the tip. Very much convient!

By the way, I've added a discussion I think it's worth taking into consideration https://github.com/DiscUtils/DiscUtils/discussions/296.

Just in case you want to consdere something more: It would be awesome if you enabled issues/discussions in your fork, since your work started to differ from this repo, to bring consistency.

SuperJMN avatar Apr 08 '24 17:04 SuperJMN

Thanks for the suggestion! I have enabled issues and discussions there now!

LTRData avatar Apr 08 '24 17:04 LTRData