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

Git Cola crash on repo open #991

Closed
akontsevich opened this issue Sep 11, 2019 · 13 comments
Closed

Git Cola crash on repo open #991

akontsevich opened this issue Sep 11, 2019 · 13 comments

Comments

@akontsevich
Copy link

git-cola starts fine, however when try to open any repo crash happen:

> git-cola
Traceback (most recent call last):
  File "/usr/bin/git-cola", line 54, in <module>
    sys.exit(main())
  File "/usr/share/git-cola/lib/cola/main.py", line 27, in main
    return args.func(args)
  File "/usr/share/git-cola/lib/cola/main.py", line 299, in cmd_cola
    view = MainView(context, settings=args.settings)
  File "/usr/share/git-cola/lib/cola/widgets/main.py", line 143, in __init__
    editor = commitmsg.CommitMessageEditor(context, self)
  File "/usr/share/git-cola/lib/cola/widgets/commitmsg.py", line 104, in __init__
    icon=icons.configure(), tooltip=N_('Actions...'))
  File "/usr/share/git-cola/lib/cola/icons.py", line 177, in configure
    return from_theme('configure', fallback='gear.svg')
  File "/usr/share/git-cola/lib/cola/decorators.py", line 32, in _decorated
    return caller(func, *args, **opts)
  File "/usr/share/git-cola/lib/cola/decorators.py", line 51, in _memoize
    key = (args, frozenset(list(opts.items())))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)

Started recently in openSUSE Tumbleweed, previously worked fine. How to fix?

@davvid davvid closed this as completed in 0e6c2ab Sep 11, 2019
@davvid
Copy link
Member

davvid commented Sep 11, 2019

Please test the latest in master (which has a workaround for this). I would recommend using python3 for openSUSE (simplest is to tweak the #! lines in the bin/ scripts in the repo to say python3 temporarily until openSUSE updates their packaging).

I'll be tagging a new release this weekend. The openSUSE maintainers should probably pickup that version as soon as it's released, and they can prepare for it by switching their packaging to use python3 and python3-qt5 and it should resolve this issue.

@akontsevich
Copy link
Author

Thanks! Will do.

@akontsevich
Copy link
Author

@davvid any news about new release?

@davvid
Copy link
Member

davvid commented Sep 21, 2019

v3.5 has been tagged and released.

@akontsevich
Copy link
Author

akontsevich commented Sep 21, 2019

Thanks! Will ask Suse maintainers to update:
https://bugzilla.opensuse.org/show_bug.cgi?id=1151540

@mbajor
Copy link

mbajor commented Sep 23, 2019

@akontsevich Latest stable version has been submitted to review.
You can check the build from this repo before review and update of openSUSE repositories.
https://build.opensuse.org/package/show/devel:tools:scm/git-cola

@akontsevich
Copy link
Author

@mbajor still crashes:

> git-cola
Traceback (most recent call last):
  File "/usr/bin/git-cola", line 54, in <module>
    sys.exit(main())
  File "/usr/share/git-cola/lib/cola/main.py", line 28, in main
    return args.func(args)
  File "/usr/share/git-cola/lib/cola/main.py", line 300, in cmd_cola
    view = MainView(context, settings=args.settings)
  File "/usr/share/git-cola/lib/cola/widgets/main.py", line 404, in __init__
    setEnabled=lambda x: self.rebase_start_action.setEnabled(not x))
  File "/usr/share/git-cola/lib/cola/utils.py", line 303, in __init__
    for k, v in overrides.items():
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-7: ordinal not in range(128)

Do You use #!/bin/python3 as suggested above?

@mbajor
Copy link

mbajor commented Sep 23, 2019

@akontsevich I do not use python3. Git Cola declares compatibility with Python 2.6 and above, and 3.
@davvid Should I force to use python3 on openSUSE distros?
Anyway, when I'm trying to build with python3 I'm getting error in RPMLINT.

[ 9s] git-cola.noarch: E: env-script-interpreter (Badness: 9) /usr/share/git-cola/bin/git-xbase /usr/bin/env python
[ 9s] This script uses 'env' as an interpreter. For the rpm runtime dependency
[ 9s] detection to work, the shebang #!/usr/bin/env python needs to be patched into
[ 9s] #!/usr/bin/python otherwise the package dependency generator merely adds a
[ 9s] dependency on /usr/bin/env rather than the actual interpreter /usr/bin/python.
[ 9s] Alternatively, if the file should not be executed, then ensure that it is not
[ 9s] marked as executable or don't install it in a path that is reserved for
[ 9s] executables.

Build steps:

%makeinstall prefix=%{_prefix} DESTDIR=%{buildroot} PYTHON=python3
make install-man prefix=%{_prefix} DESTDIR=%{buildroot} PYTHON=python3

@mbajor
Copy link

mbajor commented Sep 23, 2019

@akontsevich
Copy link
Author

@mbajor thanks, this one works like a charm!

@mbajor
Copy link

mbajor commented Sep 23, 2019

@akontsevich Thanks for test. Submitting to the repository.

@davvid
Copy link
Member

davvid commented Sep 25, 2019

Thanks for updating to python3. Yes, while I still use 2.7 for most development on debian, the opensuse py2 PyQt5 modules don't seem to be working as well as the py3 ones, so we might as well go with those, which is what you've done. cheers

As you noted there's still one remaining concern. We have to patch the git-xbase script to use python3. The setup.py installer only does the #! munging for the bin/ scripts, but that script was always kept "hidden" and run internally to avoid polluting the global bin/ namespace.. alas, it causes friction when packaging. Hmm..

Doing something simple like:

  sed -i -e 's/env python$/python3/' %{buildroot}%{_datadir}/git-cola/bin/git-xbase

in the install step should do the trick.

Minor tweak -- dos2unix shouldn't be needed anymore.

I'm adding an official fix for the rebase editor into the build system but it won't be available until the next release at the earliest (unless you take cherry-pick the change into the src.rpm). A tweak in the spec might be simpler until then.

Thanks for the heads-up. I'll mention this issue in the commit so that you can pickup the patch if needed.

davvid added a commit that referenced this issue Sep 25, 2019
Add distutils commands to handle fixing up the #! lines for our private
share/git-cola/bin scripts (specifically, git-xbase).

This ensures that the #! lines are updated for git-xbase when building
with alternate pythons.  Previously, this script would retain the
original `env python`, which may not be the same python as was used
during installation.

Related-to: #991
Signed-off-by: David Aguilar <davvid@gmail.com>
@akontsevich
Copy link
Author

Began to crash on repo open again:

> git-cola
Traceback (most recent call last):
  File "/usr/share/git-cola/lib/cola/fsmonitor.py", line 198, in run
    self._inotify_fd = inotify.init()
  File "/usr/share/git-cola/lib/cola/inotify.py", line 44, in _errcheck
    raise OSError(err, os.strerror(err))
OSError: [Errno 24] Too many open files
Aborted (core dumped)

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