Skip to content

test_squashfs.py::test_superblock fails unless it's run by root

The data file tests/data/test1.squashfs used in tests/comparators/test_squashfs.py::test_superblock contains a ./null character device that cannot be create by unquashfs unless it is run by root. Recent updates to squashfs-tools made the problem more apparent by causing the test to fail as unquashfs now propagates the inode creation error to its exit status code, previously unquashfs would only report an error message to stderr.

$ unsquashfs -f -no -li -d test diffoscope-121/tests/data/test1.squashfs
Parallel unsquashfs: Using 4 processors
3 inodes (3 blocks) to write

drwxr-xr-x nobody/nobody            51 2015-06-24 11:47 test
lrwxrwxrwx nobody/nobody             6 2015-06-24 11:47 test/link -> broken
crw-r--r-- root/root             1,  3 2015-06-24 11:47 test/null
create_inode: could not create character device test/null, because you're not superuser!
-rw-r--r-- nobody/nobody           446 2015-06-24 11:49 test/text

created 1 files
created 1 directories
created 1 symlinks
created 0 devices
created 0 fifos

On a newer squashfs-tools tests/comparators/test_squashfs.py::test_superblock fails due to an exit 1. Previously unsquashfs would exit 0 even on some errors, but this new release changed unsquash's error propagation so it will now exit 1.

As a suggestion, the test should be updated to:

  • only run when running as root
  • run unsquashfs using fakeroot
  • use a squashfs data that does not contain a character device
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information