GNOME Bugzilla – Bug 105669
saving file to a full partition results in unsaved file but no error message
Last modified: 2018-06-29 20:28:02 UTC
Saving when the partition on which the file is is full - does not save the file - yet does not show any error or warning message.
*** Bug 115205 has been marked as a duplicate of this bug. ***
*** Bug 126269 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of 110606 ***
JohnFlux reported on IRC that this still happened in 2.0. He thinks there was a dialog error, but the file was blanked out.
(In reply to comment #4) > JohnFlux reported on IRC that this still happened in 2.0. He thinks there was > a dialog error, but the file was blanked out. > I had the same problem. I don't recall any dialog error, but I ended up with an empty file (had to recover from backups!)
*** Bug 396683 has been marked as a duplicate of this bug. ***
still a problem?
(In reply to comment #7) > still a problem? Yes, I think so.
Created attachment 118586 [details] [review] First sketch of a patch A first version of a possible solution to this. It adds checks after each write operation, so that a full disk is not only detected but also further writes minimized. Please note that this patch has been produced rather quickly and survived only two tests. It really needs a severe review and testing.
*** Bug 503084 has been marked as a duplicate of this bug. ***
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/294302
Andreas Köhler : I applied your patches to gnucash 2.2.6 source code and I was still able to reproduce the bug. I also have to mention that when reproducing the bug, the gnucash file content is completely blanked out. Gnucash shows no error message while saving, but it fails to load the file when you restart it because the file is now completely empty (0 byte). Easy steps to reproduce : 1. Save a copy of your gnucash file on a small partition (USB key?). 2. Open your gnucash file with gnucash. 3. While gnucash is open, open a terminal on the same folder where the gnucash file is stored, and launch this to take all available space left : dd if=/dev/zero of=file 4. Go back to gnucash, change something in your accounts, and click on the floppy disk icon to save. Result : The gnucash account file is now empty, gnucash didn't show any error message and you won't be able to recover anything if you close gnucash.
I cannot reproduce that with none of trunk or 2.2.6 with my patch applied, whether (1) opening file, filling all space left (2) filling all space left, opening file (3) filling enough space for a second file save to fail There is always a warning shown, either that the backup file could not be created or the file not written. The original file is never touched. I tried with compression on and off.
I just tried with 2.2.7 as well with your patch from comment #9 applied (and all hunks applied correctly before a I built gnucash) and I'm still able to reproduce the bug. The only thing that seems different when I compare to your steps is that you fill all space before opening gnucash. In my case, gnucash opens while there is still available space, I fill the partition *after* launching gnucash. However, I just tried to fill the partition *before* opening gnucash, and the bug still appears. Here's a screencast that definitively demonstrate that the bug is still reproducible and all the steps that I described. http://upload.leservicetechnique.com/bugs/gnucash_nospace_data_corruption.ogv
Hm, I see your screencast and I could provide my own as well, showing you that the patch works fine for me. Previously, I loopback-mounted a small xfs file system from a file, now I used my fat32 formatted USB stick, preparing it with an 800 MB file. I do not really understand why we are seeing different results... BTW, with (1) in comment 13 I meant that I first opened the file (either by loading on start or loading after start) and then used the dd command the same way you did. The data file I used is 2 MB of size. I am sorry, but are you sure that the version you are running is still patched, maybe some pbuilder magic is playing tricks on us :-)
Mmh, I thought that the screencast might have been a starting point to see what is the difference between our steps to reproduce. Can the partition size have an impact on this bug? The hypothesis that I don't use a patched gnucash sounds impossible here because I did take care to apply the patch directly to the source tarball, so pbuilder wouldn't be able to reverse this in any way. I also removed current intalled gnucash and then installed my patched one, and gnucash clearly shows that it has been built today when starting. Of course, I might be wrong :-) , but I'm still pretty convinced that I did it well there. Don't hesitate to ask me more testing.
Hm, honestly, I am not sure what to ask :-) May you retest the following: Create a 20mb file from /dev/zero, create an xfs on it, loop-back mount it, repeat the steps depicted? That should really equal what i have done! Maybe someone from the cc list can give us more insight here.
Andreas Köhler : I might have found where the bug still happens and where it is fixed! I created a 20Mb file, formatted as xfs and loop-mounted. Inside of this loop-mounted partition, I put my gnucash file size: 341953, I open gnucash, I take all available space with dd if=/dev/zero of=./file and I try to save with gnucash. I noticed that with xfs, there is always 20kb of space left even after filling the partition. Now I got a different result compared to the last time. gnucash now takes about 3 minutes to save the file instead of 2 seconds. No error message appears, and the gnucash file is finally destroyed (0 or 30 Kbytes) at the end of the ~3 minutes. It prints this in terminal : Error: xaccOpenLog(): cannot open journal 28 No space left on device However, here's the interesting part : All of this has been tested on a 20 Mb partition where I only put a single gnucash file (there is no .log or .xac files). If I open gnucash, save and close, one .log file appears. Then at this point, if I fill the partition, open gnucash and click on "save", the bug doesn't happen! Gnucash shows a error and refuses to save and let me choose where to save the gnucash file. So far, in my case, the bug can still be reproduced unless there is a .log file in the same directory then the main gnucash file. I hope it helps, thanks for working on this!
So far, in my case, the bug can still be reproduced unless there is a .log file in the same directory *than* the main gnucash file.
I haven't checked in the Linux version, but in the windows version (up to the last one, 2.2.8), I have the same problem... I use a Truecrypt partition file of 2Mb just for the Gnucash files, which I carry around on my cell phone, so I can copy this partition file in my home laptop or my office PC. Whenever the partition file is full, the next save seems to be ok but it is corrupted and blanked to zero most of the times. This really bothers me, because I only realize it when I open GnuCash again and usually I don't remember all my last transactions. Please fix it ASAP. Regards
Changed to "XML Backend"
Just in case I need the instructions for creating a small partition again: # Create directory for mount point mkdir tmpmnt # Create 20MB file (cannot be smaller) dd if=/dev/zero of=./file bs=1M count=20 # Format this as XFS file system sudo mkfs -t xfs ./file # Mount this as loopback filesystem sudo mount -o loop ./file tmpmnt
I have committed the attachment as r18593 to ease testing. @Beto: May you please test on Windows from a nightly build (http://code.gnucash.org/builds/win32/trunk/) that includes that change? I still cannot reproduce the bug, Saïvann :( Christian described in comment 22 how to set up an empty loop-back mounted xfs file system. May you continue in the same manner how to to reproduce the bug? I mean, whenever you do something (open gnucash, change something in the register, save), give us the output of ls -li and whether gnucash printed anything to the terminal you started it from. Please use the current trunk (2.3.8+). Regarding the log files, GnuCash always creates those files whenever I open a file, so there is one. Maybe it should always be non-empty (it is not), but the existence of log files does not seem to influence GnuCash's behavior here wrt saving files. Let us trash this bug this time.
I'm sorry to confirm again that latest trunk still react exactly the same as I described in my previous comment, I tested build r18596. I followed exactly the steps of christian Stimming to create the loop-mounted partition. Gnucash fails and bring its own file to 0Kb with these steps : # Create directory for mount point mkdir tmpmnt # Create 20MB file (cannot be smaller) dd if=/dev/zero of=./file bs=1M count=20 # Format this as XFS file system sudo mkfs -t xfs ./file # Mount this as loopback filesystem sudo mount -o loop ./file tmpmnt # Copy a existing gnucash file it the tmpmnt directory (mine is 547kb) # Open that file with gnucash # Fill the partition with a big file dd if=/dev/zero of=./tmpmnt/file # Click the floppy disk icon to save in gnucash. However, as said previously, if you close gnucash, and reopen it before you fill the partition, it won't hit the bug and it will show a message to say that it's not possible to save the file. Gnucash successfully prevent the bug with these steps : # Create directory for mount point mkdir tmpmnt # Create 20MB file (cannot be smaller) dd if=/dev/zero of=./file bs=1M count=20 # Format this as XFS file system sudo mkfs -t xfs ./file # Mount this as loopback filesystem sudo mount -o loop ./file tmpmnt # Copy a existing gnucash file it the tmpmnt directory (mine is 547kb) # Open that file with gnucash # Click the floppy disk icon to save in gnucash. # Close gnucash. # Open gnucash (with the same file). # Fill the partition with a big file dd if=/dev/zero of=./tmpmnt/file # Click the floppy disk icon to save in gnucash.
If forgot to mention that all I get in terminal when reproducing the bug with --debug is this : Ceci est une version de développement. Elle peut ne pas fonctionner correctement. Rapporter les anomalies ou tout autre problème à gnucash-devel@gnucash.org. Vous pouvez consulter ou transmettre des rapports d'anomalie sur http://bugzilla.gnome.org La dernière version stable était GnuCash 2.2.9 La prochaine version stable sera GnuCash 2.4
Thanks for retrying :) (1) You do not need to change something to save the file, i.e. after opening it it is already dirty? Can you provide such a test file, maybe by adding non-basic stuff to an empty file. If not, you might want to send it to me privately, encrypted with gpg. (2) What about ls -li between those steps?
1- The file I used contains all my account. You're right, I have to change something, otherwise the "Save" button is greyed out. So far, adding or deleting a transaction in any account is enough to let me click on "Save", and the bug does not seem to depend on what changes I made in the file with gnucash. I tried to create a new file, with the new account wizard, and to test if the bug was reproducible with it and I reproduced the bug again. Therefore I don't need to send you any file that contains sensitive data, a new gnucash file seems to be enough to reproduce the bug. I attach a gnucash file to the bug report, created today with gnucash wizard. I was able to reproduce the bug with that file. After saving with gnucash, the gnucash file size drop to 0Kb, and after that if I close gnucash and open it again, it complains : "Le type du fichier /media/X/System/local/zxz/tmpmnt/test est inconnu." I also tried to leave a bit more space left than 20kb and the result was surprising, instead of having his size dropped to 0kb, the size dropped from 500kb to 200kb. Therefore it looks like gnucash is writing his log files until there is no space left, after what it starts to eat his own main file to get space for the log files. Ugh, strangely, while I was able to reproduce the bug EACH time, I got just got 4 times without being able to reproduce it.. I'm not 100% sure but I think that I know what makes the difference : Gnucash should not automatically open the file when it starts: 1- It should be opened without any file loaded 2- THEN we should Click on "File / Open.." 3- THEN we should fill the partition 4- then we should add or remove some transaction 5- and finally we should save. It looks like the bug is not reproducible when gnucash automatically open the file when it starts, but I've nothing to confirm that this is totally caracteristic. 2- #Before all operation : total 0 #After coping the gnucash file : total 4 19331 -rw-r--r-- 1 zxz zxz 3243 2010-02-01 04:32 test #After loading it in gnucash (file / open). total 8 19331 -rw-r--r-- 1 zxz zxz 3243 2010-02-01 04:32 test 19346 -rw-r--r-- 1 zxz zxz 192 2010-02-01 04:59 test.20100201045930.log 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.7f0101.10492.LNK 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.LCK #After filling up the partition using dd. total 14572 19347 -rw-r--r-- 1 zxz zxz 14913536 2010-02-01 04:59 file 19331 -rw-r--r-- 1 zxz zxz 3243 2010-02-01 04:32 test 19346 -rw-r--r-- 1 zxz zxz 192 2010-02-01 04:59 test.20100201045930.log 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.7f0101.10492.LNK 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.LCK #After adding a transaction (without saving yet) total 14572 19347 -rw-r--r-- 1 zxz zxz 14913536 2010-02-01 04:59 file 19331 -rw-r--r-- 1 zxz zxz 3243 2010-02-01 04:32 test 19346 -rw-r--r-- 1 zxz zxz 1346 2010-02-01 05:00 test.20100201045930.log 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.7f0101.10492.LNK 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.LCK #After saving in gnucash with the Save button. 19347 -rw-r--r-- 1 zxz zxz 14913536 2010-02-01 04:59 file 19351 -rw-r--r-- 1 zxz zxz 0 2010-02-01 05:00 test 19346 -rw-r--r-- 1 zxz zxz 1346 2010-02-01 05:00 test.20100201045930.log 19331 -rw-r--r-- 1 zxz zxz 3243 2010-02-01 04:32 test.20100201050036.xac 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.7f0101.10492.LNK 19337 ---------- 2 zxz zxz 0 2010-02-01 04:59 test.LCK
Created attachment 152715 [details] Brand new gnucash main file, for testing
Thanks, Saïvann, I finally could reproduce the/a bug, but I needed to turn on file compression. r18598 should improve the zlib error handling. Does it help?
... Great! I don't know if there are others situations where this bug can happens, but in my case, even with many tries with different steps, I was not able to reproduce the bug anymore with r18598. Thanks for your work!!
Nice. What about Windows?
The bug was never reported on windows. Hence, I think it can be closed due the comment #30.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=105669. Please update any external references or bookmarks.