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: 2017-07-22 08:00 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 avout 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 avout 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.

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