Bug 400761

Summary: Cannot open files on MacOS
Product: [Applications] kmymoney Reporter: Matthias Jung <matthias>
Component: fileAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal CC: andrewho, applemansigloo, gshaud, mordio
Priority: NOR    
Version: git (master)   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In: 5.0.4
Sentry Crash Report:
Attachments: Replace kmymoneyutils::fileExists with version that uses QFileInfo instead of KIOStatJob

Description Matthias Jung 2018-11-06 20:46:12 UTC
SUMMARY

Loading a kmy file does not work.

STEPS TO REPRODUCE
1. I downloaded the DMG from: https://binary-factory.kde.org/view/MacOS/job/KMyMoney_Release_macos/
2. Start kmymoney app
3. Loading a kmy file 

OBSERVED RESULT

This warning pops up:

/Users/myzinsky/Downloads/test.kmy is either an invalid filename or the file does not exist. You can open another file or create a new one.

The console output (which seams to be related) is:

Couldn't start kuiserver from org.kde.kuiserver.service: QDBusError("org.freedesktop.DBus.Error.Disconnected", "Not connected to D-Bus server")
kf5.kio.core: couldn't create slave: "Can not find 'kioslave' executable at '/Users/myzinsky/.Trash/kmymoney.app/Contents/MacOS, /Users/myzinsky/.Trash/kmymoney.app/Contents/libexec, /Users/packaging/Craft/BinaryCache/macos-64-clang/lib/libexec/kf5'"


EXPECTED RESULT

It just loads a kmy file and works fine

SOFTWARE VERSIONS

The version is 5.0.80-bda8e4a
Comment 1 Matthias Jung 2018-12-30 16:03:54 UTC
Bump!
Comment 2 Jack 2018-12-30 16:16:10 UTC
I don't use Mac, but can you create a new file?  Then can you open the one you just created and saved?  Did you try to open that file from command line, or by doing File/Open and using the file chooser?
Comment 3 Matthias Jung 2018-12-30 16:25:22 UTC
Dear Jack,

both ways give the same problem: Opening from the menu, Autoloading the last file, and specifying from the command line.

I assume that something is missed in the app package (eg. kio)? 

Best,
Matthias
Comment 4 Matthias Jung 2019-01-08 22:00:36 UTC
Is there anything that I could do in order to debug?
Comment 5 Jack 2019-01-08 23:39:05 UTC
It does sound like a packaging issue, and I'm afraid none of the core team has too much experience either with the binary packaging workings or with MacOS.  We can try to find a team to help with the packaging issue in general.  

Separately - were you able to create and save a new file.  If not, that points even more towards a kio (or similar) issue, but if you can save but not open - hopefully that would point someone to a more likely cause.
Comment 6 Matthias Jung 2019-01-30 20:41:17 UTC
I can save a new file, but I cannot open it.

Is there anything that I could do to figure out what happens?
Comment 7 Thomas Baumgart 2019-01-30 20:47:42 UTC
Do you see any output if you start the application on a command line? If so, can you share it here?
Comment 8 Matthias Jung 2019-01-30 21:07:22 UTC
yes here it is: 

