Bug 302945 - Backup can't be performed on Windows
Summary: Backup can't be performed on Windows
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: unspecified Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KDE-Windows
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-03 08:03 UTC by Cristian Oneț
Modified: 2021-04-16 09:05 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.1,5.0.3
ralf.habacker: version_5_applied+
ralf.habacker: Version_5+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cristian Oneț 2012-07-03 08:03:21 UTC
Because 'cp' is used to copy the file backup will fail on a Windows platform.

Reproducible: Always

Steps to Reproduce:
Try to backup a file.
Actual Results:  
The backup will fail.

Expected Results:  
The backup should not fail.

A workaround this issue is to extract cp.exe from the unixtools package http://sourceforge.net/projects/unxutils/files/unxutils/current/UnxUtils.zip/download and place it in the KDE on windows installation folder in the same directory as kmymoney.exe.
Comment 1 Cristian Oneț 2012-07-03 08:06:18 UTC
The cp.exe is localte in 'usr/local/wbin' in the given archive.
Comment 2 Cristian Oneț 2013-09-13 09:47:09 UTC
This is fixed in the standalone kmymoney installer.
Comment 3 Ralf Habacker 2017-07-05 14:53:20 UTC
Thanks for this fix which has the disadvantage to have a dependency to a 3rdparty tool. I'm going to fix this by using the windows build in copy command.
Comment 4 Ralf Habacker 2017-07-05 14:53:54 UTC
Git commit d5674713e0c6ce002f54a5e894f22f77b5109b64 by Ralf Habacker.
Committed on 05/07/2017 at 14:51.
Pushed by habacker into branch '4.8'.

Fix 'Backup can't be performed on Windows'

Avoid the need of a 3rdparty tool to support file backup
on windows by using build in copy command.
FIXED-IN:4.8.1

M  +7    -3    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/d5674713e0c6ce002f54a5e894f22f77b5109b64
Comment 5 Nicolás Alvarez 2017-07-05 22:26:42 UTC
Wow, why is this using an external command at all? Surely it can be copied in-process? There is a QFile::copy method...
Comment 6 Kevin Funk 2017-07-05 23:41:12 UTC
And ever heard of this thing called KIO? :)
Comment 7 Ralf Habacker 2017-07-06 08:18:04 UTC
(In reply to Nicolás Alvarez from comment #5)
> Wow, why is this using an external command at all? 
I did not wrote this stuff and git log does not show anything related, so I don't know. May be some of the long time contributors is able to give some insides.
> Surely it can be copied in-process? There is a QFile::copy method...
The current implementation is bound to call external tools and would require to rewrite the whole stuff.
Comment 8 Ralf Habacker 2017-07-06 08:20:08 UTC
Git commit da03f3b25c3a193b6ea0e9c9c08abe406ecdc97e by Ralf Habacker.
Committed on 06/07/2017 at 08:19.
Pushed by habacker into branch '4.8'.

Disable mount box in the backup dialog on Windows

Visible devices are always mounted.

M  +3    -0    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/da03f3b25c3a193b6ea0e9c9c08abe406ecdc97e
Comment 9 Ralf Habacker 2017-07-06 08:20:08 UTC
Git commit 72e1d03928de7534fc02a66610fb077765ec5215 by Ralf Habacker.
Committed on 06/07/2017 at 08:19.
Pushed by habacker into branch '4.8'.

On Windows if backup file exists make sure that it will be overwritten

M  +1    -1    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/72e1d03928de7534fc02a66610fb077765ec5215
Comment 10 Ralf Habacker 2017-07-06 08:55:36 UTC
(In reply to Kevin Funk from comment #6)
> And ever heard of this thing called KIO? :)
Would probably be better as using QFile because there is a gui included but needs nearly the same refactoring as mentioned in comment 7.
Comment 11 Ralf Habacker 2017-07-06 16:52:43 UTC
(In reply to Ralf Habacker from comment #10)
> (In reply to Kevin Funk from comment #6)
> > And ever heard of this thing called KIO? :)
> Would probably be better as using QFile because there is a gui included but
> needs nearly the same refactoring as mentioned in comment 7.

Just a KIO related question: any idea if the windows implementations of  KIO::mount() is able to mount windows or samba share and does it provide a dialog for optional requesting username and passwords ? I did not found any related hint at https://api.kde.org/frameworks/kio/html/namespaceKIO.html#a13bf133780931faa4a00d68824cadbcd
Comment 12 Ralf Habacker 2017-07-06 20:24:29 UTC
Git commit dc068d874c3eb06c71aad8bf1d2521e7cc8b759d by Ralf Habacker.
Committed on 06/07/2017 at 20:23.
Pushed by habacker into branch '4.8'.

The Windows build in copy command does not like '/' as separator.

Still need to find a way to get rid of the required 'true.exe'.

M  +2    -1    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/dc068d874c3eb06c71aad8bf1d2521e7cc8b759d
Comment 13 Ralf Habacker 2017-07-06 20:24:29 UTC
Git commit c514b4ccafc0e86ee2f9ec70b73bd6c4d3b11d45 by Ralf Habacker.
Committed on 06/07/2017 at 20:23.
Pushed by habacker into branch '4.8'.

On creating backup files get rid of requirement to true.exe on Windows

M  +17   -2    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/c514b4ccafc0e86ee2f9ec70b73bd6c4d3b11d45
Comment 14 Jack 2017-07-06 22:09:30 UTC
(In reply to Ralf Habacker from comment #7)
Note the original bug and fix were from 2012, so before git, and maybe even KDE3.  It does not seem to make sense to put more effort to this until it can be re-written to use KIO, probably for version 5.  Should someone open a separate bug/wish list for that?
Comment 15 Ralf Habacker 2017-07-10 09:38:07 UTC
Git commit d6027c835211f9b381e0d2e5f629c0aad15c1f9c by Ralf Habacker.
Committed on 10/07/2017 at 09:37.
Pushed by habacker into branch '4.8'.

Move out backup related actions like mount, write, unmount and finish into separate methods

This makes the implementation easier to understand and reduces the
number of duplicated implementations.

M  +80   -95   kmymoney/kmymoney.cpp
M  +29   -5    kmymoney/kmymoney.h

https://commits.kde.org/kmymoney/d6027c835211f9b381e0d2e5f629c0aad15c1f9c
Comment 16 Thomas Baumgart 2018-11-05 15:36:19 UTC
Git commit be3dfc7d78cda1794a4597abe7f0fa13b5a375bc by Thomas Baumgart.
Committed on 05/11/2018 at 15:36.
Pushed by tbaumgart into branch '5.0'.

Provide all arguments separately

All arguments to the copy command need to be presented as their own
element in the argument list. The current code resulted in an invalid
source filename with "+ nul" appended.

M  +1    -1    kmymoney/kmymoney.cpp

https://commits.kde.org/kmymoney/be3dfc7d78cda1794a4597abe7f0fa13b5a375bc