Bug 396285 - When opening a mymoney file from smb:// share saving fails and destroys all data to 0Bytes!
Summary: When opening a mymoney file from smb:// share saving fails and destroys all d...
Status: RESOLVED DUPLICATE of bug 344146
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.0.0
Platform: Mint (Ubuntu based) Linux
: NOR grave
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-07 19:08 UTC by kde@solis3.org
Modified: 2018-07-13 19:09 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde@solis3.org 2018-07-07 19:08:48 UTC
Using Nemo, mount a share (note this has always worked with < 5.0). I dont know but I assume any linux base with smb:// mounted from file manager.

smb://share/folder etc.
Double click a money file and KMyMoney 5 opens as expected.
Change something to enable saving (without a change you cant click save).
Click save.
There is an error about cant write to share.
But it did write.. and destroyed all the data.

Before

smb://bigstation.office.lan/house/money
File finance.kmy

After save and error.
Unable to write changes to '/run/user/1000/gvfs/smb-share:server=bigstation.office.lan,share=house/money/finance.kmy'

After this the folder now contains.

finance.kmy 0 bytes
finance.kmy.1~ 0 bytes

All data is gone, file is destroyed.
Comment 1 kde@solis3.org 2018-07-07 19:21:47 UTC
Platform details.

Mint 19 (based on Ubuntu 18.04)
KMyMoney 5.0.0
Nemo 3.8.4
Cinnamon 3.8.7
Kernel 4.15.0-24-generic

As this is a standard Mint 19 based on 18.04, I assume this is also the case on Ubuntu 18.04 based systems and not specifically Mint.

I do not have other installs so I cannot confirm if this is the same on KDE or GNOME.
Comment 2 Jack 2018-07-07 19:33:05 UTC
Also please provide some more information about the file server - distro and version of samba or whatever is actually providing the file share, as well as the client's version of Samba (my assumption as to what is used to access the smb share.)

Have you used any other programs which update/save files to that share such as emacs and/or libreoffice.  I suspect KMM is just doing a normal save, and reporting the error, but it is some issue with the underlying file sharing that is deleting the old file before actually saving the new one.

Also look carefully at any permission related settings that might see some difference or conflict between the file share and your local machine.
Comment 3 Ralf Habacker 2018-07-08 08:15:20 UTC
This may be the same issue as 396208
Comment 4 kde@solis3.org 2018-07-08 09:58:02 UTC
Ok, the plot thickens... 

But dont write this off just yet because KMyMoney < 5 on Mint 18.3 works fine with the same remote share.  

KMyMoney 5 does create a lot of files .1~ .2~ etc on save. In fact it creates 3 such files when saving the file only once. This seems Odd.

In addition, those files ARE created on the failing remote, its just they all become zero length. So permissions seems unlikely (as the files could not be created at all). Compatibility with a new save mechanism or naming seems likely. The original file and the created .1~ etc all are zero length after a save (with the error). 

Either, this is a Mint 19 (Ubuntu 1804) issue with mounted shares or MyMoney5 with a specific samba.

So lets do some tests.

Remote A, Synology Diskstation DS1817+ running latest DSM 6.2-23739 (the problem remote)
Remote B, Mint 18.3 (Ubuntu 16.04) with Samba 2:4.3.11+dfsg 0ubuntu0.16.04.13
Mint A (18.3) standard install with KMyMoney 4.6.6
Mint B (19.0) standard install with KMyMoney 5.

Test 1.  Mint A saving to Remote A. OK
Test 2.  Mint B saving to Remote A. NOK, error and all files become zero length.
Test 3.  Mint B saving to Remote B. OK.
Test 4.  Mint B (running Kymoney 4) to Remote A. How to test???

Test 4 seems to be the critical test since it will prove its KMyMoney 5 and not a Mint 19 issue. However I do not have KMyMoney 4 on this machine.  I will investigate and report.

So, this is a compatibility issue with Synology, however lets not get all excited and blame Synology right now since the old KMyMoney works.

I think something has changed in the way KMyMoney 5 saves and this is causing the issue with Synolgoy.  It does create a lot of files and truncating to zero length is a little clue perhaps.
Comment 5 kde@solis3.org 2018-07-08 10:04:08 UTC
For non MyMoney tests.