```
QPainter::begin: Paint device returned engine == 0, type: 2
WebConnect: Try to connect to WebConnect server
WebConnect: Connect to server failed
WebConnect: Running in server mode
Custom icons were not found in any of the following QStandardPaths::AppDataLocation:
"/Users/myzinsky/Library/Application Support/kmymoney"
"/Users/packaging/Craft/BinaryCache/macos-64-clang/share/kmymoney"
"/Library/Application Support/kmymoney"
"/Users/myzinsky/Desktop/kmymoney.app/Contents/Resources"
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::begin: Paint device returned engine == 0, type: 2
QFSFileEngine::open: No file name specified
Plugins: budgetview loaded
Plugins: checkprinting loaded
QIODevice::read (QFile, "/Volumes/kmymoney-master-253-macos-64-clang/kmymoney.app/Contents/Resources/checkprinting/check_template.html"): device not open
Plugins: csvexporter loaded
Plugins: csvimporter loaded
Plugins: forecastview loaded
Plugins: gncimporter loaded
Plugins: icalendarexporter loaded
Plugins: kbanking loaded
3:2019/01/30 22-04-33:gwen(55767):/Users/packaging/Craft/BinaryFactory/macos-64-clang/build/libs/gwenhywfar/work/gwenhywfar-4.20.0/src/base/plugin.c:  379: Plugin "dir" not found.
3:2019/01/30 22-04-33:(null)(55767):/Users/packaging/Craft/BinaryFactory/macos-64-clang/build/libs/aqbanking/work/aqbanking-5.7.8/src/libs/aqbanking/banking_cfg.c:   77: Could not create ConfigMgr[dir:///Users/myzinsky/.aqbanking/settings]. Maybe the gwenhywfar plugins are not installed?
3:2019/01/30 22-04-33:(null)(55767):/Users/packaging/Craft/BinaryFactory/macos-64-clang/build/libs/aqbanking/work/aqbanking-5.7.8/src/libs/aqbanking/banking_cfg.c:  100: No config manager. Maybe the gwenhywfar plugins are not installed correctly?
KBankingPlugin: No AqB4 config found.
KBankingPlugin: No AqB3 config found.
3:2019/01/30 22-04-33:aqbanking(55767):/Users/packaging/Craft/BinaryFactory/macos-64-clang/build/libs/aqbanking/work/aqbanking-5.7.8/src/libs/aqbanking/banking_cfg.c:  712: No config manager. Maybe the gwenhywfar plugins are not installed correctly?
Error on online init (-1).
Could not initialize KBanking online banking interface
Plugins: ofximporter loaded
Plugins: onlinejoboutboxview loaded
Plugins: qifexporter loaded
Plugins: qifimporter loaded
Plugins: reconciliation report loaded
Plugins: reportsview loaded
Plugins: sqlstorage loaded
Plugins: xmlstorage loaded
Couldn't start kuiserver from org.kde.kuiserver.service: QDBusError("org.freedesktop.DBus.Error.Disconnected", "Not connected to D-Bus server")
kf5.kio.core: couldn't create slave: "Can not find 'kioslave' executable at '/Users/myzinsky/Desktop/kmymoney.app/Contents/MacOS, /Users/myzinsky/Desktop/kmymoney.app/Contents/libexec, /Users/packaging/Craft/BinaryCache/macos-64-clang/lib/libexec/kf5'"
```
Comment 9 Jack 2019-02-07 19:15:09 UTC
Someone on Linux just reported the same kuiserver error.  He had compiled from source, and was missing the plasma-workspace package as a dependency.  It might be that the binary-factory build has the same problem.
Comment 10 Matthias Jung 2019-02-07 20:02:15 UTC
So who is in charge of the Mac packaging and CI/CD and can fix it?
Comment 11 Thomas Baumgart 2019-02-09 11:18:15 UTC
I analyzed the logs on https://binary-factory.kde.org/view/MacOS/job/KMyMoney_Release_macos/176/console and see it failing in building akonadi. I am not sure if we can live without akonadi but can certainly try (for MacOS). Some functionality will be missing then, but it might be worth it.
Comment 12 Thomas Baumgart 2019-02-09 11:25:48 UTC
Ok, I removed the dependency on akonadi for MacOS builds (https://commits.kde.org/craft-blueprints-kde/7630e2f52b5d929e99ab0cdfcedfbc6f50357cc1). Let's see what happens during the next build cycle.
Comment 13 Thomas Baumgart 2019-02-09 16:48:02 UTC
Git commit d292de0b7f976d38d7c4e966aff573d7bb88fdd6 by Thomas Baumgart.
Committed on 09/02/2019 at 13:15.
Pushed by tbaumgart into branch '5.0'.

Set precision of amount edit fields for fees and interest

M  +2    -0    kmymoney/dialogs/investtransactioneditor.cpp

https://commits.kde.org/kmymoney/d292de0b7f976d38d7c4e966aff573d7bb88fdd6
Comment 14 Jack 2019-02-09 16:52:30 UTC
Sorry, but I don't see the connection of this commit to this bug.  Am I missing something, or does it belong to a different bug?
Comment 15 Thomas Baumgart 2019-02-09 17:08:40 UTC
You're right. It should have been 403885.
Comment 16 Thomas Baumgart 2019-02-10 14:56:27 UTC
(In reply to Thomas Baumgart from comment #12)
> Ok, I removed the dependency on akonadi for MacOS builds
> (https://commits.kde.org/craft-blueprints-kde/
> 7630e2f52b5d929e99ab0cdfcedfbc6f50357cc1). Let's see what happens during the
> next build cycle.

Now it's failing on some tls dependency. I have no clue where that comes from and how to fix it. BTW: Project Kile is failing with the same problem, though.
Comment 17 Matthias Jung 2019-03-05 20:53:24 UTC
Is there anything what I can test?
Comment 18 Benjamin Southall 2019-03-18 06:18:55 UTC
I also have this problem (I can't open any files, both existing valid files and new ones that I create) running Gentoo Linux, but I have kioslave installed, I am not sure why kuiserver is needed, I didn't have plasma-workspace installed before and kmymoney previously worked., I also get 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"), but no other error.

I am not sure if the issue has to do with validation scheme checks at 
https://github.com/KDE/kmymoney/blob/fccd937fd6e72078c7498022c0e9ade2d880ca64/kmymoney/kmymoney.cpp#L3380 and elsewhere only accepting the sql scheme ? I would believe that xml files are the xml scheme or am I mistaken ?
Comment 19 Benjamin Southall 2019-03-19 03:24:52 UTC
Created attachment 118901 [details]
Replace kmymoneyutils::fileExists with version that uses QFileInfo instead of KIOStatJob

(In reply to Benjamin Southall from comment #18)
> I also have this problem (I can't open any files, both existing valid files
> and new ones that I create) running Gentoo Linux, but I have kioslave
> installed, I am not sure why kuiserver is needed, I didn't have
> plasma-workspace installed before and kmymoney previously worked., I also
> get 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"), but no other
> error.
> 
> I am not sure if the issue has to do with validation scheme checks at 
> https://github.com/KDE/kmymoney/blob/
> fccd937fd6e72078c7498022c0e9ade2d880ca64/kmymoney/kmymoney.cpp#L3380 and
> elsewhere only accepting the sql scheme ? I would believe that xml files are
> the xml scheme or am I mistaken ?

I was mistaken, they are the file scheme, but I was looking in the wrong place. I tried installing a standalone version of kuiserver, from https://github.com/sandsmark/kuiserver-standalone and using that which got rid of the error message but not the bug.

I then wrote the following patch, which resolved the problem for me, and may also work on Mac OS, but I haven't tested it there.
Comment 20 Thomas Baumgart 2019-03-19 09:21:48 UTC
Git commit 045d74b680a7fc691690d6c35c76d32053602553 by Thomas Baumgart.
Committed on 19/03/2019 at 09:21.
Pushed by tbaumgart into branch '5.0'.

Avoid using KIO on local files

Using KIO on MacOS and Windows may cause some trouble and is not
required when working on local files. This change tries to bypass the
KIO functions by using Qt standard functions in this case.
FIXED-IN: 5.0.4

M  +14   -7    kmymoney/kmymoneyutils.cpp

https://commits.kde.org/kmymoney/045d74b680a7fc691690d6c35c76d32053602553
Comment 21 Thomas Baumgart 2019-03-20 18:35:15 UTC
*** Bug 405689 has been marked as a duplicate of this bug. ***
Comment 22 Matthias Jung 2019-03-26 22:37:58 UTC
Still the problem persists when trying the nightly build:

https://binary-factory.kde.org/view/MacOS/job/KMyMoney_Nightly_macos/
Comment 23 Thomas Baumgart 2019-03-27 06:32:42 UTC
You used the wrong version. The fix went into the 5.0 branch and is (not) yet backported/merged into master. https://binary-factory.kde.org/view/MacOS/job/KMyMoney_Release_macos/ would be the version to use. Please re-test.
Comment 24 Matthias Jung 2019-03-27 07:46:44 UTC
Yes, sorry. Now this bug is fixed. However, there are new ones, which I will report separately.

Best,
Matthias
Comment 25 Thomas Baumgart 2019-04-05 17:55:53 UTC
*** Bug 406258 has been marked as a duplicate of this bug. ***