Introduces a -t[est] option for unsquashfs utility, which prevents creation of anything, anywhere, and redirects data writes to /dev/null. This makes it return an error code if something goes wrong, or null if the filesystem uncompresses fine, essentially acting like fsck. It's similar approach to what is used in cramfsck.
While this method may be a bit hacky, it's generic enough to span all fs versions and is probably easilly backportable.
I would like to see this feature too. Right now i am using nullfs (https://github.com/xrgtn/nullfs) to redirect all writes.
By the way: if i corrupt a squashfs-file by executing "dd if=/dev/urandom of=/path/to/squashfs bs=1024 seek=$RANDOM count=1 conv=notrunc" i will get an error message for every file that couldnt be extracted, but the return code of unsquashfs is still zero. this is not the expected behaviour. I am using Ubuntu 14.04 with the packaged version of squashfs-tools.
Last edit: ladiko 2015-02-03