Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backintime 1.1.8 crashes on startup if it is executed as user #473

Closed
ronisbr opened this issue Oct 19, 2015 · 9 comments
Closed

Backintime 1.1.8 crashes on startup if it is executed as user #473

ronisbr opened this issue Oct 19, 2015 · 9 comments
Milestone

Comments

@ronisbr
Copy link

ronisbr commented Oct 19, 2015

Hi guys!
When I try to run backintime 1.1.8 as user, it crashes with the following message:

backintime
Traceback (most recent call last):
  File "/usr/share/backintime/common/backintime.py", line 23, in <module>
    import config
  File "/usr/share/backintime/common/config.py", line 31, in <module>
    import configfile
  File "/usr/share/backintime/common/configfile.py", line 19, in <module>
    import logger
  File "/usr/share/backintime/common/logger.py", line 23, in <module>
    import tools
  File "/usr/share/backintime/common/tools.py", line 1173, in <module>
    logger.warning('import keyring failed')
AttributeError: 'module' object has no attribute 'warning'

Notice that it works if backintime is executed as root. Everything was fine with version 1.1.6.

I tracked the problem and it turns out that what is causing this issue is the line 18 of configfile.py:

import logger

The cause is: when I run backintime as user, then keyring = None in tools.py. This trigger the following code:

if keyring is None and keyring_warn:                                             
    logger.warning('import keyring failed')

that outputs the aforementioned error. Otherwise, if I run as root, then keyring != None and that code will not be executed.

As a temporary fix, I notice that if I add import tools before import logger in configfile.py, then everything works.

Can anyone tell me if this is the proper fix for the problem?

Regards,
Ronan

@Germar Germar added this to the 1.1.10 milestone Oct 19, 2015
@Germar Germar added the bug label Oct 19, 2015
@Germar
Copy link
Member

Germar commented Oct 19, 2015

Thanks Ronan! This is caused by adding debug messages in configfile.py. I'll rather switch import configfile and import tools lines in config.py than adding import tools to configfile.py. But the effect it the same. 👍

@catalin-hritcu
Copy link

This still looks like a race condition to me. Even with the patches here, I still get that warning every so often:

[hritcu@detained ~]$ backintime&
[3] 30806
[hritcu@detained ~]$ 
Back In Time
Version: 1.1.8

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime --license' for details.

WARNING: import keyring failed

[3]  + done       backintime
[hritcu@detained ~]$ backintime 

Back In Time
Version: 1.1.8

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime --license' for details.

[hritcu@detained ~]$ backintime

Back In Time
Version: 1.1.8

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime --license' for details.

@Germar
Copy link
Member

Germar commented Dec 13, 2015

@catalin-hritcu Please use this patch with:

sudo patch /usr/share/backintime/common/tools.py < keyring_debug.patch

and post the output if the warning appear again

@catalin-hritcu
Copy link

I'm trying it now and will report back. Please note though, that this prints something for me even when there is no warning:

module 'gi' has no attribute 'require_version'

Is this expected behavior?

@catalin-hritcu
Copy link

Note that this output goes away if I install the python-gobject package on Arch. Is that an official dependency? If so, the AUR package does not mention it: https://aur.archlinux.org/pkgbase/backintime/

[Added:] Apparently python-gobject is only an optional dependency of python-keyring (https://www.archlinux.org/packages/community/any/python-keyring/), so if backintime needs it, it needs to be made an explicit dependency.

@catalin-hritcu
Copy link

I've tried starting backintime at least 100 times and since installing python-gobject I never got

WARNING: import keyring failed

Not sure whether the two are in any way correlated though ...

@Germar
Copy link
Member

Germar commented Dec 13, 2015

Absolutly. That was the source for the warning.

But since we only serve one backintime package for all DE's this can't be a hard dependency in BackInTime on AUR. Gnome users would need python-gobject and KDE users need kdebindings-python.

There is python-secretstorage which will work for both Gnome and KDE. Could you please test if the warning still pops up if you deinstall python-gobject and install python-secretstorage instead?

@catalin-hritcu
Copy link

I still get module 'gi' has no attribute 'require_version' with python-secretstorage (without python-gobject). I also sometimes still get the warning:

[hritcu@detained ~]$ backintime-qt4 
module 'gi' has no attribute 'require_version'
WARNING: import keyring failed

Back In Time
Version: 1.1.8

Back In Time comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; type `backintime --license' for details.

ERROR: /run/media/hritcu/MyBook/BackInTime/backintime/detained/hritcu/1 does not exist

@Germar
Copy link
Member

Germar commented Dec 13, 2015

I just had a look at python-keyring. In keyring-5.7.1/keyring/backends/Gnome.py line 5 it calls gi.require_version('GnomeKeyring', '1.0') which will fail with AttributeError exception if python-gobject package is not installed (gi is part of that package). The AttributeError exception is not handled by python-keyring.

So, if you don't have python-gobject installed, why does import gi work? This should already raise an ImportError exception. Most probably you have a different version of gi already installed through some other package!?

There are two ways to fix this:

  1. python-keyring could handle AttributeError in Gnome.py line 7
  2. correct version of gi needs to be in a separate package (apart from python-gobject) and be a hard dependency of python-keyring

tl;dr I'd call this a bug of python-keyring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants