rpms/udev/devel 0001-enumeration-move-ALSA-control-devices-to-the-end-of-.patch, NONE, 1.1 0002-udevd-add-timestamp-to-debug-output.patch, NONE, 1.1 0003-fix-wrong-parameter-size-on-ioctl-FIONREAD.patch, NONE, 1.1 0004-fix-single-session-CD-detection.patch, NONE, 1.1 0005-fix-previous-commit-for-CD-detection.patch, NONE, 1.1 udev.spec, 1.292, 1.293 udev.git-3bf768245b98479a14190e1e1d32ef5fae3ddf8a.patch, 1.1, NONE udev.git-820fc48f249012c673eb38f63dd8b5ee039627d0.patch, 1.1, NONE

Harald Hoyer harald at fedoraproject.org
Fri Sep 25 17:05:23 UTC 2009


Author: harald

Update of /cvs/pkgs/rpms/udev/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25099

Modified Files:
	udev.spec 
Added Files:
	0001-enumeration-move-ALSA-control-devices-to-the-end-of-.patch 
	0002-udevd-add-timestamp-to-debug-output.patch 
	0003-fix-wrong-parameter-size-on-ioctl-FIONREAD.patch 
	0004-fix-single-session-CD-detection.patch 
	0005-fix-previous-commit-for-CD-detection.patch 
Removed Files:
	udev.git-3bf768245b98479a14190e1e1d32ef5fae3ddf8a.patch 
	udev.git-820fc48f249012c673eb38f63dd8b5ee039627d0.patch 
Log Message:
* Fri Sep 25 2009 harald at redhat.com 145-9
- add patches to fix cdrom_id
- add patch to fix the inotify bug (bug #524752)


0001-enumeration-move-ALSA-control-devices-to-the-end-of-.patch:
 libudev-enumerate.c |   60 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 56 insertions(+), 4 deletions(-)

--- NEW FILE 0001-enumeration-move-ALSA-control-devices-to-the-end-of-.patch ---
>From 1dc0ee343df6b6e2ce0591ff08a0aeae2aa2196f Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart at poettering.net>
Date: Mon, 27 Jul 2009 23:24:27 +0200
Subject: [PATCH 1/5] enumeration: move ALSA control devices to the end of the enumerated devices of each card

Generally ALSA control devices should be the last ones to be processed
for ACL changes and similar operations because they can then be used as
indicators that ACL management finished for all device nodes of a
specific card.

This patch simple moves each controlC device behind all the pcmC devices
(and similar).
---
 libudev/libudev-enumerate.c |   59 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c
index db8c514..e372079 100644
--- a/libudev/libudev-enumerate.c
+++ b/libudev/libudev-enumerate.c
@@ -187,7 +187,8 @@ static int syspath_cmp(const void *p1, const void *p2)
 	return ret;
 }
 
-static int devices_delay(struct udev *udev, const char *syspath)
+/* For devices that should be moved to the absolute end of the list */
+static int devices_delay_end(struct udev *udev, const char *syspath)
 {
 	static const char *delay_device_list[] = {
 		"/block/md",
@@ -207,6 +208,32 @@ static int devices_delay(struct udev *udev, const char *syspath)
 	return 0;
 }
 
+/* For devices that should just be moved a little bit later, just
+ * before the point where some common path prefix changes. Returns the
+ * number of characters that make up that common prefix */
+static size_t devices_delay_later(struct udev *udev, const char *syspath)
+{
+	const char *c;
+
+	/* For sound cards the control device must be enumerated last
+	 * to make sure it's the final device node that gets ACLs
+	 * applied. Applications rely on this fact and use ACL changes
+	 * on the control node as an indicator that the ACL change of
+	 * the entire sound card completed. The kernel makes this
+	 * guarantee when creating those devices, and hence we should
+	 * too when enumerating them. */
+
+	if ((c = strstr(syspath, "/sound/card"))) {
+		c += 11;
+		c += strcspn(c, "/");
+
+		if (strncmp(c, "/controlC", 9) == 0)
+			return c - syspath + 1;
+	}
+
+	return 0;
+}
+
 /**
  * udev_enumerate_get_list_entry:
  * @udev_enumerate: context
@@ -220,7 +247,8 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude
 	if (!udev_enumerate->devices_uptodate) {
 		unsigned int i;
 		unsigned int max;
-		struct syspath *prev = NULL;
+		struct syspath *prev = NULL, *move_later = NULL;
+		size_t move_later_prefix;
 
 		udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list);
 		qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp);
@@ -237,14 +265,39 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude
 			prev = entry;
 
 			/* skip to be delayed devices, and add them to the end of the list */
-			if (devices_delay(udev_enumerate->udev, entry->syspath)) {
+			if (devices_delay_end(udev_enumerate->udev, entry->syspath)) {
 				syspath_add(udev_enumerate, entry->syspath);
 				continue;
 			}
 
+			/* skip to be delayed devices, and move the to
+			 * the point where the prefix changes. We can
+			 * only move one item at a time. */
+			if (!move_later) {
+				move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath);
+
+				if (move_later_prefix > 0) {
+					move_later = entry;
+					continue;
+				}
+			}
+
+			if (move_later &&
+			    strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) {
+
+				udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list,
+					    move_later->syspath, NULL, 0, 0);
+				move_later = NULL;
+			}
+
 			udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list,
 					    entry->syspath, NULL, 0, 0);
 		}
