iter_files() should not descend into "lost+found" on ext4/ext3/ext2
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
FileStore |
Fix Released
|
High
|
Jason Gerard DeRose |
Bug Description
A lot of work as been put into making sure our import process will either import every single file on a card, or fail loudly if any problem occurs. We don't want any gray area because we ultimately want to automatically format the cards upon completing the import (assuming the files were stored on 2 different hard drives as they were imported).
Turns out the `os.walk()` function is a dangerous little beast in this setting... never use it for dmedia or filestore!
On the other hand, our `iter_files()` function is very strict and explicit because we never want a permission error to be interpreted as there being no files inside a directory.
But one problem is that if you want to import files from an ext4/ext3/ext2 partition, `iter_files()` currently bombs out when it tries to descend into the "lost+found" directory.
So when we have a "lost+found" directory, we wont descend into it assuming all these conditions are met:
1. path.ismount(
2. "lost+found" is owned by the root user
3. "lost+found" has 0700 permissions (is this always the case for ext2/ext3/ext4?)
Otherwise we descend into it, even if named "lost+found", even if it causes an exception to be raised.
Note that we want this to *always* raise an exception:
iter_
But we don't want this to raise an exception when "MyFiles" is an ext2/ext3/ext4 partition:
iter_
Subtle but important difference.
Related branches
- dmedia Dev: Pending requested
-
Diff: 22 lines (+5/-0)1 file modifiedfilestore.py (+5/-0)
Changed in filestore: | |
status: | Triaged → In Progress |
assignee: | nobody → Jason Gerard DeRose (jderose) |
Changed in filestore: | |
status: | In Progress → Fix Committed |
Changed in filestore: | |
status: | Fix Committed → Fix Released |