Merge lp:~ted/ubuntu-app-launch/install-root into lp:ubuntu-app-launch

Proposed by Ted Gould
Status: Merged
Approved by: Ted Gould
Approved revision: 328
Merged at revision: 282
Proposed branch: lp:~ted/ubuntu-app-launch/install-root
Merge into: lp:ubuntu-app-launch
Prerequisite: lp:~ted/ubuntu-app-launch/jobs-systemd
Diff against target: 869 lines (+598/-20)
21 files modified
CMakeLists.txt (+25/-0)
debian/ubuntu-app-launch.install (+1/-0)
docs/index.rst (+50/-0)
libubuntu-app-launch/application-impl-legacy.cpp (+23/-8)
libubuntu-app-launch/application-impl-snap.cpp (+3/-1)
libubuntu-app-launch/jobs-systemd.cpp (+48/-3)
libubuntu-app-launch/registry-impl.cpp (+11/-0)
libubuntu-app-launch/registry-impl.h (+8/-0)
libubuntu-app-launch/ubuntu-app-launch.cpp (+5/-1)
snappy-xmir-envvars.c (+112/-0)
snappy-xmir.c (+212/-0)
tests/CMakeLists.txt (+5/-0)
tests/snappy-xmir-test-check.sh (+32/-0)
tests/snappy-xmir-test-helper-long.sh (+12/-0)
tests/snappy-xmir-test-helper.sh (+12/-0)
tests/snappy-xmir-test-libertine-launch.sh (+5/-0)
tests/snappy-xmir-test.sh.in (+30/-0)
upstart-jobs/application-click.conf.in (+0/-1)
upstart-jobs/application-snap.conf.in (+0/-1)
upstart-jobs/untrusted-helper.conf.in (+0/-1)
xmir-helper.c (+4/-4)
To merge this branch: bzr merge lp:~ted/ubuntu-app-launch/install-root
Reviewer Review Type Date Requested Status
Charles Kerr (community) Approve
unity-api-1-bot continuous-integration Needs Fixing
dobey Pending
Ted Gould Pending
Marcus Tomlinson Pending
Review via email: mp+316036@code.launchpad.net

Commit message

Adjust UAL for working inside a snap

Description of the change

This branch is various changes that make it so that UAL works well inside the Unity8 Session Snap.

The majority of the changes are basically adjustments to the environment variables and other tweaks to the various calls to look for the SNAP environment variable and change how UAL behaves in those cases. There are also some cases where variables have been removed as they were determined to not be needed when testing in the unity8-session snap.

A bigger change that exists in this branch is the addition of the snappy helpers for setting up xmir. This works a little bit different in that it gives a small utility to the XMir setup functions that then sends the environment over a socket to the helper. This allows us to go in and out of the snap confinement for X11. These utilities are written in conservative low-level C to ensure they'll work on ubuntu-core with a minimal set of libraries.

To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Resubmitted this with a better description of what the branch actually does today.

Revision history for this message
Ted Gould (ted) wrote :

Resubmitted this with a better description of what the branch actually does today.

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

PASSED: Continuous integration, rev:316
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/192/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build/1575
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1582
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1360
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1360/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1360
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1360/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1360
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1360/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1360
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1360/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1360
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1360/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1360
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1360/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/192/rebuild

review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Mostly looks good. A handful of little tweaks + one more serious issue w/easy fix. Comments inline.

review: Needs Fixing
Revision history for this message
Ted Gould (ted) :
317. By Ted Gould

Fix docs to include default path for LEGACY_EXEC

318. By Ted Gould

Cache snap env var

319. By Ted Gould

Make sure we only use references in loops

320. By Ted Gould

Don't store if we have the variable

321. By Ted Gould

Return const pointer

322. By Ted Gould

Handle larger possible pids

323. By Ted Gould

Make sure we're gettin' data

324. By Ted Gould

Move debug outside of the print loop

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:324
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/193/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/1576/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1583
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1361
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1361/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1361
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1361/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1361/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1361
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1361/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1361
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1361/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1361
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1361/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/193/rebuild

review: Needs Fixing (continuous-integration)
325. By Ted Gould

A read failure is a helper failure

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :

FAILED: Continuous integration, rev:325
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/196/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build/1583/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-0-fetch/1590
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1368
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1368/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=amd64,release=zesty/1368/console
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1368
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1368/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1368
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=armhf,release=zesty/1368/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1368
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=xenial+overlay/1368/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1368
        deb: https://jenkins.canonical.com/unity-api-1/job/build-2-binpkg/arch=i386,release=zesty/1368/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/unity-api-1/job/lp-ubuntu-app-launch-ci/196/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

Approving these changes, feel free to top-approve when Jenkins is happy or if the Jenkins failure is a red herring

review: Approve
326. By Ted Gould

If we don't have a MIR_SOCKET use the default one

327. By Ted Gould

Special case legacy apps on Unity8 from debs

328. By Ted Gould

