Bug 419082 (Richie)

Summary: Backup
Product: [Applications] kmymoney Reporter: richardwcave
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: critical CC: gilles.lefebvre5001, john, me
Priority: NOR    
Version: 5.0.6   
Target Milestone: ---   
Platform: Windows CE   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 5.1.0
Sentry Crash Report:

Description richardwcave 2020-03-21 20:07:59 UTC
SUMMARY
Use file-backup but fails to backup

STEPS TO REPRODUCE
1. file/backup
2. Enter Mount point e.g. E:/users/...etc
3. tick box 'mount this directory before backup

OBSERVED RESULT
KMyMoney indicates progess bar 'Mounting E:/User/...etc' but the task freezes and I have to abort program using windows task manager

EXPECTED RESULT
Backup of file to windows director specified

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
Re-downloaded KMyMoney 5.0.6 again and re-installed but same bug is present
Comment 1 Jack 2020-03-21 20:27:55 UTC
Is E: already mounted?  If so, no need to tick the "mount" checkbox.  If it is NOT already mounted, then what is it?  Samba, NFS, USB stick, ...?
Comment 2 richardwcave 2020-03-21 20:44:57 UTC
Hi
I've tried both ticked and unticked.

KMyMoney installed on C:
I'm trying to backup to already mounted drive E: which is installed and mounted in PC

Either ticked or unticked, the backup freezes.

Thanks
Comment 3 richardwcave 2020-03-21 20:46:30 UTC
Sorry forgot to say E: is a NTFS local disk installed on PC
Comment 4 Jack 2020-03-21 23:30:59 UTC
So E: is just a normal local hard disk?  Can you run KMyMoney from a command line to see if it gives any hints what it's waiting for?  Are the permissions OK on the folder to which you are trying to back up?
Comment 5 richardwcave 2020-03-22 08:35:15 UTC
Yes, E: is just a normal local hard disk and I get a dialog box saying file backup error.
I'm not a developer so I've reverted back to KMyMoney v4.6.4, which works perfectly and backs up without a hitch. 
I am not confident using v5 until such a critical error is fixed.
Thank you and bye
Comment 6 Thomas Baumgart 2020-03-22 13:31:08 UTC
I tried this using Version 5.0.7-f8ae85c34 (the current is 5.0.8-029de4701 but that does not matter I guess) on a Windows 10 Professional 64 bit system. It can backup to a local drive (C:\users) and a network attached drive (SMB) without problems. 

The only problem is a leading '/' character in front of the drive code that appears when I select the directory using the 'Choose' button right to the mount point, but manually removing this superfluous character solved the issue.

The 'Mount this directory before backing up' checkbox must not be marked on Windows. I thought we removed that already but apparently not.

I am wondering what happens in case you execute the following command in a CMD shell window:

  cmd.exe /c copy /b /y xxx + nul E:\test.kmy

where you replace xxx with the absolute path (use \ as dir separator) to your data file. Does it make a difference if KMyMoney is running or not. On the above mentioned system this copies the file without problems.

Since you mention that it works on 4.8 I checked the code. 4.8 uses KIO::NetAccess::upload() to store the file, a functionality that is not available in KF5. That explains at least why it works on the older version.

Are you really using Windows CE?
Comment 7 richardwcave 2020-03-22 14:25:34 UTC
Your diagnosis is correct on my system.
In v5 when I File/backup the KMymoney programme generates a file directory and after I choose the location of a folder to back up it to, KmyMoney records this as follows in the dialog box: -
/E:/Users/Rxxxxxxxxxx/...../KMyMoney/5.0 tests/Test backups

You will see at the beginning there is '/', which prevents the backup file from being saved.
If I remove the '/' from the beginning of the absolute address the backup file is stored successfully.

I tested the command prompt
cmd.exe /c copy /b /y E:\Users\Rxxxx\Documents\....\Rxxxx.kmy + nul E:\test.kmy
This sucessfully copied the KMymoney file to E:\test.kmy regardless of whether or not I had KMymoney programme running.

To clarify I'm using Windows 10 Pro 1909 installed 22/06/2019 OS build 18363.720

Based on the success of these tests I will revert back to KMymoney v5 and just remove the '/' before the backup folder location, until a fix comes along.

Thank you.
Comment 8 Thomas Baumgart 2020-03-22 18:28:01 UTC
Git commit c195e0cda57949891207f5c7f2c817d2b6fbe298 by Thomas Baumgart.
Committed on 22/03/2020 at 18:27.
Pushed by tbaumgart into branch '5.0'.

Improve handling of the backup feature on MS windows

On windows the option to mount a device is not available. So the GUI
elements have been removed in this case and the label is adjusted to be
more precise.

GUI:
FIXED-IN: 5.0.9

M  +10   -0    kmymoney/dialogs/kbackupdlg.cpp
M  +15   -35   kmymoney/dialogs/kbackupdlg.ui
M  +15   -3    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/c195e0cda57949891207f5c7f2c817d2b6fbe298
Comment 9 Thomas Baumgart 2020-03-22 18:34:12 UTC
I forgot to mention that a leading slash in front of a drive letter will be removed before it is used. So it may still be returned into the edit field but it does not cause trouble anymore.
Comment 10 richardwcave 2020-03-22 18:40:32 UTC
First class responses and thanks for the resolution.
Comment 11 Thomas Baumgart 2020-03-23 17:21:46 UTC
*** Bug 418493 has been marked as a duplicate of this bug. ***
Comment 12 Thomas Baumgart 2020-07-13 10:02:42 UTC
*** Bug 424143 has been marked as a duplicate of this bug. ***