Bug 412570 - appimage csv import not available
Summary: appimage csv import not available
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: importer (show other bugs)
Version: git (master)
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-10-03 18:07 UTC by Jaka Kranjc
Modified: 2019-10-09 20:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaka Kranjc 2019-10-03 18:07:15 UTC
SUMMARY
I'm trying a stable appimage and in the settings, the csv importer plugin is there; however it's not present in the file menu for actual importing.

STEPS TO REPRODUCE
1. Get a stable appimage and run it.
2. Check settings to see that CSV importer is there, enabled and configurable — all by default
3. Check the File > Import submenu, where only account templates are listed.

OBSERVED RESULT
Not possible to run CSV import.

EXPECTED RESULT
Possible to run CSV import.
Comment 1 Thomas Baumgart 2019-10-03 19:04:50 UTC
I am unable to reproduce this with KMyMoney-5.0.80-ac52211-x86_64.AppImage nor KMyMoney-5.0.7-cf73ac5-x86_64.AppImage. Both work as expected. Which one did you try?
Comment 2 Jaka Kranjc 2019-10-03 19:12:06 UTC
It was KMyMoney-5.0.7-cfd038c-x86_64.AppImage ... however now that I reran it, the menu is there. Eeeh.
Comment 3 Jaka Kranjc 2019-10-03 19:17:12 UTC
Aha! It is indeed a dependency issue. It worked the second time and for you, since I installed KMM via my package manager in the meanwhile, just to see if it could cope with my CSVs. I uninstalled it after the successful appimage rerun, thinking it was a heisenbug, but now it doesn't work again.

So something isn't packaged in the image and it only works if the library is present on the system.
Comment 4 Thomas Baumgart 2019-10-03 19:56:17 UTC
So I uninstalled KMyMoney (and AqBanking just in case) but I am still unable to duplicate the problem: the menu is there. So where is the Heisenbug?
Comment 5 Jaka Kranjc 2019-10-03 20:04:57 UTC
I get the same result. Manually installing libaquabanking drags these debs in:
libaqbanking-data libaqbanking35 libaqbanking35-plugins libaqebics0 libaqhbci24 libaqofxconnect7 libgwenhywfar-data libgwenhywfar60
  libktoblzcheck1v5

But that's not enough. You don't know which dependencies are connected to this?
Comment 6 Jack 2019-10-03 20:05:29 UTC
What about running the appimage from command line to see if it throws any errors?  Also, I believe there is a command line parameter to unpack the appimage, and they you could try ldd on the main kmymoney executable.
Comment 7 Jaka Kranjc 2019-10-03 20:17:16 UTC
I am running from cmd, but the log looked too noisy before. Here are the relevant parts:

Located plugin "/tmp/.mount_KMyMon9Z2Qr4/usr/plugins/kmymoney/csvimporter.so" Validity true
/.../
Loading "/tmp/.mount_KMyMon9Z2Qr4/usr/plugins/kmymoney/csvimporter.so"
kf5.kxmlgui: cannot find .rc file "csvimporter.rc" for component "csvimporter"
Plugins: csvimporter loaded

So it seems you were right in the sense that it's not a library problem. Similar errors for some other plugins.

The rc is there, in /tmp/.mount_KMyMon*/usr/share/kxmlgui5/csvimporter/csvimporter.rc, so why doesn't it find it? Is this a Qt versioning thing? Mine is 5.11.1.
Comment 8 Jaka Kranjc 2019-10-03 20:22:40 UTC
These are the places it's looking at here:

