summaryrefslogtreecommitdiffstats
path: root/remoting/tools
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 22:23:40 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 22:23:40 +0000
commit3cd0756d48b8a6c910c1e041ebf1605ef777851c (patch)
tree74bc27a8808573fd2fe580a3dd0ffab9e50a34a0 /remoting/tools
parent92246b881bf0c319e3cdd2e8c3940ae954f0030b (diff)
downloadchromium_src-3cd0756d48b8a6c910c1e041ebf1605ef777851c.zip
chromium_src-3cd0756d48b8a6c910c1e041ebf1605ef777851c.tar.gz
chromium_src-3cd0756d48b8a6c910c1e041ebf1605ef777851c.tar.bz2
Improve xsession execution
When running a custom xsession (such as ~/.xsession), execute it with /bin/sh -c, which copes better with scripts that have the executable permission set, but don't have a she-bang line, for example. BUG=167409 TEST=Verify with ~/.xsession executable but no she-bang. Also verify with default unity-2d session on Precise. NOTRY=true Review URL: https://chromiumcodereview.appspot.com/11715003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175212 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rwxr-xr-xremoting/tools/me2me_virtual_host.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py
index 841599a..e0d7205 100755
--- a/remoting/tools/me2me_virtual_host.py
+++ b/remoting/tools/me2me_virtual_host.py
@@ -17,6 +17,7 @@ import json
import logging
import optparse
import os
+import pipes
import signal
import socket
import subprocess
@@ -349,7 +350,7 @@ class Desktop:
devnull.close()
def _launch_x_session(self):
- # Start desktop session
+ # Start desktop session.
# The /dev/null input redirection is necessary to prevent the X session
# reading from stdin. If this code runs as a shell background job in a
# terminal, any reading from stdin causes the job to be suspended.
@@ -498,7 +499,10 @@ def choose_x_session():
# (see /etc/X11/Xsession.d/50x11-common_determine-startup), to determine
# exactly how to run this file.
if os.access(startup_file, os.X_OK):
- return startup_file
+ # "/bin/sh -c" is smart about how to execute the session script and
+ # works in cases where plain exec() fails (for example, if the file is
+ # marked executable, but is a plain script with no shebang line).
+ return ["/bin/sh", "-c", pipes.quote(startup_file)]
else:
shell = os.environ.get("SHELL", "sh")
return [shell, startup_file]