summaryrefslogtreecommitdiff
path: root/morphlib/fsutils_tests.py
Commit message (Collapse)AuthorAgeFilesLines
* Make invert_paths work more reliably for writable-allRichard Maw2014-11-121-5/+20
|
* rootfs-protection: Fix building with tempdir=/tmpRichard Maw2013-08-281-0/+25
| | | | | | | | | | | | | | | | | | The issue is that the tempdir is added at the end of the list of directories to keep writable, and entries earlier in the list are subdirectories of tempdir. The check encountered the subdirs first, so decided it must recurse and make everything else read-only. It never got as far as noticing that /tmp was requested writable. Now, every path is checked for being equal, then checked for being a subdirectory. This changed style to use any and generator expressions, as it was more concise than having an explicit loop for checking equality, then an explicit loop for checking subdirectory.
* fsutils: add invert_paths functionRichard Maw2013-08-151-0/+74
This will list all the paths generated by the walker generator function that aren't in the specified set. It removes directories from those returned by the walker, since with os.walk(topdown=True) this culls the search space. In the set of provided paths and the set of returned paths, if a directory is given, then its contents are virtually part of the set. This oddly specific behaviour is because invert_paths is to be used with linux-user-chroot to mark subtrees as read-only, when it only has a set of paths it wants to keep writable. It takes a walker, rather than being given a path and using os.walk, so that it is a pure function, so is easier to unit test.