Put on the dunce cap and sit in the corner

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2017-01-23 21:32:16 +0000
+++ CMakeLists.txt 2017-02-02 15:08:16 +0000
@@ -111,6 +111,7 @@
111set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")111set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
112112
113add_definitions( -DXMIR_HELPER="${pkglibexecdir}/xmir-helper" )113add_definitions( -DXMIR_HELPER="${pkglibexecdir}/xmir-helper" )
114add_definitions( -DSNAPPY_XMIR="${CMAKE_INSTALL_FULL_BINDIR}/snappy-xmir" )
114115
115####################116####################
116# Helpers117# Helpers
@@ -210,6 +211,30 @@
210install(TARGETS socket-demangler-helper RUNTIME DESTINATION "${pkglibexecdir}")211install(TARGETS socket-demangler-helper RUNTIME DESTINATION "${pkglibexecdir}")
211212
212####################213####################
214# snappy-xmir
215####################
216
217####################
218# NOTE: This only can link to libraries that are in
219# the base UBUNTU CORE image. Which is basically libc
220# and not much else. Don't add libs.
221####################
222
223add_executable(snappy-xmir snappy-xmir.c)
224set_target_properties(snappy-xmir PROPERTIES OUTPUT_NAME "snappy-xmir")
225install(TARGETS snappy-xmir RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
226
227####################
228# snappy-xmir-envvars
229####################
230
231add_executable(snappy-xmir-envvars snappy-xmir-envvars.c)
232set_target_properties(snappy-xmir-envvars PROPERTIES OUTPUT_NAME "snappy-xmir-envvars")
233# No libs, otherwise we have to worry about how to handle finding them
234install(TARGETS snappy-xmir-envvars RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}")
235
236
237####################
213# ubuntu-app-launch-desktop.click-hook238# ubuntu-app-launch-desktop.click-hook
214####################239####################
215240
216241
=== modified file 'debian/ubuntu-app-launch.install'
--- debian/ubuntu-app-launch.install 2014-04-30 15:14:26 +0000
+++ debian/ubuntu-app-launch.install 2017-02-02 15:08:16 +0000
@@ -1,2 +1,3 @@
1usr/share/upstart/sessions/*1usr/share/upstart/sessions/*
2usr/lib/*/ubuntu-app-launch/*2usr/lib/*/ubuntu-app-launch/*
3usr/bin/snappy-xmir*
34
=== modified file 'docs/index.rst'
--- docs/index.rst 2016-09-30 20:46:07 +0000
+++ docs/index.rst 2017-02-02 15:08:16 +0000
@@ -18,6 +18,56 @@
1818
19.. _Upstart: http://upstart.ubuntu.com/19.. _Upstart: http://upstart.ubuntu.com/
2020
21
22Environment Variables
23=====================
24
25There are a few environment variables that can effect the behavior of UAL while
26it is running.
27
28UBUNTU_APP_LAUNCH_CG_MANAGER_NAME
29 The DBus name that CG Manager registers under if it is on the session bus.
30
31UBUNTU_APP_LAUNCH_CG_MANAGER_SESSION_BUS
32 Tell UAL to look on the session bus for CG Manager.
33
34UBUNTU_APP_LAUNCH_DEMANGLER
35 Path to the UAL demangler tool that will get the Mir FD for trusted prompt session.
36
37UBUNTU_APP_LAUNCH_DISABLE_SNAPD_TIMEOUT
38 Wait as long as Snapd wants to return data instead of erroring after 100ms.
39
40UBUNTU_APP_LAUNCH_LEGACY_ROOT
41 Set the path that represents the root for legacy applications.
42
43UBUNTU_APP_LAUNCH_LIBERTINE_LAUNCH
44 Path to the libertine launch utility for setting up libertine containers and XMir based legacy apps.
45
46UBUNTU_APP_LAUNCH_LINK_FARM
47 Path to the link farm that is created by Click of all the installed Click applications.
48
49UBUNTU_APP_LAUNCH_OOM_HELPER
50 Path to the setuid helper that configures OOM values on application processes that we otherwise couldn't, mostly this is for Oxide.
51
52UBUNTU_APP_LAUNCH_OOM_PROC_PATH
53 Path to look for the files to set OOM values, defaults to `/proc`.
54
55UBUNTU_APP_LAUNCH_SNAP_BASEDIR
56 The place where snaps are installed in the system, `/snap` is the default.
57
58UBUNTU_APP_LAUNCH_SNAP_LEGACY_EXEC
59 A snappy command that is used to launch legacy applications in the current snap, to ensure the environment gets configured correctly, defaults to `/snap/bin/unity8-session.legacy-exec`
60
61UBUNTU_APP_LAUNCH_SNAPD_SOCKET
62 Path to the snapd socket.
63
64UBUNTU_APP_LAUNCH_XMIR_HELPER
65 Tool that helps to start XMir and sets the DISPLAY variable for applications
66
67UBUNTU_APP_LAUNCH_XMIR_PATH
68 Specifies the location of the XMir binary to use
69
70
21API Documentation71API Documentation
22=================72=================
2373
2474
=== modified file 'libubuntu-app-launch/application-impl-legacy.cpp'
--- libubuntu-app-launch/application-impl-legacy.cpp 2017-02-02 15:08:16 +0000
+++ libubuntu-app-launch/application-impl-legacy.cpp 2017-02-02 15:08:16 +0000
@@ -299,7 +299,25 @@
299 info();299 info();
300300
301 retval.emplace_back(std::make_pair("APP_XMIR_ENABLE", appinfo_->xMirEnable().value() ? "1" : "0"));301 retval.emplace_back(std::make_pair("APP_XMIR_ENABLE", appinfo_->xMirEnable().value() ? "1" : "0"));
302 if (appinfo_->xMirEnable())302 auto execline = appinfo_->execLine().value();
303
304 auto snappath = getenv("SNAP");
305 if (snappath != nullptr)
306 {
307 /* This means we're inside a snap, and if we're in a snap then
308 the legacy application is in a snap. We need to try and set
309 up the proper environment for that app */
310 retval.emplace_back(std::make_pair("SNAP", snappath));
311
312 const char* legacyexec = getenv("UBUNTU_APP_LAUNCH_SNAP_LEGACY_EXEC");
313 if (legacyexec == nullptr)
314 {
315 legacyexec = "/snap/bin/unity8-session.legacy-exec";
316 }
317
318 execline = std::string{legacyexec} + " " + execline;
319 }
320 else if (appinfo_->xMirEnable().value())
303 {321 {
304 /* If we're setting up XMir we also need the other helpers322 /* If we're setting up XMir we also need the other helpers
305 that libertine is helping with */323 that libertine is helping with */
@@ -309,13 +327,10 @@
309 libertine_launch = LIBERTINE_LAUNCH;327 libertine_launch = LIBERTINE_LAUNCH;
310 }328 }
311329
312 retval.emplace_back(330 execline = std::string{libertine_launch} + " " + execline;
313 std::make_pair("APP_EXEC", std::string(libertine_launch) + " " + appinfo_->execLine().value()));331 }
314 }332
315 else333 retval.emplace_back(std::make_pair("APP_EXEC", execline));
316 {
317 retval.emplace_back(std::make_pair("APP_EXEC", appinfo_->execLine().value()));
318 }
319334
320 /* Honor the 'Path' key if it is in the desktop file */335 /* Honor the 'Path' key if it is in the desktop file */
321 if (g_key_file_has_key(_keyfile.get(), "Desktop Entry", "Path", nullptr))336 if (g_key_file_has_key(_keyfile.get(), "Desktop Entry", "Path", nullptr))
322337
=== modified file 'libubuntu-app-launch/application-impl-snap.cpp'
--- libubuntu-app-launch/application-impl-snap.cpp 2017-02-02 15:08:16 +0000
+++ libubuntu-app-launch/application-impl-snap.cpp 2017-02-02 15:08:16 +0000
@@ -441,7 +441,7 @@
441 std::list<std::pair<std::string, std::string>> retval;441 std::list<std::pair<std::string, std::string>> retval;
442442
443 retval.emplace_back(std::make_pair("APP_XMIR_ENABLE", info_->xMirEnable().value() ? "1" : "0"));443 retval.emplace_back(std::make_pair("APP_XMIR_ENABLE", info_->xMirEnable().value() ? "1" : "0"));
444 if (info_->xMirEnable())444 if (info_->xMirEnable() && getenv("SNAP") == nullptr)
445 {445 {
446 /* If we're setting up XMir we also need the other helpers446 /* If we're setting up XMir we also need the other helpers
447 that libertine is helping with */447 that libertine is helping with */
@@ -456,6 +456,8 @@
456 }456 }
457 else457 else
458 {458 {
459 /* If we're in a snap the libertine helpers are setup by
460 the snap stuff */
459 retval.emplace_back(std::make_pair("APP_EXEC", info_->execLine().value()));461 retval.emplace_back(std::make_pair("APP_EXEC", info_->execLine().value()));
460 }462 }
461463
462464
=== modified file 'libubuntu-app-launch/jobs-systemd.cpp'
--- libubuntu-app-launch/jobs-systemd.cpp 2017-02-02 15:08:16 +0000
+++ libubuntu-app-launch/jobs-systemd.cpp 2017-02-02 15:08:16 +0000
@@ -441,7 +441,28 @@
441 if (findEnv("APP_XMIR_ENABLE", env) == "1" && getenv("DISPLAY") == nullptr)441 if (findEnv("APP_XMIR_ENABLE", env) == "1" && getenv("DISPLAY") == nullptr)
442 {442 {
443 retval.emplace(retval.begin(), findEnv("APP_ID", env));443 retval.emplace(retval.begin(), findEnv("APP_ID", env));
444 retval.emplace(retval.begin(), XMIR_HELPER);444
445 auto snapenv = getenv("SNAP");
446 if (snapenv == nullptr)
447 {
448 auto xmirenv = getenv("UBUNTU_APP_LAUNCH_XMIR_HELPER");
449 if (xmirenv == nullptr)
450 {
451 retval.emplace(retval.begin(), XMIR_HELPER);
452 }
453 else
454 {
455 retval.emplace(retval.begin(), xmirenv);
456 }
457 }
458 else
459 {
460 /* If we're in a snap we need to use the utility which
461 gets us back into the snap */
462 std::string snappath{snapenv};
463
464 retval.emplace(retval.begin(), snappath + SNAPPY_XMIR);
465 }
445 }466 }
446467
447 /* See if we're doing apparmor by hand */468 /* See if we're doing apparmor by hand */
@@ -588,11 +609,35 @@
588 env.emplace_back(std::make_pair("APP_LAUNCHER_PID", std::to_string(getpid()))); /* Who we are, for bugs */609 env.emplace_back(std::make_pair("APP_LAUNCHER_PID", std::to_string(getpid()))); /* Who we are, for bugs */
589610
590 copyEnv("DISPLAY", env);611 copyEnv("DISPLAY", env);
591 for (const auto prefix : {"DBUS_", "MIR_", "QT_", "UBUNTU_", "UNITY_", "XDG_"})612
613 for (const auto& prefix : {"DBUS_", "MIR_", "UBUNTU_APP_LAUNCH_"})
592 {614 {
593 copyEnvByPrefix(prefix, env);615 copyEnvByPrefix(prefix, env);
594 }616 }
595617
618 /* If we're in deb mode and launching legacy apps, they're gonna need
619 * more context, they really have no other way to get it. */
620 if (g_getenv("SNAP") == nullptr && appId.package.value().empty())
621 {
622 copyEnvByPrefix("QT_", env);
623 copyEnvByPrefix("XDG_", env);
624 copyEnv("UBUNTU_APP_LAUNCH_XMIR_PATH", env);
625
626 /* If we're in Unity8 we don't want to pass it's platform, we want
627 * an application platform. */
628 if (findEnv("QT_QPA_PLATFORM", env) == "mirserver")
629 {
630 removeEnv("QT_QPA_PLATFORM", env);
631 env.emplace_back(std::make_pair("QT_QPA_PLATFORM", "ubuntumirclient"));
632 }
633 }
634
635 /* Mir socket if we don't have one in our env */
636 if (findEnv("MIR_SOCKET", env).empty())
637 {
638 env.emplace_back(std::make_pair("MIR_SOCKET", g_get_user_runtime_dir() + std::string{"/mir_socket"}));
639 }
640
596 if (!urls.empty())641 if (!urls.empty())
597 {642 {
598 auto accumfunc = [](const std::string& prev, Application::URL thisurl) -> std::string {643 auto accumfunc = [](const std::string& prev, Application::URL thisurl) -> std::string {
@@ -702,7 +747,7 @@
702 }747 }
703748
704 /* Clean up env before shipping it */749 /* Clean up env before shipping it */
705 for (const auto rmenv :750 for (const auto& rmenv :
706 {"APP_XMIR_ENABLE", "APP_DIR", "APP_URIS", "APP_EXEC", "APP_EXEC_POLICY", "APP_LAUNCHER_PID",751 {"APP_XMIR_ENABLE", "APP_DIR", "APP_URIS", "APP_EXEC", "APP_EXEC_POLICY", "APP_LAUNCHER_PID",
707 "INSTANCE_ID", "MIR_SERVER_PLATFORM_PATH", "MIR_SERVER_PROMPT_FILE", "MIR_SERVER_HOST_SOCKET",752 "INSTANCE_ID", "MIR_SERVER_PLATFORM_PATH", "MIR_SERVER_PROMPT_FILE", "MIR_SERVER_HOST_SOCKET",
708 "UBUNTU_APP_LAUNCH_DEMANGLER", "UBUNTU_APP_LAUNCH_OOM_HELPER", "UBUNTU_APP_LAUNCH_LEGACY_ROOT",753 "UBUNTU_APP_LAUNCH_DEMANGLER", "UBUNTU_APP_LAUNCH_OOM_HELPER", "UBUNTU_APP_LAUNCH_LEGACY_ROOT",
709754
=== modified file 'libubuntu-app-launch/registry-impl.cpp'
--- libubuntu-app-launch/registry-impl.cpp 2017-02-02 15:08:16 +0000
+++ libubuntu-app-launch/registry-impl.cpp 2017-02-02 15:08:16 +0000
@@ -48,6 +48,17 @@
48 return std::shared_ptr<GDBusConnection>(g_bus_get_sync(G_BUS_TYPE_SESSION, cancel.get(), nullptr),48 return std::shared_ptr<GDBusConnection>(g_bus_get_sync(G_BUS_TYPE_SESSION, cancel.get(), nullptr),
49 [](GDBusConnection* bus) { g_clear_object(&bus); });49 [](GDBusConnection* bus) { g_clear_object(&bus); });
50 });50 });
51
52 /* Determine where we're getting the helper from */
53 auto goomHelper = g_getenv("UBUNTU_APP_LAUNCH_OOM_HELPER");
54 if (goomHelper != nullptr)
55 {
56 oomHelper_ = goomHelper;
57 }
58 else
59 {
60 oomHelper_ = OOM_HELPER;
61 }
51}62}
5263
53void Registry::Impl::initClick()64void Registry::Impl::initClick()
5465
=== modified file 'libubuntu-app-launch/registry-impl.h'
--- libubuntu-app-launch/registry-impl.h 2017-01-11 22:38:42 +0000
+++ libubuntu-app-launch/registry-impl.h 2017-02-02 15:08:16 +0000
@@ -84,6 +84,11 @@
84 static void watchingAppStarting(bool rWatching);84 static void watchingAppStarting(bool rWatching);
85 static bool isWatchingAppStarting();85 static bool isWatchingAppStarting();
8686
87 const std::string& oomHelper() const
88 {
89 return oomHelper_;
90 }
91
87private:92private:
88 Registry* _registry; /**< The Registry that we're spawned from */93 Registry* _registry; /**< The Registry that we're spawned from */
8994
@@ -98,6 +103,9 @@
98 /** All of our icon finders based on the path that they're looking103 /** All of our icon finders based on the path that they're looking
99 into */104 into */
100 std::unordered_map<std::string, std::shared_ptr<IconFinder>> _iconFinders;105 std::unordered_map<std::string, std::shared_ptr<IconFinder>> _iconFinders;
106
107 /** Path to the OOM Helper */
108 std::string oomHelper_;
101};109};
102110
103} // namespace app_launch111} // namespace app_launch
104112
=== modified file 'libubuntu-app-launch/ubuntu-app-launch.cpp'
--- libubuntu-app-launch/ubuntu-app-launch.cpp 2017-01-23 22:43:47 +0000
+++ libubuntu-app-launch/ubuntu-app-launch.cpp 2017-02-02 15:08:16 +0000
@@ -1608,7 +1608,11 @@
1608 /* The exec value */1608 /* The exec value */
1609 gchar * envstr = NULL;1609 gchar * envstr = NULL;
1610 if (demangler) {1610 if (demangler) {
1611 envstr = g_strdup_printf("APP_EXEC=%s %s", DEMANGLER_PATH, execline);1611 const gchar * demangler_path = g_getenv("UBUNTU_APP_LAUNCH_DEMANGLER");
1612 if (demangler_path == nullptr) {
1613 demangler_path = DEMANGLER_PATH;
1614 }
1615 envstr = g_strdup_printf("APP_EXEC=%s %s", demangler_path, execline);
1612 } else {1616 } else {
1613 envstr = g_strdup_printf("APP_EXEC=%s", execline);1617 envstr = g_strdup_printf("APP_EXEC=%s", execline);
1614 }1618 }
16151619
=== added file 'snappy-xmir-envvars.c'
--- snappy-xmir-envvars.c 1970-01-01 00:00:00 +0000
+++ snappy-xmir-envvars.c 2017-02-02 15:08:16 +0000
@@ -0,0 +1,112 @@
1/*
2 * Copyright © 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Ted Gould <ted.gould@canonical.com>
18 */
19
20#define _POSIX_C_SOURCE 200212L
21
22#include <unistd.h>
23#include <stdio.h>
24#include <stdlib.h>
25#include <sys/types.h>
26#include <sys/socket.h>
27#include <sys/un.h>
28#include <sys/wait.h>
29#include <signal.h>
30#include <string.h>
31
32void
33copyenv (int fd, const char * envname, const char * envval)
34{
35 if (envval == NULL) {
36 fprintf(stderr, "Unable to get environment variable '%s'\n", envname);
37 exit(EXIT_FAILURE);
38 }
39
40 int writesize;
41
42 writesize = write(fd, envname, strlen(envname) + 1);
43
44 if (writesize <= 0) {
45 fprintf(stderr, "Unable to write to socket '%s'\n", envname);
46 exit(EXIT_FAILURE);
47 }
48
49 writesize = write(fd, envval, strlen(envval) + 1);
50
51 if (writesize <= 0) {
52 fprintf(stderr, "Unable to write to socket '%s'\n", envval);
53 exit(EXIT_FAILURE);
54 }
55
56 if (getenv("G_MESSAGES_DEBUG") != NULL)
57 printf("Wrote envvar '%s=%s'\n", envname, envval);
58}
59
60void
61termhandler (int sig)
62{
63 exit(EXIT_SUCCESS);
64}
65
66int
67main (int argc, char * argv[])
68{
69 /* Grab socket */
70 if (argc != 2) {
71 fprintf(stderr, "Usage: %s <socket name>\n", argv[0]);
72 return(EXIT_FAILURE);
73 }
74
75 char * socketname = argv[1];
76
77 int socketfd = socket(AF_UNIX, SOCK_STREAM, 0);
78 if (socketfd <= 0) {
79 fprintf(stderr, "%s: Unable to create socket\n", argv[0]);
80 return EXIT_FAILURE;
81 }
82
83 struct sockaddr_un socketaddr = {0};
84 socketaddr.sun_family = AF_UNIX;
85 strncpy(socketaddr.sun_path, socketname, sizeof(socketaddr.sun_path) - 1);
86 socketaddr.sun_path[0] = 0;
87
88 if (connect(socketfd, (const struct sockaddr *)&socketaddr, sizeof(struct sockaddr_un)) < 0) {
89 fprintf(stderr, "Unable to connect socket\n");
90 return EXIT_FAILURE;
91 }
92
93 /* Dump envvars to socket */
94 copyenv(socketfd, "DISPLAY", getenv("DISPLAY"));
95 copyenv(socketfd, "DBUS_SESSION_BUS_ADDRESS", getenv("DBUS_SESSION_BUS_ADDRESS"));
96
97 char mypid[16];
98 snprintf(mypid, 16, "%ld", (long)getpid());
99 copyenv(socketfd, "UBUNTU_APP_LAUNCH_SNAPPY_XMIR_ENVVARS_PID", mypid);
100
101 /* Close the socket */
102 close(socketfd);
103
104 /* Wait for sigterm */
105 signal(SIGTERM, termhandler);
106
107 for (;;) {
108 sleep(24 * 60 * 60); // taking things one day at a time
109 }
110
111 return EXIT_FAILURE;
112}
0113
=== added file 'snappy-xmir.c'
--- snappy-xmir.c 1970-01-01 00:00:00 +0000
+++ snappy-xmir.c 2017-02-02 15:08:16 +0000
@@ -0,0 +1,212 @@
1/*
2 * Copyright © 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Ted Gould <ted.gould@canonical.com>
18 */
19
20#define _POSIX_C_SOURCE 200212L
21
22#include <errno.h>
23#include <unistd.h>
24#include <stdio.h>
25#include <stdlib.h>
26#include <sys/types.h>
27#include <sys/socket.h>
28#include <sys/un.h>
29#include <signal.h>
30#include <string.h>
31#include <fcntl.h>
32#include <time.h>
33
34#define ENVVAR_SIZE 4096
35#define SOCKETNAME_SIZE 256
36#define ENVNAME_SIZE 64
37
38void
39sigchild_handler (int signal)
40{
41 fprintf(stderr, "XMir has closed unexpectedly\n");
42 exit(EXIT_FAILURE);
43}
44
45struct sigaction sigchild_action = {
46 .sa_handler = sigchild_handler,
47 .sa_flags = SA_NOCLDWAIT
48};
49
50int
51main (int argc, char * argv[])
52{
53 if (argc < 3) {
54 fprintf(stderr, "%s: Usage: [appid] [command to execute...]\n", argv[0]);
55 return EXIT_FAILURE;
56 }
57
58 char * appid = argv[1];
59
60 /* Build Socket Name */
61 srand(time(NULL));
62 char socketname[SOCKETNAME_SIZE] = {0};
63 snprintf(socketname, sizeof(socketname), "/ual-socket-%08X-%s", rand(), appid);
64
65 /* Setup abstract socket */
66 int socketfd = socket(AF_UNIX, SOCK_STREAM, 0);
67 if (socketfd <= 0) {
68 fprintf(stderr, "%s: Unable to create socket\n", argv[0]);
69 return EXIT_FAILURE;
70 }
71
72 struct sockaddr_un socketaddr = {0};
73 socketaddr.sun_family = AF_UNIX;
74 strncpy(socketaddr.sun_path, socketname, sizeof(socketaddr.sun_path) - 1);
75 socketaddr.sun_path[0] = 0;
76
77 if (bind(socketfd, (const struct sockaddr *)&socketaddr, sizeof(struct sockaddr_un)) < 0) {
78 fprintf(stderr, "%s: Unable to bind socket '%s'\n", argv[0], socketname);
79 return EXIT_FAILURE;
80 }
81
82 /* Fork and exec the x11 setup under it's confiment */
83 if (sigaction(SIGCHLD, &sigchild_action, NULL) != 0) {
84 fprintf(stderr, "Unable to setup child signal handler\n");
85 return EXIT_FAILURE;
86 }
87
88 if (fork() == 0) {
89 /* XMir start here */
90 /* GOAL: /snap/bin/unity8-session.xmir-helper $appid libertine-launch /snap/unity8-session/current/usr/bin/snappy-xmir-envvars socketname */
91
92 char * snappyhelper = getenv("UBUNTU_APP_LAUNCH_SNAPPY_XMIR_HELPER");
93 if (snappyhelper == NULL) {
94 snappyhelper = "xmir-helper";
95 }
96
97 char * libertinelaunch = getenv("UBUNTU_APP_LAUNCH_LIBERTINE_LAUNCH");
98 if (libertinelaunch == NULL) {
99 libertinelaunch = "libertine-launch";
100 }
101
102 /* envvar is like us, but a little more */
103 char envvars[256] = {0};
104 snprintf(envvars, sizeof(envvars), "%s-envvars", argv[0]);
105
106 char * xmirexec[6] = {
107 snappyhelper,
108 appid,
109 libertinelaunch,
110 envvars,
111 socketname,
112 NULL
113 };
114
115 printf("Executing xmir-helper on PID: %d\n", getpid());
116
117 fflush(stdout);
118
119 return execv(xmirexec[0], xmirexec);
120 }
121
122 listen(socketfd, 1); /* 1 is the number of people who can connect */
123 int readsocket = accept(socketfd, NULL, NULL);
124
125 if (getenv("G_MESSAGES_DEBUG") != NULL) {
126 printf("Got a socket connection on: %s\n", socketname);
127 }
128
129 /* Read our socket until we get all of the environment */
130 char readbuf[ENVVAR_SIZE] = {0};
131 int amountread = 0;
132 int thisread = 0;
133 while ((thisread = read(readsocket, readbuf + amountread, ENVVAR_SIZE - amountread)) > 0) {
134 amountread += thisread;
135
136 if (amountread == ENVVAR_SIZE) {
137 fprintf(stderr, "Environment is too large, abort!\n");
138 exit(EXIT_FAILURE);
139 }
140 }
141
142 if (thisread < 0) {
143 fprintf(stderr, "Error reading environment variables from Xmir utilities: %s", strerror(errno));
144 exit(EXIT_FAILURE);
145 }
146
147 close(readsocket);
148 close(socketfd);
149
150 /* Parse the environment into variables we can insert */
151 if (amountread > 0) {
152 char * startvar = readbuf;
153 int debug = (getenv("G_MESSAGES_DEBUG") != NULL);
154
155 do {
156 char * startval = startvar + strlen(startvar) + 1;
157 setenv(startvar, startval, 1);
158
159 if (debug) {
160 printf("Got env: %s=%s\n", startvar, startval);
161 }
162
163 startvar = startval + strlen(startval) + 1;
164 }
165 while (startvar < readbuf + amountread);
166 }
167
168 /* Clear MIR_* variables from the environment */
169 /* Unfortunately calling unsetenv resets the environ array so
170 it can become invalid. So we need to start over, though this
171 is fast */
172 int unset = 1;
173 while (unset) {
174 unset = 0;
175
176 unsigned int i;
177 for (i = 0; __environ[i] != NULL; i++) {
178 const char * env = __environ[i];
179 /* Not checking the length becasue imagining that block
180 size will always be larger than 4 bytes on 32-bit systems.
181 Compiler should fold this into one comparison. */
182 if (env[0] == 'M' && env[1] == 'I' && env[2] == 'R' && env[3] == '_') {
183 char envname[ENVNAME_SIZE] = {0};
184 unset = 1;
185
186 strncpy(envname, env, ENVNAME_SIZE - 1);
187 unsigned int j;
188 for (j = 0; j < ENVNAME_SIZE && envname[j] != '\0'; j++) {
189 if (envname[j] == '=') {
190 envname[j] = '\0';
191
192 if (unsetenv(envname) != 0) {
193 /* Shouldn't happen unless we're out of memory,
194 might as well bail now if that's the case. */
195 fprintf(stderr, "Unable to unset '%s' environment variable\n", envname);
196 exit(EXIT_FAILURE);
197 }
198
199 break;
200 }
201 }
202
203 break;
204 }
205 }
206 }
207
208 fflush(stdout);
209
210 /* Exec the application with the new environment under its confinement */
211 return execv(argv[2], &(argv[2]));
212}
0213
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2017-02-02 15:08:16 +0000
+++ tests/CMakeLists.txt 2017-02-02 15:08:16 +0000
@@ -165,6 +165,11 @@
165configure_file ("xmir-helper-test.in" "${CMAKE_CURRENT_BINARY_DIR}/xmir-helper-test" @ONLY)165configure_file ("xmir-helper-test.in" "${CMAKE_CURRENT_BINARY_DIR}/xmir-helper-test" @ONLY)
166add_test (xmir-helper-test xmir-helper-test)166add_test (xmir-helper-test xmir-helper-test)
167167
168# Snappy XMir Wrapper Test
169
170configure_file("snappy-xmir-test.sh.in" "${CMAKE_CURRENT_BINARY_DIR}/snappy-xmir-test.sh" @ONLY)
171add_test (NAME snappy-xmir-test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/snappy-xmir-test.sh)
172
168# Formatted code173# Formatted code
169174
170add_custom_target(format-tests175add_custom_target(format-tests
171176
=== added file 'tests/snappy-xmir-test-check.sh'
--- tests/snappy-xmir-test-check.sh 1970-01-01 00:00:00 +0000
+++ tests/snappy-xmir-test-check.sh 2017-02-02 15:08:16 +0000
@@ -0,0 +1,32 @@
1#!/bin/bash
2
3set -ex
4
5if [ -z ${DISPLAY} ] ; then
6 echo DISPLAY is not set
7 exit 1
8fi
9
10if [ ${DISPLAY} != "foo" ] ; then
11 echo DISPLAY is not set to 'foo'
12 exit 1
13fi
14
15if [ -z ${DBUS_SESSION_BUS_ADDRESS} ] ; then
16 echo DBUS_SESSION_BUS_ADDRESS is not set
17 exit 1
18fi
19
20if [ ${DBUS_SESSION_BUS_ADDRESS} != "bar" ] ; then
21 echo DBUS_SESSION_BUS_ADDRESS is not set to 'bar'
22 exit 1
23fi
24
25if [ ! -z ${MIR_SOCKET} ] ; then
26 echo Mir variables are leaking in
27 exit 1
28fi
29
30if [ ! -z ${UBUNTU_APP_LAUNCH_SNAPPY_XMIR_ENVVARS_PID} ] ; then
31 kill -TERM ${UBUNTU_APP_LAUNCH_SNAPPY_XMIR_ENVVARS_PID}
32fi
033
=== added file 'tests/snappy-xmir-test-helper-long.sh'
--- tests/snappy-xmir-test-helper-long.sh 1970-01-01 00:00:00 +0000
+++ tests/snappy-xmir-test-helper-long.sh 2017-02-02 15:08:16 +0000
@@ -0,0 +1,12 @@
1#!/bin/bash
2
3set -ex
4
5if [ $1 != "this-is-a-really-really-really_long_appid-that-we-shouldnt-reallyhave_13523432324235.234.234.234234+foo" ] ; then
6 exit 1
7fi
8
9export DISPLAY=foo
10export DBUS_SESSION_BUS_ADDRESS=bar
11
12exec $2 $3 $4 $5
013
=== added file 'tests/snappy-xmir-test-helper.sh'
--- tests/snappy-xmir-test-helper.sh 1970-01-01 00:00:00 +0000
+++ tests/snappy-xmir-test-helper.sh 2017-02-02 15:08:16 +0000
@@ -0,0 +1,12 @@
1#!/bin/bash
2
3set -ex
4
5if [ $1 != "appid" ] ; then
6 exit 1
7fi
8
9export DISPLAY=foo
10export DBUS_SESSION_BUS_ADDRESS=bar
11
12exec $2 $3 $4 $5
013
=== added file 'tests/snappy-xmir-test-libertine-launch.sh'
--- tests/snappy-xmir-test-libertine-launch.sh 1970-01-01 00:00:00 +0000
+++ tests/snappy-xmir-test-libertine-launch.sh 2017-02-02 15:08:16 +0000
@@ -0,0 +1,5 @@
1#!/bin/bash
2
3set -ex
4
5exec $@
06
=== added file 'tests/snappy-xmir-test.sh.in'
--- tests/snappy-xmir-test.sh.in 1970-01-01 00:00:00 +0000
+++ tests/snappy-xmir-test.sh.in 2017-02-02 15:08:16 +0000
@@ -0,0 +1,30 @@
1#!/bin/bash
2
3set -ex
4
5# Unset MIR_SOCKET as we might be in an environment it exists in
6
7export MIR_SOCKET=
8
9# Test the test harness
10
11@CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-helper.sh appid @CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-check.sh
12
13# Test our pass through
14
15export UBUNTU_APP_LAUNCH_SNAPPY_XMIR_HELPER="@CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-helper.sh"
16export UBUNTU_APP_LAUNCH_LIBERTINE_LAUNCH="@CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-libertine-launch.sh"
17
18@CMAKE_BINARY_DIR@/snappy-xmir appid @CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-check.sh
19
20# Add a Mir variable to make sure it gets cleared
21
22export MIR_SOCKET="/this/is/a/socket"
23
24@CMAKE_BINARY_DIR@/snappy-xmir appid @CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-check.sh
25
26# This is a long appid test
27
28export UBUNTU_APP_LAUNCH_SNAPPY_XMIR_HELPER="@CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-helper-long.sh"
29
30@CMAKE_BINARY_DIR@/snappy-xmir "this-is-a-really-really-really_long_appid-that-we-shouldnt-reallyhave_13523432324235.234.234.234234+foo" @CMAKE_CURRENT_SOURCE_DIR@/snappy-xmir-test-check.sh
031
=== modified file 'upstart-jobs/application-click.conf.in'
--- upstart-jobs/application-click.conf.in 2015-08-17 21:34:39 +0000
+++ upstart-jobs/application-click.conf.in 2017-02-02 15:08:16 +0000
@@ -14,7 +14,6 @@
14env APP_XMIR_ENABLE14env APP_XMIR_ENABLE
1515
16env UBUNTU_APP_LAUNCH_ARCH="@ubuntu_app_launch_arch@"16env UBUNTU_APP_LAUNCH_ARCH="@ubuntu_app_launch_arch@"
17export UBUNTU_APP_LAUNCH_ARCH
1817
19apparmor switch ${APP_ID}18apparmor switch ${APP_ID}
20cgroup freezer19cgroup freezer
2120
=== modified file 'upstart-jobs/application-snap.conf.in'
--- upstart-jobs/application-snap.conf.in 2016-09-08 15:05:06 +0000
+++ upstart-jobs/application-snap.conf.in 2017-02-02 15:08:16 +0000
@@ -15,7 +15,6 @@
15env INSTANCE_ID=""15env INSTANCE_ID=""
1616
17env UBUNTU_APP_LAUNCH_ARCH="@ubuntu_app_launch_arch@"17env UBUNTU_APP_LAUNCH_ARCH="@ubuntu_app_launch_arch@"
18export UBUNTU_APP_LAUNCH_ARCH
1918
20# apparmor is taken care of by confine19# apparmor is taken care of by confine
21cgroup freezer20cgroup freezer
2221
=== modified file 'upstart-jobs/untrusted-helper.conf.in'
--- upstart-jobs/untrusted-helper.conf.in 2014-08-07 16:16:05 +0000
+++ upstart-jobs/untrusted-helper.conf.in 2017-02-02 15:08:16 +0000
@@ -12,7 +12,6 @@
12env APP_URIS12env APP_URIS
1313
14env UBUNTU_APP_LAUNCH_ARCH="@ubuntu_app_launch_arch@"14env UBUNTU_APP_LAUNCH_ARCH="@ubuntu_app_launch_arch@"
15export UBUNTU_APP_LAUNCH_ARCH
1615
17apparmor switch ${APP_ID}16apparmor switch ${APP_ID}
18cgroup freezer17cgroup freezer
1918
=== modified file 'xmir-helper.c'
--- xmir-helper.c 2017-02-02 15:08:16 +0000
+++ xmir-helper.c 2017-02-02 15:08:16 +0000
@@ -30,7 +30,7 @@
30sigchild_handler (int signal)30sigchild_handler (int signal)
31{31{
32 fprintf(stderr, "XMir has closed unexpectedly\n");32 fprintf(stderr, "XMir has closed unexpectedly\n");
33 exit(1);33 exit(EXIT_FAILURE);
34}34}
3535
36struct sigaction sigchild_action = {36struct sigaction sigchild_action = {
@@ -43,7 +43,7 @@
43{43{
44 if (argc < 3) {44 if (argc < 3) {
45 fprintf(stderr, "xmir-helper needs more arguments: xmir-helper $(appid) $(thing to exec) ... \n");45 fprintf(stderr, "xmir-helper needs more arguments: xmir-helper $(appid) $(thing to exec) ... \n");
46 return 1;46 return EXIT_FAILURE;
47 }47 }
4848
49 /* Make nice variables for the things we need */49 /* Make nice variables for the things we need */
@@ -57,7 +57,7 @@
57 int sockets[2];57 int sockets[2];
58 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets) != 0) {58 if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockets) != 0) {
59 fprintf(stderr, "Unable to create socketpair for communicating with XMir\n");59 fprintf(stderr, "Unable to create socketpair for communicating with XMir\n");
60 return 1;60 return EXIT_FAILURE;
61 }61 }
6262
63 /* Give them nice names, the compiler will optimize out */63 /* Give them nice names, the compiler will optimize out */
@@ -67,7 +67,7 @@
67 /* Watch for the child dying */67 /* Watch for the child dying */
68 if (sigaction(SIGCHLD, &sigchild_action, NULL) != 0) {68 if (sigaction(SIGCHLD, &sigchild_action, NULL) != 0) {
69 fprintf(stderr, "Unable to setup child signal handler\n");69 fprintf(stderr, "Unable to setup child signal handler\n");
70 return 1;70 return EXIT_FAILURE;
71 }71 }
7272
73 /* Start XMir */73 /* Start XMir */

Subscribers

People subscribed via source and target branches