Support a stateless configuration by default
authorIkey Doherty <michael.i.doherty@intel.com>
Sat, 12 Mar 2016 16:43:16 +0000 (16:43 +0000)
committerMike Gorse <mgorse@suse.com>
Mon, 14 Mar 2016 21:59:30 +0000 (16:59 -0500)
Using a stateless configuration, we ship sensible defaults in our vendor-config
file to live in the /usr/share/ filesystem, which is considered to be provided
by the vendor, and to all intents and purposes, read-only.

With this change we can fall-back to the vendor system configuration to
always do the right thing, in the absence of a local system administrator
configuration file in the /etc/ tree.

Notably, this saves users from the potential risks and pitfalls of so called
"three way merges" on upgrades, and offers the immediate benefit that one
can perform a factory reset of the software, simply by removing the relevant
file in /etc/.

This change also resolves a memory leak in the launch code, where a string
allocation was entirely unnecessary.

Signed-off-by: Ikey Doherty <michael.i.doherty@intel.com>
bus/Makefile.am
bus/at-spi-bus-launcher.c

index d9664ab..b189e02 100644 (file)
@@ -1,11 +1,12 @@
 CLEANFILES=
 
-busconfigdir = $(sysconfdir)/at-spi2
+busconfigdir = $(datadir)/defaults/at-spi2
 busconfig_DATA = accessibility.conf
 
 libexec_PROGRAMS = at-spi-bus-launcher
 at_spi_bus_launcher_SOURCES = at-spi-bus-launcher.c
 at_spi_bus_launcher_CPPFLAGS = -DSYSCONFDIR=\"$(sysconfdir)\" \
+                               -DDATADIR=\"$(datadir)\" \
                                -DDBUS_DAEMON=\"$(DBUS_DAEMON)\"
 at_spi_bus_launcher_CFLAGS = $(GIO_CFLAGS)
 at_spi_bus_launcher_LDADD = $(GIO_LIBS) $(X_LIBS)
index c445be8..7ea8283 100644 (file)
@@ -272,11 +272,17 @@ ensure_a11y_bus (A11yBusLauncher *app)
   char *argv[] = { DBUS_DAEMON, NULL, "--nofork", "--print-address", "3", NULL };
   char addr_buf[2048];
   GError *error = NULL;
+  const char *config_path = NULL;
 
   if (app->a11y_bus_pid != 0)
     return FALSE;
-  
-  argv[1] = g_strdup_printf ("--config-file=%s/at-spi2/accessibility.conf", SYSCONFDIR);
+
+  if (g_file_test (SYSCONFDIR"/at-spi2/accessibility.conf", G_FILE_TEST_EXISTS))
+      config_path = "--config-file="SYSCONFDIR"/at-spi2/accessibility.conf";
+  else
+      config_path = "--config-file="DATADIR"/defaults/at-spi2/accessibility.conf";
+
+  argv[1] = config_path;
 
   if (pipe (app->pipefd) < 0)
     g_error ("Failed to create pipe: %s", strerror (errno));