0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Older bugs which are supposed to be fixed in 0.84. *** Please try to reproduce your bug and confirm the bug fix. ***

Moderators: XnTriq, helmut, xnview, Dreamer

Post Reply
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by pangwolin »

XnViewMP 0.85 x64
Linux x64

The default.keys seems to be read and loaded by xnviewmp, but my custom shortcuts don't do anything since I updated to this new 0.85 version.
In strace I used to see:

Code: Select all

open("/home/user/.config/xnviewmp/default.keys", O_RDONLY|O_CLOEXEC) = 10
This file is never loaded anymore it seems. Even though it's pointed at by the xnview.ini
All I see instead is these sometimes (not on program first load)

Code: Select all

open("/opt/xnviewmpdefault.bar", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
open("/opt/xnviewmpdefault.keys", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 EACCES (Permission denied)
These files don't even exist, and they would be owned by the root account anyway, hence permission denied.

As a side note my customized toolbar doesn't seem to be loaded anymore, and I don't see default.bar being read at all?
I do see this in strace

Code: Select all

open("/opt/xnviewmpdefault.bar", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/opt/xnviewmpdefault.keys", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/opt/xnviewmpdefault.bar", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
This file never existed. There's a missing "slash" too. I do have default.bar in ~/.config/xnviewmp/default.bar.

Changing these shortcuts in xnviewmp doesn't work, the keys are saved in configuration (did the location of the file holding these change or something?) but pressing them don't do anything!
Did something change in the latest version that lead to these shortcuts breaking?
Last edited by pangwolin on Fri Apr 21, 2017 2:28 pm, edited 4 times in total.
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

Re: 0.85 Linux - custom keyboard shortcuts don't work anymore

Post by pangwolin »

Oh wow. I think I found the problem.

Copying the default.keys to /opt/ did lead to the file being read, and the shortcuts work again!
Same for the bar, it's not restored as well:

Code: Select all

sudo cp ~/.config/xnviewmp/default.keys /opt/xnviewmpdefault.keys
sudo cp ~/.config/xnviewmp/default.bar /opt/xnviewmpdefault.bar 
That's not how it's supposed to work!

There's still a lingering issue: some shortcuts are conflicting with existing (default) ones. Changing them doesn't work either. It's like there's two config files loaded at once, and the default one takes priority over the custom ones. Very broken.

For example: in view mode I want "zoom to 100%" to be "SHIFT+D", however this is already set for "Draw". I unset it, then set my custom, but it still doesn't work. The default one * doesn't work either since it's now unset. I have to reset XnViewMP for the modifications to take effect. A bit strange and could related to this config file path issue.


I suspect that since xnview is trying to read from /opt/ it gets blocked by the OS, and then doesn't scrape the other possible locations for the config files? Not sure. (oh how I wish XnViewMP would be open source!)

Hopefully this will be an easy fix.
But his is still not loading the files in ~/.config/ though. It shouldn't be looking in /opt/ :(
User avatar
xnview
Author of XnView
Posts: 43328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 0.85 Linux - custom keyboard shortcuts don't work anymore

Post by xnview »

i can't reproduce, the .config/default.keys is readed correctly. Do you have installed the .deb?
Pierre.
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by pangwolin »

No, I'm using the tgz file from there http://download.xnview.com/XnViewMP-linux-x64.tgz

I manually extract to /opt/xnviewmp

It was reading the file correctly in 0.84, since 0.85, it's not looking in .config anymore.

The .ini files are properly read from the .config directory though! It's very odd that when it's falling back to the /opt/ dir, it's missing that extra slash "/".

Edit: I would like to point out that this other file is being looked by xnviewmp on startup of which the path is wrong too:

Code: Select all

stat("/opt/xnviewmpXnView.db", 0x7ffd2f38e990) = -1 ENOENT (No such file or directory)
open("/opt/xnviewmpXnView.db", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = -1 EACCES (Permission denied)
open("/opt/xnviewmpXnView.db", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
All the other files in /opt/xnviewmp/ are found properly.
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by pangwolin »

Ok, I fixed it by replacing the following key values in the xnviewmp.ini file.
These were the ones I had previously:

Code: Select all

shortcut=default.keys
toolbar=default.bar
I replaced them with these and it works now:

Code: Select all

shortcut=/home/user/.config/xnviewmp/default.keys
toolbar=/home/user/.config/xnviewmp/default.bar
User avatar
xnview
Author of XnView
Posts: 43328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by xnview »

It will need to be checked in next 0.87
Pierre.
User avatar
xnview
Author of XnView
Posts: 43328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by xnview »

This problem is supposed to be fixed in XnView MP 0.87. Please check and confirm the bug fix here.
Pierre.
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by pangwolin »

Sorry for the very late reply, I didn't receive any notification.

I tested in 0.87, and the problem remains the same.
Although, specifying the full path to the default.keys and default.bar in the xnview.ini file as mentioned above is still a valid workaround.

From xnview.ini:

Code: Select all

shortcut=default.keys
toolbar=default.bar
From strace:

Code: Select all

openat(AT_FDCWD, "/opt/xnviewmpdefault.keys", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/opt/xnviewmpdefault.bar", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
vvvvvvvvvvvvvvvvvvvvvv
From tweaked xnview.ini:

Code: Select all

shortcut=/home/user/.config/xnviewmp/default.keys
shortcut=/home/user/.config/xnviewmp/default.bar
From strace after tweaked xnview.ini:

Code: Select all

openat(AT_FDCWD, "/home/user/.config/xnviewmp/default.keys", O_RDONLY|O_CLOEXEC) = 8
openat(AT_FDCWD, "/home/user/.config/xnviewmp/default.bar", O_RDONLY|O_CLOEXEC) = 8
----------------------------------

Interesting to notice, Corax the package maintainer for Arch Linux isn't affected by this bug, however his path is different, as his config files are in his /home/corax/.xnviewmp compared to my /home/user/.config/xnviewmp
Weird, I don't have this issue. With the default keys in xnview.ini (shortcut=default.keys, toolbar=default.bar), xnviewmp reads the right files:
open("/home/corax/.xnviewmp/default.keys", O_RDONLY|O_CLOEXEC) = 11
open("/home/corax/.xnviewmp/default.bar", O_RDONLY|O_CLOEXEC) = 11
User avatar
xnview
Author of XnView
Posts: 43328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by xnview »

right i can reproduce if SettingsPaths is 'application folder'
Pierre.
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by pangwolin »

Thank you for resolving this. Ref. https://www.xnview.com/mantisbt/view.php?id=1317

I'll chime back next version to confirm.

Side note: Is there a particular line in the xnview.ini that specify what option xnview is using regarding the config paths?
I couldn't find one that does a difference.

Code: Select all

[DB]
basePath=
Changing this don't seem to do much?
User avatar
xnview
Author of XnView
Posts: 43328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by xnview »

This problem is supposed to be fixed in XnView MP 0.88. Please check and confirm the bug fix here.
Pierre.
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by pangwolin »

Early testing but it seems to work fine now. Thank you very much! :)
:bugfixed:

Still couldn't figure out which parameter sets the chosen setting during the first xnview startup (when xnview.ini is missing).
Not a big deal, just wanted to fix my .ini manually. ;)


Image
User avatar
xnview
Author of XnView
Posts: 43328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by xnview »

pangwolin wrote: Still couldn't figure out which parameter sets the chosen setting during the first xnview startup (when xnview.ini is missing).
Not a big deal, just wanted to fix my .ini manually. ;)
What's the problem?? 'User' is not good as default?
Pierre.
User avatar
pangwolin
Posts: 60
Joined: Sun Sep 25, 2016 7:53 pm

Re: 0.85 Linux: config file path discovery is now messed up -> broken custom keyboard shortcuts!

Post by pangwolin »

Oh no, it's perfect don't worry. :)

I was just curious to know what value is set in the .ini file when selecting one or the other option, that's all (if it's actually set in the .ini and not somewhere else).

Sorry for the confusion.
Post Reply