~ubuntu-branches/ubuntu/utopic/udisks/utopic

« back to all changes in this revision

Viewing changes to debian/patches/12-bogus-uevent-paths.patch

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2012-04-02 12:21:43 UTC
  • mfrom: (31.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20120402122143-qlmqluwpipmru6j5
Tags: 1.0.4-5ubuntu1
* Merge with Debian unstable. Remaining Ubuntu changes:
  - debian/control: Change the "cryptsetup" suggests to a "cryptsetup-bin"
    recommends, so that LUKS functionality works by default. This change
    needs to be kept in Ubuntu until the cryptsetup package split goes into
    Debian as well. (LP: #343363)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From 4f8c6d0c8141ee440032796c4a14f01d018a1a75 Mon Sep 17 00:00:00 2001
 
2
From: Martin Pitt <martinpitt@gnome.org>
 
3
Date: Mon, 2 Apr 2012 09:18:47 +0200
 
4
Subject: [PATCH] =?UTF-8?q?Bug=2048173=20=E2=80=94=20Ignore=20add/change=20e?=
 
5
 =?UTF-8?q?vents=20for=20a=20nonexisting=20native=20path?=
 
6
MIME-Version: 1.0
 
7
Content-Type: text/plain; charset=UTF-8
 
8
Content-Transfer-Encoding: 8bit
 
9
 
 
10
Devices that need to poll for media sometimes send out change uevents after
 
11
they got removed:
 
12
 
 
13
  UDEV [26112.087644] change /sdb (block)
 
14
  ACTION=change
 
15
  DEVNAME=/dev/sdb
 
16
  DEVPATH=/sdb
 
17
  DEVTYPE=disk
 
18
  DISK_MEDIA_CHANGE=1
 
19
  SUBSYSTEM=block
 
20
 
 
21
(Note the weird device path.) Our current logic treats this change event as
 
22
add, and creates an /org/freedesktop/UDisks/devices/sdb device for it:
 
23
 
 
24
  **** TREATING CHANGE AS ADD /sys/sdb
 
25
  **** ADDING /sys/sdb
 
26
  **** UPDATING /sys/sdb
 
27
 
 
28
But as the device does not really exist, this is invalid and useless.
 
29
 
 
30
If a real /dev/sdb comes back later on with an add event, udisks sees that the
 
31
device already exists, and crashes:
 
32
 
 
33
  (udisks-daemon:24900): udisks-daemon-ERROR **: **** HACK: Wanting to register
 
34
  object at path `/org/freedesktop/UDisks/devices/sdb' but there is already an
 
35
  object there. This is an internal error in the daemon. Aborting.
 
36
 
 
37
To prevent this, ensure that the native device actually exists before adding an
 
38
udisks object for it.
 
39
 
 
40
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48173
 
41
Bug-Ubuntu: https://bugs.launchpad.net/bugs/899757
 
42
---
 
43
 src/device.c |    7 +++++++
 
44
 1 files changed, 7 insertions(+), 0 deletions(-)
 
45
 
 
46
diff --git a/src/device.c b/src/device.c
 
47
index f24cb88..2ae7f38 100644
 
48
--- a/src/device.c
 
49
+++ b/src/device.c
 
50
@@ -5108,6 +5108,13 @@ device_new (Daemon *daemon,
 
51
   if (g_str_has_prefix (native_path, "/sys/devices/virtual/block/ram"))
 
52
     goto out;
 
53
 
 
54
+  /* ignore bogus events */
 
55
+  if (!g_file_test (native_path, G_FILE_TEST_EXISTS))
 
56
+    {
 
57
+      g_warning ("Ignoring device with nonexisting native path: %s", native_path);
 
58
+      goto out;
 
59
+    }
 
60
+
 
61
   PROFILE ("device_new(native_path=%s): start", native_path);
 
62
 
 
63
   device = DEVICE (g_object_new (TYPE_DEVICE, NULL));
 
64
-- 
 
65
1.7.9.1
 
66