Apache OpenOffice (AOO) Bugzilla – Issue 100542
Failure to save due to over quota causes file to be unlink()ed
Last modified: 2014-02-04 19:28:45 UTC
Steps to reproduce: 1. Open a document. 2. Edit it. 3. Fill the file system or quota so that no new files can be created. 4. Ctrl-S Expected behaviour: An error dialog. Actual behaviour: The original file is unlink()ed. An error dialog. Details: strace shows that it tries to write two files "example0.odt" and "example.odt" in the $profile/user/backup/ directory, and then tries to write "example0.odt" in the same directory as "example.odt". All three open(O_CREAT) calls fails. After that it stats and unlinks "example.odt". It actually does not try to create a new file after unlinking the original file. Expected behaviour 1: Only unlink a file when it is certain that it will at least try to write a new file. Expected behaviour 2: Give up trying to replace a file if no backup files could be created first, and give up _before_ the unlink(). I've reproduced this with a home directory in an ext3 filesystem which is out of inodes (open() => ENOSPC) and also with a home directory in AFS with full quota (open() => EDQUOT). I also tried this with a home directory in a filesystem where there are free inodes but no free blocks. In that case the open(O_CREAT) succeeds but write() fails when creating the backup files. When that happens, the original file is left intact. So in that case the error is dealt with in a meaningful way. This is with openoffice.org-writer-3.0.1-15.3.fc10.x86_64 (Fedora 10). I've also seen the same behaviour in StarSuite 8 on Sparc/Solaris so I doubt it's an issue specific to the Fedora build. (I'm willing to file a bug report at the distro level and/or try to reproduce with a vanilla build if required.)