AgentD / squashfs-tools-ng

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

tar2sqfs fails receiving piped tar #102

Closed ogregpt closed 2 years ago

ogregpt commented 2 years ago

Using https://infraroot.at/pub/squashfs/windows/squashfs-tools-ng-1.1.3-mingw64.zip:

Works: ? tar2sqfs <home.tar -qf -c gzip home.sqfs

Doesn't work (error occurs at what seems to be the end of the pipe stream):

? cat home.tar | tar2sqfs -qf -c gzip home.sqfs
stdin: The pipe has been ended.

I used to pipe from nc without problems in a previous (very old) version.

EDIT: Problem occurs on 1.1.0 and 1.1.3 - no problem on 1.0.6 (same release date as 1.1.3)

AgentD commented 2 years ago

The tar2sqfs problem should be fixed with 4e1d9aef948092778ff0559ee8a94d4365dab9cf. Both have been tested successfully on a Windows 7 VM, redirecting a file and piping from program output. This was caused by the stream I/O abstraction layer, not handling ERROR_BROKEN_PIPE correctly. On Windows, this is issued when reading, unlike Unix, where it only occurs when writing; The problem did thus also not occur when testing with Wine.

I closed #100 in favor of this, as I guess the tickets were related. With a similar patch, the sqfs2tar program is able to create a tarball in my Windows VM, but errors out during internal cleanup at the end.

AgentD commented 2 years ago

The problem in sqfs2tar turned out to be a heap corruption issue related to a size miscalculation in the Windows port of the output stream. It now has been successfully tested in a Windows 7 VM as well as wine.