$ strace ./KMyMoney-5.0.7-cfd038c-x86_64.AppImage |& grep -i csvimporter.rc
stat("~/.local/share/kxmlgui5/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/share/plasma/kxmlgui5/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/kxmlgui5/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/share/kxmlgui5/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/var/lib/snapd/desktop/kxmlgui5/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/~/.local/share/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/share/plasma/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/share/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/var/lib/snapd/desktop/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("~/.local/share/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/share/plasma/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/local/share/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/usr/share/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
stat("/var/lib/snapd/desktop/csvimporter/csvimporter.rc", 0x7ffdf7608b00) = -1 ENOENT (No such file or directory)
write(2, "kf5.kxmlgui: cannot find .rc fil"..., 79kf5.kxmlgui: cannot find .rc file "csvimporter.rc" for component "csvimporter"

I don't know enough about appimages to say if anything is fishy about the paths. Is there a non-root way to do chroots nowadays?
Comment 9 Jack 2019-10-03 21:34:22 UTC
Not finding the rc file is not an error, just a notification, as the plugin does get loaded.  I also know little about appimage packaging.

However, I uninstalled KMyMoney and I DO reproduce the issue.  I don't have aqbanking installed, so that seems not related.  I do see an error from gwenhywfar '401: plugin "dir" not found' and from aqbanking '405: No config manager.'  but I get those with or without the system KMM package installed.

I used the --appimage-extract parameter when running the appimage, and then tried ldd on several files in the unpacked version - but didn't find anything it couldn't find.

Thomas - can you try also uninstalling gwenhywfar to see if it makes a difference for you?

Jaka - I don't understand your question about chroot?  I do think chroot is still restricted to root, but don't know why you would need it here.
Comment 10 Thomas Baumgart 2019-10-03 21:54:47 UTC
I uninstalled Gwenhywfar and remove my csvimporterrc file. The csv import still shows up in the menu.
Comment 11 Jack 2019-10-03 22:43:40 UTC
I just noticed I also get "Could not initialize KBanking online banking interface" and the kbanking plugin seems to not have been loaded.  However I don't know that is relevant.  All the import and exporter plugins claim to have loaded, but none show up on the import or export menu.
I don't have any more time today, but would it help to use a debugger to trace through the code that adds or doesn't add any of the importers to the menu?
Comment 12 Thomas Baumgart 2019-10-04 12:33:53 UTC
KBanking is a different issue. Some files are not packaged and I already made a change (https://cgit.kde.org/kmymoney.git/commit/?id=baca47ea3954847f5534095f39c5281657760911).

Can you check that the importers are enabled in the plugins settings page in KMyMoney? If yes, then another thing could be that there is a file called ~/.local/share/kxmlgui5/kmymoney/kmymoneyui.rc  If so, move it out of the way and check if the problem persists.
Comment 13 Jaka Kranjc 2019-10-04 14:37:35 UTC
My ~/.local/share/kxmlgui5/kmymoney/ is empty.

Jack, re chroot: I was just wondering why the paths from strace don't have the /tmp/.mount_KMyMon* prefix. It's where the image unpacks its files and runs from, so why is it only looking at the system paths if something like chroot isn't in between?
Comment 14 Jaka Kranjc 2019-10-04 14:39:42 UTC
And are you certain the rc file is not a problem? The content make it look like it would add the menu item:

<!DOCTYPE kpartgui>
<kpartgui name="kmymoneyplugin-csvimporter" version="0">
  <MenuBar>
    <Menu name="file">
      <Menu name="import" append="import_merge">
        <Action name="file_import_csv" />
      </Menu>
    </Menu>
  </MenuBar>
</kpartgui>
Comment 15 Jack 2019-10-04 16:08:33 UTC
(In reply to Thomas Baumgart from comment #12)
All importers and exporters are enabled in the plugins config settings.  Moving that file out of the way does not make any difference.
Comment 16 Jack 2019-10-04 19:45:36 UTC
(This is my third attempt to post this - but my browser keeps crashing and losing everything, so I'll be real brief here.)
Comments 13 and 14 finally gave me the hint I needed.  Grepping for /usr/local in the strace on the appimage with a local version installed showed many rc files, for example ofximporter.rc.  With the local version uninstalled, and grepping the strace output for ofximporter.rc shows it looking in lots of places, but NOT under /tmp/.mount_KMyMonHr2DTM.  Although that dir is owned by root, everything under is looks to have read and the necessary execute privs for anyone.
In direct answer to comment 13, I don't think there is any chroot involved, just that root has done the mount.  If there was a chroot, it couldn't ever look outside that area, which it clearly does.
My best guess is that one of the necessary environment variables (perhaps XDG_DATA_DIRS) is NOT haveing the local version (/tmp/.mount_XXX/usr/share) prepended.  I have no idea how to test for this.
Comment 17 Jack 2019-10-04 19:49:28 UTC
Minor additional note/question:  since the mount of the squashfs is done using fuse, I have no idea why is is done as root, as I though fuse explicitly allows userland mounting of such things.
Comment 18 Jaka Kranjc 2019-10-04 21:42:20 UTC
I don't know the appimage design targets, but I thought it was supposed to be a self-contained archive. Looking at system paths defeats that goal completely. But it's also not something this project can fix, just work around. Prepending the tmp dir to XDG_DATA_DIRS sounds like a good idea (snap already does it).

Looking at the meagre docs, plugins are supported, but they're whole projects and none exist for something as simple as this. Another option are hooks, though I don't know if they'd cut it:
https://github.com/linuxdeploy/linuxdeploy/wiki/Plugin-system#apprun-hooks

The simplest and most foolproof option is to create a wrapper script to do the extra export (eg. in build-kmymoney.sh). Upstream has yet another approach: https://github.com/probonopd/linuxdeployqt/wiki/Custom-wrapper-script-instead-of-AppRun
Comment 20 Jack 2019-10-09 18:15:35 UTC
I now see the CSV and OFX importers, but I don't see GNC or QIF.  Running from command line, I do see 'No such XML file "/tmp/.mount_KMyMonm4MCFC/usr/bin/../share/kxmlgui5/csvexporter/qifimporter.rc".'    Does that look like the right place for it to be looking?  I don't know if the problem is more places to include files, or some other config issue.  I do see /tmp/.mount_KMyMonm4MCFC/usr/bin/../share/kxmlgui5/qifimpoter/qifimporter.rc but I do not see any gncimporter.rc.
Comment 21 Thomas Baumgart 2019-10-09 19:24:08 UTC
It may be missing. I'll check.
Comment 22 Thomas Baumgart 2019-10-09 20:15:21 UTC
A gncimporter.rc file does not exist. You import a GNC file by using 'File/Open...' and select the GNC file.