Merge lp:~ricmm/platform-api/no-abort-default-dummy into lp:platform-api

Proposed by Ricardo Mendoza on 2015-03-06
Status: Merged
Approved by: Ricardo Salveti on 2015-03-06
Approved revision: 294
Merged at revision: 294
Proposed branch: lp:~ricmm/platform-api/no-abort-default-dummy
Merge into: lp:platform-api
Diff against target: 133 lines (+40/-25)
6 files modified
CMakeLists.txt (+1/-1)
debian/changelog (+6/-0)
src/ubuntu/application/base_module.h (+30/-21)
src/ubuntu/application/desktop/module_version.h (+1/-1)
src/ubuntu/application/testbackend/module_version.h (+1/-1)
src/ubuntu/application/touch/module_version.h (+1/-1)
To merge this branch: bzr merge lp:~ricmm/platform-api/no-abort-default-dummy
Reviewer Review Type Date Requested Status
Ricardo Salveti 2015-03-06 Approve on 2015-03-06
PS Jenkins bot continuous-integration Approve on 2015-03-06
Review via email: mp+252108@code.launchpad.net

Commit Message

Dont abort on soft errors, instead fall back to dummy provider if possible.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-02-03 11:58:47 +0000
3+++ CMakeLists.txt 2015-03-06 13:05:06 +0000
4@@ -4,7 +4,7 @@
5
6 set(UBUNTU_PLATFORM_API_VERSION_MAJOR 2)
7 set(UBUNTU_PLATFORM_API_VERSION_MINOR 8)
8-set(UBUNTU_PLATFORM_API_VERSION_PATCH 0)
9+set(UBUNTU_PLATFORM_API_VERSION_PATCH 1)
10
11 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
12
13
14=== modified file 'debian/changelog'
15--- debian/changelog 2015-02-03 11:59:30 +0000
16+++ debian/changelog 2015-03-06 13:05:06 +0000
17@@ -1,3 +1,9 @@
18+platform-api (2.8.1) UNRELEASED; urgency=medium
19+
20+ * Stop aborting on soft errors, fallback to dummy provider instead.
21+
22+ -- Ricardo Mendoza <ricardo.mendoza@canonical.com> Fri, 06 Mar 2015 14:00:04 +0100
23+
24 platform-api (2.8.0+15.04.20150203-0ubuntu1) vivid; urgency=medium
25
26 [ Ricardo Mendoza ]
27
28=== modified file 'src/ubuntu/application/base_module.h'
29--- src/ubuntu/application/base_module.h 2015-02-03 11:58:47 +0000
30+++ src/ubuntu/application/base_module.h 2015-03-06 13:05:06 +0000
31@@ -29,7 +29,7 @@
32
33 #define API_VERSION_MAJOR "2"
34 #define API_VERSION_MINOR "8"
35-#define API_VERSION_PATCH "0"
36+#define API_VERSION_PATCH "1"
37 #define SO_SUFFIX ".so." API_VERSION_MAJOR "." API_VERSION_MINOR "." API_VERSION_PATCH
38
39 namespace internal
40@@ -51,28 +51,32 @@
41 if (cache == NULL) {
42 FILE *conf;
43 conf = fopen("/etc/ubuntu-platform-api/application.conf", "r");
44- if (conf == NULL) {
45- exit_module("Unable to find module configuration file");
46- } else {
47- if (fgets(module_name, 32, conf))
48+ if (conf != NULL) {
49+ if (fgets(module_name, 32, conf)) {
50 cache = module_name;
51+ // Null terminate module blob
52+ cache[strlen(cache)-1] = '\0';
53+ fclose(conf);
54+ }
55 else
56- exit_module("Error reading module name from file");
57+ fprintf(stderr, "Error reading module name from file.\n");
58 }
59- // Null terminate module blob
60- cache[strlen(cache)-1] = '\0';
61- fclose(conf);
62- }
63- if (cache == NULL)
64- exit_module("Unable to determine backend");
65+ }
66+ if (cache == NULL) {
67+ // No module available, use dummy.
68+ fprintf(stderr, "Unable to select module, using dummy.\n");
69+ strcpy(path, override_path());
70+ } else {
71+ strcpy(path, "libubuntu_application_api_");
72+
73+ if (strlen(cache) > MAX_MODULE_NAME)
74+ exit_module("Selected module is invalid");
75+
76+ strcat(path, cache);
77+ strcat(path, SO_SUFFIX);
78+ }
79
80- strcpy(path, "libubuntu_application_api_");
81-
82- if (strlen(cache) > MAX_MODULE_NAME)
83- exit_module("Selected module is invalid");
84-
85- strcat(path, cache);
86- strcat(path, SO_SUFFIX);
87+ fprintf(stderr, "Loading module: '%s'\n", path);
88 }
89
90 return path;
91@@ -100,8 +104,13 @@
92 static void* dlopen_fn(const char* path, int flags)
93 {
94 void *handle = dlopen(path, flags);
95- if (handle == NULL)
96- exit_module("Unable to load selected module.");
97+ if (handle == NULL) {
98+ fprintf(stderr, "Unable to load selected module, using dummy.\n");
99+ fprintf(stderr, "Loading module: '%s'\n", override_path());
100+ handle = dlopen(override_path(), flags);
101+ if (handle == NULL)
102+ exit_module("Dummy module failed to load.");
103+ }
104
105 return handle;
106 }
107
108=== modified file 'src/ubuntu/application/desktop/module_version.h'
109--- src/ubuntu/application/desktop/module_version.h 2015-02-03 11:58:47 +0000
110+++ src/ubuntu/application/desktop/module_version.h 2015-03-06 13:05:06 +0000
111@@ -1,3 +1,3 @@
112 #define MODULE_VERSION_MAJOR 2
113 #define MODULE_VERSION_MINOR 8
114-#define MODULE_VERSION_PATCH 0
115+#define MODULE_VERSION_PATCH 1
116
117=== modified file 'src/ubuntu/application/testbackend/module_version.h'
118--- src/ubuntu/application/testbackend/module_version.h 2015-02-03 11:58:47 +0000
119+++ src/ubuntu/application/testbackend/module_version.h 2015-03-06 13:05:06 +0000
120@@ -1,3 +1,3 @@
121 #define MODULE_VERSION_MAJOR 2
122 #define MODULE_VERSION_MINOR 8
123-#define MODULE_VERSION_PATCH 0
124+#define MODULE_VERSION_PATCH 1
125
126=== modified file 'src/ubuntu/application/touch/module_version.h'
127--- src/ubuntu/application/touch/module_version.h 2015-02-03 11:58:47 +0000
128+++ src/ubuntu/application/touch/module_version.h 2015-03-06 13:05:06 +0000
129@@ -1,3 +1,3 @@
130 #define MODULE_VERSION_MAJOR 2
131 #define MODULE_VERSION_MINOR 8
132-#define MODULE_VERSION_PATCH 0
133+#define MODULE_VERSION_PATCH 1

Subscribers

People subscribed via source and target branches