Bug 461557 - Failure to save to samba share on remote Debian server
Summary: Failure to save to samba share on remote Debian server
Status: RESOLVED NOT A BUG
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: 5.1.3
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-07 17:59 UTC by Jason Gibson
Modified: 2022-11-08 22:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Gibson 2022-11-07 17:59:10 UTC
SUMMARY
***
Failure to save changed files on samba share.
***
An error is thrown when trying to save. This results in inability to close Kmymoney. You need to kill it via Task Manager to stop it. 

STEPS TO REPRODUCE
1.  Move files to remote server.
2.  Create samba share to the proper directory.
3.  Open file with Kmymoney, make any changes. Then try to save the file.

OBSERVED RESULT

Error - Unable to open file '//$SERVER/kmymoney/OurFinances.kmy' for writing. C:\_\9b0777e7\kmymoney\kmymoney\plugins\xml\xmlstorage.cpp:510

EXPECTED RESULT

Save as normal and move on with my life.


SOFTWARE/OS VERSIONS
Edition	Windows 10 Home
Version	22H2
Installed on	‎9/‎8/‎2022
OS build	19045.2193
Experience	Windows Feature Experience Pack 120.2212.4180.0

ADDITIONAL INFORMATION

The specific samba config for kmymoney is as follows.

[kmymoney]
        comment = our finances via kmymoney
        path = /home/jason/Documents/Kmymoney
        browseable = no
        read only = no
        guest ok = no
        valid users = jason
        create mask = 0644
        directory mask = 0755

Debian samba version - 

$ apt policy samba
samba:
  Installed: 2:4.13.13+dfsg-1~deb11u5

I am able to create and delete files manually via the Windows file manager, just can't save a changed .kmy file.
Comment 1 Jack 2022-11-07 23:18:55 UTC
Which version of KMyMoney are you using?  (I don't think it should matter, but just in case.)
You can create and delete files on the share, but can you overwrite an existing file?  Try opening a small text file in an editor, changing the file, and try to save it.  Separately, what does the file manages say about the properties of the kmy file you are trying to save to?
Can you launch KMyMoney from command line (a CMD prompt, for example) to see if there is any more detailed error output to the console?
Comment 2 Jason Gibson 2022-11-07 23:56:16 UTC
I thought I had selected it in the info above. Kmymoney version  5.1.3-55e5c3c37

Cmd output - Unable to write changes to: //192.168.1.2/kmymoney/OurFinances.kmy
Reason: Unable to open file '//192.168.1.2/kmymoney/OurFinances.kmy' for writing. C:\_\9b0777e7\kmymoney\kmymoney\plugins\xml\xmlstorage.cpp:510

As for any file I create I can modify and save to my hearts content. The permissions under the settings in the file manager is everyone has full control of the .kmy file.
Comment 3 Jack 2022-11-08 00:59:26 UTC
I assume 192.168.1.2 is the correct IP for the Samba server.  
My best guess is that has to do with the way KMM actually saves a file, although I don't see any changes in the code since 2021.  There may also be some strange interaction between Windows10 and Samba.  I think this will need an look from one of the developers.
Comment 4 Jason Gibson 2022-11-08 02:13:10 UTC
Indeed. That is my server's lan ip. I can open the file just fine browsing to it through the file manager once I've added the share. But saving is another story.
Comment 5 Paul Worrall 2022-11-08 12:21:15 UTC
For info: I created a samba share on my Debian server using the same config, and using KMyMoney for Linux it saves OK to that.
Comment 6 Jason Gibson 2022-11-08 20:09:14 UTC
Must be my samba config I guess. Just almost the same error.

Unable to open file '/mnt/OurFinances.kmy' for writing. /build/kmymoney-N273ro/kmymoney-5.1.1/kmymoney/plugins/xml/xmlstorage.cpp:529

This was mounting to my Debian side of my desktop with cifs-utils. I can't imagine why though as I didn't change anything on the defaults, just added my shares. I'll investigate further on my end. Thank you.
Comment 7 Jason Gibson 2022-11-08 20:12:54 UTC
Marking as resolved. Turns out a permissions issue. Linux was mounting it as root. Adding -o uid=5004,gid=5004 (my user) and it works fine. I'll see what the equivalent on Windows is. On Linux it saved just fine. Thank you much.
Comment 8 Jack 2022-11-08 22:29:52 UTC
Thanks for the follow-up.  Windows doesn't know anything about Linux users and permissions, so Windows itself may well have thought it had full permissions, as long as it was able to mount the share.  Windows was happy until the actual attempt by KMM failed.  Oddly, I notice the difference in line numbers between your two reports.  It looks like you are running 5.1.1 on Debian, which was shortly before some changes to that code, although it doesn't seem to have made any difference in your case.