Bugzilla – Attachment 879 Details for
Bug 5950
many applications fail to start with new systemd (common dbus)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
dbus.patch (text/plain), 3.62 KB, created by
Pierre Ossman
on 2018-07-04 15:41:08 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Pierre Ossman
Created:
2018-07-04 15:41:08 CEST
Size:
3.62 KB
patch
obsolete
>Index: tlmisc/profiles/tl-run-profile >=================================================================== >--- tlmisc/profiles/tl-run-profile (revision 33476) >+++ tlmisc/profiles/tl-run-profile (working copy) >@@ -1,7 +1,7 @@ > #!/usr/bin/env python-thinlinc > # -*- mode: python; coding: utf-8 -*- > # >-# Copyright 2014 Cendio AB. >+# Copyright 2014-2018 Cendio AB. > # For more information, see http://www.cendio.com > > import sys >@@ -8,6 +8,7 @@ > import os > import pipes > import re >+import subprocess > > # Add modules dirs. FIXME: Use relative paths. > sys.path = ["/opt/thinlinc/modules"] + sys.path >@@ -33,6 +34,48 @@ > escaped_argv.append(pipes.quote(arg)) > return " ".join(escaped_argv) > >+def update_dbus_environ(environ): >+ if which.which("dbus-update-activation-environment") is None: >+ return >+ >+ print 'Updating D-Bus and systemd environment...' >+ >+ # We need to modify it, so get a local copy >+ environ = environ.copy() >+ >+ # These are session specific and shouldn't be pushed to a common >+ # daemon (only XDG_SESSION_ID is generally set in ThinLinc) >+ for name in ["XDG_SEAT", "XDG_SESSION_ID", "XDG_VTNR"]: >+ if name in environ: >+ del environ[name] >+ >+ # systemd is really fussy about environment variables so we need to >+ # filter out anything that might upset it >+ for name in environ.keys(): >+ try: >+ name.decode("UTF-8") >+ environ[name].decode("UTF-8") >+ except UnicodeDecodeError: >+ print "Ignoring invalid environment variable: %r" % (name + "=" + environ[name]) >+ del environ[name] >+ continue >+ >+ # (regexps taken from gnome-session) >+ if not re.match("^[a-zA-Z_][a-zA-Z0-9_]*$", name) or \ >+ not re.match("^([ \t\r\n\v\f]|[^\x00-\x1F\x7F])*$", environ[name]): >+ print "Ignoring invalid environment variable: %r" % (name + "=" + environ[name]) >+ del environ[name] >+ continue >+ >+ sys.stdout.flush() >+ >+ p = subprocess.Popen(["dbus-update-activation-environment", >+ "--systemd", "--all"], >+ env=environ) >+ p.wait() >+ if p.returncode != 0: >+ print >>sys.stderr, "tl-run-profile: Failed to update D-Bus and systemd environment" >+ > if __name__ == "__main__": > if len(sys.argv) != 1: > print >>sys.stderr, "Usage:" >@@ -46,6 +89,7 @@ > if not os.getenv("TLCOMMAND").strip(): > print >>sys.stderr, "tl-run-profile: Ignoring existing but empty TLCOMMAND." > else: >+ update_dbus_environ(os.environ) > print "Executing start program command: %s" % os.environ["TLCOMMAND"] > sys.stdout.flush() > try: >@@ -152,6 +196,8 @@ > > break > >+ update_dbus_environ(environ) >+ > if (cmdline is not None) and (cmdline != ""): > # Explicit command line > print 'Executing profile command: %s' % cmdline >Index: tlmisc/scripts/tl-dbus-launch.sh >=================================================================== >--- tlmisc/scripts/tl-dbus-launch.sh (revision 33476) >+++ tlmisc/scripts/tl-dbus-launch.sh (working copy) >@@ -9,5 +9,13 @@ > > # Start DBUS, if not already started > if type dbus-launch > /dev/null 2>&1 && test -z "${DBUS_SESSION_BUS_ADDRESS}" ; then >+ echo "Starting new session D-Bus server..." > eval `dbus-launch --sh-syntax --exit-with-session` >+else >+ echo "Existing session D-Bus server found" > fi >+ >+if type dbus-update-activation-environment > /dev/null 2>&1 ; then >+ echo "Setting initial D-Bus and systemd environment..." >+ dbus-update-activation-environment --systemd DISPLAY XAUTHORITY >+fi
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 5950
:
876
| 879