In Mint 19 I create a file using Nano on the Remote A with the same mount process.  It is OK. So user/mount permissions are OK on Mint side.
Open the file and edit the contents. Also OK.
Save the file. Also OK.

I am not sure how Nano opens shares with smb:// protocols, so I include all the install info I have as cifs and samba are not related as such.

cifs-utils 2:6.8-1 amd64 Common Internet File System utilities
samba-common 2:4.7.6+dfsg~ubuntu-0ubuntu2 all common files used by both the Samba server and client
samba-common-bin 2:4.7.6+dfsg~ubuntu-0ubuntu2 amd64 Samba common files used by both the server and the client
samba-libs:amd64 2:4.7.6+dfsg~ubuntu-0ubuntu2 amd64 Samba core libraries
Comment 6 kde@solis3.org 2018-07-08 10:17:18 UTC
Running kmymoney 5 from the shell, there are no error messages displayed or any hints as to something wrong.

kmymoney  --enable-debug /run/user/1000/gvfs/smb-share:server=bigstation.office.lan,share=hause/money/finance.kmy

qt5ct: using qt5ct plugin
WebConnect: Try to connect to WebConnect server
WebConnect: Connect to server failed
WebConnect: Running in server mode
qt5ct: D-Bus global menu: no
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/16/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/16@2x/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/16/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/16@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/22/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/22@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/24/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/24@2x/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/24/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/24@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/32/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/32@2x/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/32/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/32@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/48/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/48@2x/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/48/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/48@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/64/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/64@2x/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/64/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/64@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/96/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/96@2x/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/128/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/128@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/256/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/256@2x/"
Invalid Context= "Apps" line for icon theme:  "/usr/share/icons/Mint-Y/apps/symbolic/"
Invalid Context= "Mimetypes" line for icon theme:  "/usr/share/icons/Mint-Y/mimetypes/symbolic/"
Plugins: checkprinting loaded
Plugins: csvexporter loaded
Plugins: csvimporter loaded
Plugins: gncimporter loaded
Plugins: icalendarexporter loaded
Plugins: kbanking loaded
KBankingPlugin: No AqB4 config found.
KBankingPlugin: No AqB3 config found.
Plugins: kbanking pluged
Plugins: ofximporter loaded
Plugins: qifexporter loaded
Plugins: qifimporter loaded
Plugins: reconciliation report loaded
Plugins: weboob loaded
Online plugins found 3
Couldn't start kuiserver from org.kde.kuiserver.service: QDBusError("org.freedesktop.DBus.Error.ServiceUnknown", "The name org.kde.kuiserver was not provided by any .service files")
Cost center model created with items 0
Payees model created with items 0
reading file
start parsing file
startDocument
reading securities
endDocument
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
qt5ct: D-Bus system tray: no
No text-to-speech plug-ins were found.
Plugins: checkprinting unloaded
Plugins: csvexporter unloaded
Plugins: csvimporter unloaded
Plugins: gncimporter unloaded
Plugins: icalendarexporter unloaded
Plugins: kbanking unpluged
Plugins: kbanking unloaded
Plugins: ofximporter unloaded
Plugins: qifexporter unloaded
Plugins: qifimporter unloaded
Plugins: reconciliation report unloaded
Plugins: weboob unloaded
Comment 7 kde@solis3.org 2018-07-08 10:19:01 UTC
Can someone provide a version 4.6.6-2 thats in ubuntu 16.04 that can run on 18.04? I am unable to do it because there are dependencies which block the normal  install from deb.
Comment 8 Jack 2018-07-08 14:41:52 UTC
The organization of your testing (in Comment 4) confused me.  However, as I read it, KMM4 save to Remote A (test 1) works and KMM5 save to Remote A (test 2) fails.  (I don't think it matters that the two KMM versions are on different PCs.)  KMM5 to Remote B works (your test 3) so as you do point out, the issue is with the interaction of KMM5 and Synology Diskstation.  The fourth test should simply be KMM4 to Remote B, but I think we'll all be very surprised if that fails.

As far ask I know, KMyMoney does not do anything special which depends on the location or file system being saved to.  That is all handled by the underlying KDE libraries (kdelibs for KMM4 or Frameworks for KMM5).  That is also why it will in general NOT be possible to run KMM4 and KMM5 on the same machine.  It is very hard to have both sets of KDE libraries installed together.  It's is not impossible, but any given distro has chosen one or the other. Those still on 4 are likely LTS and won't add 5; those that have moved to 5 have removed all need for the older libraries.

So, to quote Ralf from bug 396208)  "The fact that this function works with KDE4 shows that the problem lies in the underlying KF5 framework, probably in kio or the smb kioslave."  That bug only mentions opening, not saving, so it may or may not be the same bug.  Can you try the tests suggested in that bug?  That would test kio and without using KMM.  You did save with nano, but that is not a KDE application, so you might also try with Kate or some other KDE app.

Also, since KMM saves correctly to at least one SMB implementation (Samba on Remote B) then it would be nice if we could find any known differences in implementation between Samba and Synology Diskstation.  A browse through their README or release notes might have some useful information.
Comment 9 kde@solis3.org 2018-07-10 18:14:12 UTC
Ok, I had a little trouble with the tests in the other bug but I did try a different KDE5 application and hit issues.  We are getting somewhere.

Opening a text file in Kate on the same share reads OK.

kate -b /run/user/1000/gvfs/smb-share:server=bigstation.office.lan,share=hause/holidays/india/Details.txt

When I try to save, it says "root priviledges required".  Interesting.

When I enter a password, it then errors in a similar way.

"The document could not be saved, as it was not possible to write to /run/user/1000/gvfs/smb-share:server=bigstation.office.lan,share=hause/holidays/india/Details.txt.

Check that you have write access to this file or that enough disk space is available."
Comment 10 kde@solis3.org 2018-07-10 18:16:42 UTC
I should note that the file did not become zero length with kate, so I would argue at this point that a failure in write for KMM5 is not properly fail safe. Worth looking into as a side product
Comment 11 kde@solis3.org 2018-07-10 18:19:22 UTC
On a remote from a linux mint 18.3 mounted on this PC, loading text file as before using kate...  has no errors on save.  

So conclusion, KDE5 frameworks definitely has an issue with some samba implementations, specifically Synology. 

kate -b /run/user/1000/gvfs/smb-share:server=birchwood.office.lan,share=downloaded/test.txt

OK
Comment 12 kde@solis3.org 2018-07-10 18:40:57 UTC
Synology
$> smbd --version
Version 4.4.16
Synology Build 23739, May 19 2018 04:24:42

Mint 18.3
$> smbd --version
Version 4.3.11-Ubuntu
Comment 13 Jack 2018-07-10 18:51:00 UTC
I wonder if we need to reassign this bug to kio.  (Per comment 10, I think we can revisit whether KMM is using some unsafe save method until this smb issue is resolved.)

I would also suggest looking at the release notes for synology, and possible even for the smb standard, in case something has changed between versions 4.3 and 4.4 that would affect how kio interacts with it.
Comment 14 kde@solis3.org 2018-07-10 18:55:52 UTC
I got something..  When SMB2 and SMB3 is disabled on the Synology, it works as SMBv1.

Maybe this is a coincidence due to the different authentication, but its something.  Also note Synology is a much newer SMBD than Mint 18.3.

I will try Mint 19 share just to see if it has the same issues as Synology on a more recent SMBD.
Comment 15 kde@solis3.org 2018-07-10 19:01:01 UTC
Apart from comment 10, which is likely due to a code path issue on unexpected fail (i.e. all files become zero length due to the error not being expected/caught in the save function), I also believe this is not a KMM issue now.
Comment 16 Nate Graham 2018-07-13 19:08:07 UTC
Yep, this is a known KIO bug.

*** This bug has been marked as a duplicate of bug 344146 ***
Comment 17 Nate Graham 2018-07-13 19:09:04 UTC
Workaround: open the file from within KMyMoney and navigate to the Samba share within the file dialog, rather than first mounting the share using a GTK-based file manager (like Nemo).