Merge lp:~laney/whoopsie-preferences/mkdir into lp:whoopsie-preferences

Proposed by Iain Lane
Status: Merged
Merged at revision: 49
Proposed branch: lp:~laney/whoopsie-preferences/mkdir
Merge into: lp:whoopsie-preferences
Diff against target: 82 lines (+23/-10)
3 files modified
configure.ac (+1/-1)
debian/changelog (+14/-2)
src/whoopsie-preferences.c (+8/-7)
To merge this branch: bzr merge lp:~laney/whoopsie-preferences/mkdir
Reviewer Review Type Date Requested Status
Evan (community) Approve
Daisy Pluckers Pending
Review via email: mp+213633@code.launchpad.net

Description of the change

Creating a file when it's parent directory doesn't exist is bad.

Try to make /var/lib/apport/ here before making a file in it. This works because we're run as root.

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

I also imported the archive upload to the branch, as it seems that was uploaded directly (which meant that the staged change was lost, too)

lp:~laney/whoopsie-preferences/mkdir updated
52. By Iain Lane

Bump version in configure.ac

Revision history for this message
Evan (ev) wrote :

Looks sensible. +1

review: Approve
lp:~laney/whoopsie-preferences/mkdir updated
53. By Iain Lane

releasing package whoopsie-preferences version 0.11

Revision history for this message
Iain Lane (laney) wrote :

Thanks. I uploaded and pushed a tag to this branch—please could you merge it?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2013-07-29 13:54:45 +0000
3+++ configure.ac 2014-04-02 09:51:26 +0000
4@@ -1,5 +1,5 @@
5 AC_INIT([whoopsie-preferences],
6- [0.10],
7+ [0.11],
8 [http://launchpad.net/whoopsie-preferences])
9
10 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11
12=== modified file 'debian/changelog'
13--- debian/changelog 2013-07-29 13:52:59 +0000
14+++ debian/changelog 2014-04-02 09:51:26 +0000
15@@ -1,9 +1,21 @@
16-whoopsie-preferences (0.10) UNRELEASED; urgency=low
17+whoopsie-preferences (0.11) trusty; urgency=low
18
19+ [ Evan Dandrea ]
20 * Signal to policykit that we'd like a password dialog, if one is
21 needed.
22
23- -- Evan Dandrea <ev@ubuntu.com> Mon, 29 Jul 2013 14:52:42 +0100
24+ [ Iain Lane ]
25+ * Try to create /var/lib/apport/ to avoid crashing when we attempt to access
26+ a file in there. (LP: #1289097)
27+
28+ -- Iain Lane <iain.lane@canonical.com> Wed, 02 Apr 2014 10:50:18 +0100
29+
30+whoopsie-preferences (0.10) trusty; urgency=low
31+
32+ * Change location of file indicating that automatic crash reporting is
33+ enabled. (LP: #1239811)
34+
35+ -- Brian Murray <brian@ubuntu.com> Mon, 06 Jan 2014 12:11:36 -0800
36
37 whoopsie-preferences (0.9) saucy; urgency=low
38
39
40=== modified file 'src/whoopsie-preferences.c'
41--- src/whoopsie-preferences.c 2013-07-29 13:52:59 +0000
42+++ src/whoopsie-preferences.c 2014-04-02 09:51:26 +0000
43@@ -113,7 +113,7 @@
44 autoreport_file_changed (GFileMonitor* monitor, GFile* file, GFile* other_file, GFileMonitorEvent event_type, gpointer user_data)
45 {
46 WhoopsiePreferences* interface = user_data;
47- if (access ("/etc/apport/autoreport", F_OK) != -1) {
48+ if (access ("/var/lib/apport/autoreport", F_OK) != -1) {
49 whoopsie_preferences_set_automatically_report_crashes (interface, TRUE);
50 } else {
51 whoopsie_preferences_set_automatically_report_crashes (interface, FALSE);
52@@ -128,11 +128,11 @@
53 GError* err = NULL;
54 GFileMonitor* monitor = NULL;
55
56- path = g_file_new_for_path ("/etc/apport/autoreport");
57+ path = g_file_new_for_path ("/var/lib/apport/autoreport");
58 monitor = g_file_monitor_file (path, G_FILE_MONITOR_NONE, NULL, &err);
59 g_object_unref (path);
60 if (err) {
61- g_print ("Unable to monitor /etc/apport/autoreport: %s", err->message);
62+ g_print ("Unable to monitor /var/lib/apport/autoreport: %s", err->message);
63 g_error_free (err);
64 } else {
65 g_signal_connect (monitor, "changed", G_CALLBACK (autoreport_file_changed), iface);
66@@ -191,12 +191,13 @@
67 /* I'm aware this is usually a race, but it's really just to guard against
68 * writing the file when it already exists. */
69 if (iface->get_automatically_report_crashes (object)) {
70- if (access ("/etc/apport/autoreport", F_OK) < 0) {
71- fclose (fopen ("/etc/apport/autoreport", "w"));
72+ if (g_mkdir_with_parents("/var/lib/apport/", 0755) &&
73+ (access ("/var/lib/apport/autoreport", F_OK) < 0)) {
74+ fclose (fopen ("/var/lib/apport/autoreport", "w"));
75 }
76 } else {
77- if (access ("/etc/apport/autoreport", F_OK) != -1) {
78- unlink ("/etc/apport/autoreport");
79+ if (access ("/var/lib/apport/autoreport", F_OK) != -1) {
80+ unlink ("/var/lib/apport/autoreport");
81 }
82 }
83

Subscribers

People subscribed via source and target branches

to all changes: