Bug 1473917 - Terminator may crash on 32bit systems due to invalid dbus-interface name
Terminator may crash on 32bit systems due to invalid dbus-interface name
Status: NEW
Product: Fedora
Classification: Fedora
Component: terminator (Show other bugs)
i686 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Dominic Hopf
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2017-07-22 07:49 EDT by Andreas Bleischwitz
Modified: 2018-05-07 09:35 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Fix to avoid output of hash() to be negative value (707 bytes, patch)
2017-07-22 07:49 EDT, Andreas Bleischwitz
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1705816 None None None 2017-07-22 07:49 EDT

  None (edit)
Description Andreas Bleischwitz 2017-07-22 07:49:02 EDT
Created attachment 1302724 [details]
Fix to avoid output of hash() to be negative value

Description of problem:
When starting terminator under a 32bit system it may crash due to an invalid dbus-interface name which is combined from a base and a hex-hash of the display. If the hash has a negative value, the hyphen is included in the name which is invalid. The hash value has to be a positive value at any time, which hash() does not ensure.

Version-Release number of selected component (if applicable):

How reproducible:
Install 'terminator' on a 32bit system, open a terminal and invoke 'terminator'. Depending on the hash() of your display-session you may be able to start terminator or it fails with a complaint about an invalid DBus interface name.

Steps to Reproduce:
1. on Fedora-26.i686, install terminator-1.91-2.fc26.noarch
2. wayland-session, start 'termininator' from console
3. 'terminator' may or may not crash - in relation to the value of Gdk.get_display().partition('.')[0]

Actual results:
Terminator does crash on start

Expected results:
Terminator does not crash

Additional info:
Comment 1 Andreas Bleischwitz 2017-07-22 08:00:35 EDT
Output from terminator when hash() returns negative value:

Traceback (most recent call last):
  File "/usr/bin/terminator", line 83, in <module>
    from terminatorlib import ipc
  File "/usr/lib/python2.7/site-packages/terminatorlib/ipc.py", line 30, in <module>
    class DBusService(Borg, dbus.service.Object):
  File "/usr/lib/python2.7/site-packages/terminatorlib/ipc.py", line 61, in DBusService
    @dbus.service.method(BUS_NAME, in_signature='a{ss}')
  File "/usr/lib/python2.7/site-packages/dbus/decorators.py", line 155, in method
ValueError: Invalid interface or error name 'net.tenshu.Terminator2-0x21012a2c': contains invalid character '-'

Checking line 61:
     61     @dbus.service.method(BUS_NAME, in_signature='a{ss}')
     62     def new_window_cmdline(self, options=dbus.Dictionary()):

Fixed value of in_signature and variable BUS_NAME.

Checking line 30:
     30 class DBusService(Borg, dbus.service.Object):
     31     """DBus Server class. This is implemented as a Borg"""

This is the instanciation of the DBus service.

Checking the origin of BUS_NAME:

     22 BUS_BASE = 'net.tenshu.Terminator2'
     23 BUS_PATH = '/net/tenshu/Terminator2'
     24 try:
     25     # Try and include the X11 display name in the dbus bus name
     26     DISPLAY  = hex(c_size_t(hash(Gdk.get_display().partition('.')[0])).value)
     27     BUS_NAME = '%s%s' % (BUS_BASE, DISPLAY)
     28 except:
     29     BUS_NAME = BUS_BASE

BUS_NAME is build from BUS_BASE (fixed) and DISPLAY - hex() of hash().
As DISPLAY is negative, and hex() does not introduce such negation, hash() is creating negative values.
Comment 2 Fedora End Of Life 2018-05-03 04:39:48 EDT
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 3 Andreas Bleischwitz 2018-05-07 09:34:56 EDT
Same issue on Fedora 27 as well.

Note You need to log in before you can comment on or make changes to this bug.