AgentD / squashfs-tools-ng

A new set of tools and libraries for working with SquashFS images
Other
194 stars 30 forks source link

rdsquashfs: unpack does not work for Windows #97

Closed martin-koch closed 2 years ago

martin-koch commented 2 years ago

It seems that the pre-compiled binary package for Windows (https://infraroot.at/pub/squashfs/windows/squashfs-tools-ng-1.1.3-mingw64.zip) has some issues with the rdsquashfs unpack feature. When I create a squashfs from a directory containing two files (file1.txt and file2.txt) by using gensquashfs --pack-dir test test.sfs and try to unpack the content I get the following output:

> rdsquashfs --unpack-path ./ test.sfs
creating file1.txt
creating file2.txt
unpacking file2.txt
file2.txt: Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist.

while file1.txt has no content and file2.txt contains the correct content. If I additionally use the --unpack-root option the windows command promt does not return anymore and the output directory is still empty:

> rdsquashfs --unpack-root out --unpack-path ./ test.sfs
AgentD commented 2 years ago

Hi,

thanks for the feedback! I managed to reproduce and debug the issues you described.

It turns out the first problem is caused by the return value of FlushFileBuffers being checked incorrectly. It should be fixed by commit 6bea0b4f7eabce157a040d6e5811b01fd2ef6a2d. The second issue was caused by a broken loop exit condition in the Windows version of mkdir_p. This should be fixed in b6e554a2061b9dfdb4043600e9e42e362ff22ae3.

To answer some inevitable question: Both those things had been tested at some point. This and other recent issues highlight that the Windows builds really need to finally be integrated into the CI pipeline, and release build test suite. I guess the next minor release will consist mostly of Windows related fixes.

Both of the above commits are on master and the fixes-1.1.0 branch, and are available as separate patch files.

For some quick tests, I also ran the release build script on the current fixes-1.1.0 branch. These binaries contain both fixes and no longer have the issues on my end:

squashfs-tools-ng-1.1.3-mingw64.zip squashfs-tools-ng-1.1.3-mingw64.zip.asc.gz squashfs-tools-ng-1.1.3-mingw32.zip squashfs-tools-ng-1.1.3-mingw32.zip.asc.gz

martin-koch commented 2 years ago

Thanks for the quick fix. Seems to work as expected.