+
+		if (move_later)
+			udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list,
+					    move_later->syspath, NULL, 0, 0);
+
 		/* add and cleanup delayed devices from end of list */
 		for (i = max; i < udev_enumerate->devices_cur; i++) {
 			struct syspath *entry = &udev_enumerate->devices[i];
-- 
1.6.4.4


0002-udevd-add-timestamp-to-debug-output.patch:
 libudev/libudev-util-private.c |    3 ++-
 udev/udevd.c                   |   14 +++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

--- NEW FILE 0002-udevd-add-timestamp-to-debug-output.patch ---
>From 4db7e84ad817944c624256b310d44bd888121c8e Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay.sievers at vrfy.org>
Date: Fri, 17 Jul 2009 13:24:37 +0200
Subject: [PATCH 2/5] udevd: add timestamp to --debug output

---
 libudev/libudev-util-private.c |    3 ++-
 udev/udevd.c                   |   13 +++++++++++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c
index 5f5f4c1..f7daa94 100644
--- a/libudev/libudev-util-private.c
+++ b/libudev/libudev-util-private.c
@@ -249,6 +249,8 @@ int util_run_program(struct udev *udev, const char *command, char **envp,
 	int i;
 	int err = 0;
 
+	info(udev, "'%s' started\n", command);
+
 	/* build argv from command */
 	util_strscpy(arg, sizeof(arg), command);
 	i = 0;
@@ -273,7 +275,6 @@ int util_run_program(struct udev *udev, const char *command, char **envp,
 		argv[0] = arg;
 		argv[1] = NULL;
 	}
-	info(udev, "'%s'\n", command);
 
 	/* prepare pipes from child to parent */
 	if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) {
diff --git a/udev/udevd.c b/udev/udevd.c
index 2cdc18b..69d509c 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -31,6 +31,7 @@
 #include <time.h>
 #include <getopt.h>
 #include <dirent.h>
+#include <sys/time.h>
 #include <sys/prctl.h>
 #include <sys/socket.h>
 #include <sys/signalfd.h>
@@ -53,8 +54,15 @@ static void log_fn(struct udev *udev, int priority,
 		   const char *format, va_list args)
 {
 	if (debug) {
-		fprintf(stderr, "[%d] %s: ", (int) getpid(), fn);
-		vfprintf(stderr, format, args);
+		char buf[1024];
+		struct timeval tv;
+		struct timezone tz;
+
+		vsnprintf(buf, sizeof(buf), format, args);
+		gettimeofday(&tv, &tz);
+		fprintf(stderr, "%llu.%06u [%u] %s: %s",
+			(unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec,
+			(int) getpid(), fn, buf);
 	} else {
 		vsyslog(priority, format, args);
 	}
@@ -266,6 +274,7 @@ static void worker_new(struct event *event)
 			struct worker_message msg;
 			int err;
 
+			info(event->udev, "seq %llu running\n", udev_device_get_seqnum(dev));
 			udev_event = udev_event_new(dev);
 			if (udev_event == NULL)
 				_exit(3);
-- 
1.6.4.4


0003-fix-wrong-parameter-size-on-ioctl-FIONREAD.patch:
 udevd.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- NEW FILE 0003-fix-wrong-parameter-size-on-ioctl-FIONREAD.patch ---
>From 7766066b221302d75002cd5d5a021281388ee56c Mon Sep 17 00:00:00 2001
From: Andrew Church <gentoo4 at achurch.org>
Date: Thu, 24 Sep 2009 10:51:12 -0700
Subject: [PATCH 3/5] fix wrong parameter size on ioctl FIONREAD

On Wed, Sep 23, 2009 at 23:11, Matthias Schwarzott <zzam at gentoo.org> wrote:
> It is about ioctl failures on amd64:
>   http://bugs.gentoo.org/show_bug.cgi?id=286041
>
> A bad parameter type to an ioctl() call causes udev-146 to generate "error
> getting buffer for inotify" messages in syslog.  The offending code is
> roughly:
>
>    ssize_t nbytes, pos;
>    // ...
>    ioctl(fd, FIONREAD, &nbytes);
>
> where ssize_t is 64 bits on amd64, but the kernel code for FIONREAD (at least
> through gentoo-sources-2.6.31) uses type int:
>
>    p = (void __user *) arg;
>    switch (cmd) {
>    case FIONREAD:
>        // ...
>        ret = put_user(send_len, (int __user *) p);
>
> so the upper 32 bits of "nbytes" are left uninitialized, and the subsequent
> malloc(nbytes) fails unless those 32 bits happen to be zero (or the system has
> a LOT of memory).
---
 udev/udevd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/udev/udevd.c b/udev/udevd.c
index 69d509c..511cb4b 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -656,7 +656,7 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl)
 /* read inotify messages */
 static int handle_inotify(struct udev *udev)
 {
-	ssize_t nbytes, pos;
+	int nbytes, pos;
 	char *buf;
 	struct inotify_event *ev;
 
-- 
1.6.4.4


0004-fix-single-session-CD-detection.patch:
 60-persistent-storage.rules |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- NEW FILE 0004-fix-single-session-CD-detection.patch ---
>From 36b35c884fc06bc2babf0ec840cb423b94a45f93 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt at ubuntu.com>
Date: Sun, 20 Sep 2009 19:07:51 +0200
Subject: [PATCH 4/5] fix single-session CD detection

ID_CDROM_MEDIA_SESSION_LAST_OFFSET is not set for CDs with only a single
session (i. e. for the vast majority of CDs out there). The previous rules ran
blkid with invalid arguments for these, causing CD detection to fail in
DK-disks and gvfs.

Now check whether we actually have ID_CDROM_MEDIA_SESSION_LAST_OFFSET, and if
not, call blkid without -O for specifying the offset.

Many thanks to Maxim Levitsky for tracking this down!

https://launchpad.net/bugs/431055
---
 rules/rules.d/60-persistent-storage.rules |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
index 64e9578..1b85156 100644
--- a/rules/rules.d/60-persistent-storage.rules
+++ b/rules/rules.d/60-persistent-storage.rules
@@ -61,7 +61,9 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA
 ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
 
 # probe filesystem metadata of optical drives which have a media inserted
-KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
+KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
+# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET
+KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"
 
 # probe filesystem metadata of disks
 KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
-- 
1.6.4.4


0005-fix-previous-commit-for-CD-detection.patch:
 60-persistent-storage.rules |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- NEW FILE 0005-fix-previous-commit-for-CD-detection.patch ---
>From a09ac6a6ae39512fafe9df331a311113d2a1d9f6 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt at ubuntu.com>
Date: Sun, 20 Sep 2009 19:21:04 +0200
Subject: [PATCH 5/5] fix previous commit for CD detection

Do not run blkid twice. *brown paperbag*
---
 rules/rules.d/60-persistent-storage.rules |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
index 1b85156..0950847 100644
--- a/rules/rules.d/60-persistent-storage.rules
+++ b/rules/rules.d/60-persistent-storage.rules
@@ -63,7 +63,7 @@ ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_
 # probe filesystem metadata of optical drives which have a media inserted
 KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
 # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET
-KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"
+KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode"
 
 # probe filesystem metadata of disks
 KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
-- 
1.6.4.4



Index: udev.spec
===================================================================
RCS file: /cvs/pkgs/rpms/udev/devel/udev.spec,v
retrieving revision 1.292
retrieving revision 1.293
diff -u -p -r1.292 -r1.293
--- udev.spec	23 Sep 2009 17:27:00 -0000	1.292
+++ udev.spec	25 Sep 2009 17:05:23 -0000	1.293
@@ -5,7 +5,7 @@
 Summary: A userspace implementation of devfs
 Name: udev
 Version: 145
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPLv2
 Group: System Environment/Base
 Provides: udev-persistent = %{version}-%{release}
@@ -14,8 +14,12 @@ Obsoletes: udev-extras < 20090618
 Provides: udev-extras = 20090618-1
 Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.bz2
 
-Patch1: udev.git-3bf768245b98479a14190e1e1d32ef5fae3ddf8a.patch
-Patch2: udev.git-820fc48f249012c673eb38f63dd8b5ee039627d0.patch
+Patch1: 0001-enumeration-move-ALSA-control-devices-to-the-end-of-.patch
+Patch2: 0002-udevd-add-timestamp-to-debug-output.patch
+Patch3: 0003-fix-wrong-parameter-size-on-ioctl-FIONREAD.patch
+Patch4: 0004-fix-single-session-CD-detection.patch
+Patch5: 0005-fix-previous-commit-for-CD-detection.patch
+
 
 Source1: start_udev
 Source3: udev-post.init
@@ -99,6 +103,9 @@ glib-based applications using libudev fu
 %setup -q  
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
 
 %build
 # get rid of rpath
@@ -350,6 +357,10 @@ rm -rf $RPM_BUILD_ROOT
 %attr(0644,root,root) %{_libdir}/pkgconfig/gudev-1.0*
 
 %changelog
+* Fri Sep 25 2009 harald at redhat.com 145-9
+- add patches to fix cdrom_id
+- add patch to fix the inotify bug (bug #524752)
+
 * Wed Sep 23 2009 harald at redhat.com 145-8
 - obsolete libgudev and libgudev-devel (bug #523569)
 


--- udev.git-3bf768245b98479a14190e1e1d32ef5fae3ddf8a.patch DELETED ---


--- udev.git-820fc48f249012c673eb38f63dd8b5ee039627d0.patch DELETED ---




More information about the fedora-extras-commits mailing list