Bug 406574

Summary: Can't load from *.xmi file (possibly error with temporary file)
Product: [Applications] umbrello Reporter: Vasyl Teliman <vasniktel>
Component: generalAssignee: Umbrello Development Group <umbrello-devel>
Status: RESOLVED FIXED    
Severity: critical CC: joseph.axel, kgamesan, kitt997, ralf.habacker, rdieter, tobias.klausmann
Priority: NOR    
Version: 2.27.3 (KDE Applications 18.12.3)   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 2.28.1 (KDE Applications 19.04.1)
Attachments: Fix

Description Vasyl Teliman 2019-04-15 18:52:39 UTC
SUMMARY

I am unable to load my project via *.xmi file.

It says file does not exist (even though it does exist).

I've dig into sources and figured that it fails in UMLDoc::openDocument function on line `if (!tmpfile.exists())` (513 line as of today). 

This is strange since the actual temporary file is being created (I've checked it).

Hint:
Since previously everything worked fine I suspect `anaconda` might be the reason for that (though this might sound awkward): during umbrello installation it installed python 2 as well as a dependency; after I've installed anaconda, it replaced my python 2 with python 3 without changing a command to execute it (so now, if I type `python`, it executes python 3 instead of 2). If umbrello does depend on python 2 it might cause some problems (it seems though I'm not sure).


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: neon user edition 5.15.4
(available in About System)
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.57.0
Qt Version: 5.12.0
Comment 1 Tobias Klausmann 2019-04-22 21:43:12 UTC
Created attachment 119574 [details]
Fix

Hi,
i hit the same bug unexpectedly while opening my files as well. This started to happen after an update to KDE Frameworks Version 5.57.0.

While checking the code i found it to assume a file still exists after it is overwritten. Which may have worked but with 5.57.0 Kio file copies seem to honor the used "KIO::Overwrite" flag. As a conclusion: Just do not use the overwritten file instance for error checks, instead use the file instance we created after the copy.
Comment 2 Luca Beltrame 2019-04-23 05:04:42 UTC
Please submit your patch through Phabricator (https://phabricator.kde.org) or chances are it will not get the attention it deserves.
Comment 3 Tobias Klausmann 2019-04-26 15:41:15 UTC
It seems it does not get attention anyway. So this is a "ping". Maybe somebody can review this:

https://phabricator.kde.org/D20775
Comment 4 Ralf Habacker 2019-04-26 22:46:31 UTC
I'm currently in the update process to KF5 5.57.0 to be able to reproduce this issue.
Comment 5 Tobias Klausmann 2019-04-26 23:43:19 UTC
Thanks! 
Btw: I looked at the root cause of this, but forgot to post: With 5.57 there is only one changelog entry that jumped into my eyes: "Make file overwrite a bit safer (bug 125102)". When looking into the commit that fixed bug #125102, it states:
"Instead of truncating the existing file, a separate copy of the source file in the
destination folder is created. If the copy was successfully created, the existing
destination file is replaced with it. ..."

With the replace the root cause is found!
Comment 6 Ralf Habacker 2019-04-27 01:06:36 UTC
I can confirm this issue with kf5 version 5.57.
Comment 7 Ralf Habacker 2019-04-27 01:26:43 UTC
Git commit 04580cac31b1f1a1491a1fc54cfc4c724ce50cd9 by Ralf Habacker.
Committed on 27/04/2019 at 01:26.
Pushed by habacker into branch 'Applications/19.04'.

file import: do not use overwritten temporary file

We checked if the temporary file we created still exists after its creation,
yet in the meantime we have already copied to it (which overwrites it):
KIO::FileCopyJob *job = KIO::file_copy(url, dest, -1, KIO::Overwrite);

Instead of the temporary file, check if the regular file we use later on
exists.

This bug is a result of fixing bug 125102.
Related: bug 125102
FIXED-IN:2.28.0 (KDE Applications 19.04.0)

Reviewed By: habacker
Differential Revision: https://phabricator.kde.org/D20775

M  +4    -4    umbrello/umldoc.cpp

https://commits.kde.org/umbrello/04580cac31b1f1a1491a1fc54cfc4c724ce50cd9
Comment 8 Tobias Klausmann 2019-04-27 12:42:59 UTC
Well i'm glad this is upstream now.

This is a minor fix, yet i'm upset you plagiarize my work, using your name as author. Especially in an OS community like KDE this should not happen at all!
Comment 9 Ralf Habacker 2019-04-28 13:50:07 UTC
(In reply to tobijk from comment #8)
> This is a minor fix, yet i'm upset you plagiarize my work, using your name
> as author. Especially in an OS community like KDE this should not happen at
> all!
I applied the patch as all other patches before with the phabricator command line tool 'arc'. You should contact the maintainers of phabricator.kde.org and report this issue to them.
Comment 10 Ludovic Jozeau 2019-04-29 18:06:36 UTC
*** Bug 407052 has been marked as a duplicate of this bug. ***
Comment 11 Ludovic Jozeau 2019-07-07 11:57:18 UTC
*** Bug 409573 has been marked as a duplicate of this bug. ***
Comment 12 Ludovic Jozeau 2019-07-07 12:03:23 UTC
*** Bug 408050 has been marked as a duplicate of this bug. ***