If the machine crashes between seek and write, or if write is large enough to be split into multiple operations, /etc/fstab will be empty or incomplete.
Instead the file should be always updated using the write-new-file/fsync/rename/fsync pattern.
(Depending on which filesystem developer you're talking to, the weather, and the condition of the Sun's corona, you may be recommended different recipes. But the current methodology is certainly flawed.)
The fstab module does this:
```
self.seek( 0)
self.write( ''.join( lines). encode( 'us-ascii' ))
self.truncate( )
class Fstab(io.FileIO):
# [...]
def remove_entry(self, entry):
# [...]
```
If the machine crashes between seek and write, or if write is large enough to be split into multiple operations, /etc/fstab will be empty or incomplete.
Instead the file should be always updated using the write-new- file/fsync/ rename/ fsync pattern.
(Depending on which filesystem developer you're talking to, the weather, and the condition of the Sun's corona, you may be recommended different recipes. But the current methodology is certainly flawed.)