crash regression causing invalid dbus interface name

Bug #1793629 reported by Andrew Meadows
36
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Terminator
New
Undecided
Unassigned

Bug Description

Bug 1267195 was fixed with revision 1734 in the GTK3 branch. This caused a regression when the .replace('-','_') method call was removed.

In terminatorlib/ipc.py, line 26, the effected code changed from:
    DISPLAY = hex(hash(Gdk.get_display())).replace('-', '_')
to:
    DISPLAY = hex(hash(Gdk.get_display().partition('.')[0]))

Python's built-in hash function returns a signed integer. The built-in hex function returns a signed hex value, not a hex representation of the unsigned value. D-Bus does not allow the '-' character in bus names. This means that half of the possible hash values for the display name will now cause terminator to crash on startup with a D-Bus error.

When ipc.py line 26 is changed to:
DISPLAY = hex(hash(Gdk.get_display().partition('.')[0])).replace('-', '_')

it appears to fix the original bug without causing the regression.

Related branches

Revision history for this message
Andrew Meadows (andasm) wrote :
Andrew Meadows (andasm)
summary: - regression causing invalid dbus interface name
+ crash regression causing invalid dbus interface name
description: updated
tags: added: crash
tags: added: regression
Revision history for this message
Fabrizio Lungo (flungo) wrote :

There are multiple duplicates and various suggested patches both on here and other forums but I can't see that any have been accepted. There are large ranges of values which can be returned by `Gdk.get_display().partition('.')[0]` which results in negative hash values, the most common probably being all display values between `:1000` and `:9999`, particularly on systems which might be configured to start display numbers at 1000 or 1001.

I can't see that the proposed patch would cause any problems and corrects a regression so what's required to get Andrew's patch accepted and released?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.