Compare commits

...

11 Commits
rawhide ... f17

Author SHA1 Message Date
David Zeuthen e0f3c85539 Fix VPD / WWN problem for Samsung drives (#887979) 2012-12-17 15:36:34 -05:00
David Zeuthen aa1c5e1c62 BR gnome-common when doing autoreconf 2012-10-12 16:08:32 -04:00
David Zeuthen 219d3e6e01 Use libacl instead of calling out to setfacl(1) (#865801) 2012-10-12 15:57:12 -04:00
David Zeuthen e9b83d432d Avoid using non-unique WWN for Samsung drives (#838691) 2012-07-10 17:14:32 -04:00
Peter Robinson cbb5bf0c01 Add a Requires for eject (#810882) 2012-06-14 21:05:20 +01:00
David Zeuthen 02ac7b2627 Detect rst_pstor devices as drives (#828492) 2012-06-05 15:09:39 -04:00
Peter Robinson d180f8eed0 bump Release 2012-05-22 12:30:49 +01:00
Peter Robinson 0a53418845 Add upstream patch to fix issue with rootfs being on a bound mount 2012-05-22 12:29:00 +01:00
David Zeuthen 14f6a54e8f Actually apply the patch added in previous commit 2012-05-14 18:13:08 -04:00
David Zeuthen 1793606ae7 Properly detect umount(8) output for busy filesystem (#819492) 2012-05-14 17:59:03 -04:00
David Zeuthen 80a2b7ffa0 Include patch so Fedora Live media is shown 2012-05-03 10:44:28 -04:00
8 changed files with 491 additions and 1 deletions

View File

@ -0,0 +1,160 @@
From 15250f35ff8770389cc579c304fbcac9beebc203 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Fri, 20 Apr 2012 13:33:08 +0000
Subject: Use libacl library instead of setfacl(1)
https://bugs.freedesktop.org/show_bug.cgi?id=48842
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
diff --git a/configure.ac b/configure.ac
index 63bd396..20c2042 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,19 @@ if test "x$with_systemdsystemunitdir" != "xno"; then
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])
+# libacl
+AC_CHECK_HEADERS(
+ [sys/acl.h acl/libacl.h],
+ [ACL_CFLAGS=""],
+ AC_MSG_ERROR([*** ACL headers not found.]))
+AC_CHECK_LIB(
+ [acl],
+ [acl_get_file],
+ [ACL_LIBS="-lacl"],
+ AC_MSG_ERROR([*** libacl not found.]))
+AC_SUBST(ACL_CFLAGS)
+AC_SUBST(ACL_LIBS)
+
# Internationalization
#
diff --git a/src/Makefile.am b/src/Makefile.am
index 250ed48..a3a5787 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,6 +86,7 @@ libudisks_daemon_la_CFLAGS = \
$(GUDEV_CFLAGS) \
$(LIBATASMART_CFLAGS) \
$(POLKIT_GOBJECT_1_CFLAGS) \
+ $(ACL_CFLAGS) \
$(NULL)
libudisks_daemon_la_LIBADD = \
@@ -94,6 +95,7 @@ libudisks_daemon_la_LIBADD = \
$(GUDEV_LIBS) \
$(LIBATASMART_LIBS) \
$(POLKIT_GOBJECT_1_LIBS) \
+ $(ACL_LIBS) \
$(top_builddir)/udisks/libudisks2.la \
$(NULL)
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
index 7c36f53..9dde4e4 100644
--- a/src/udiskslinuxfilesystem.c
+++ b/src/udiskslinuxfilesystem.c
@@ -29,6 +29,8 @@
#include <stdio.h>
#include <mntent.h>
#include <sys/types.h>
+#include <sys/acl.h>
+#include <errno.h>
#include <glib/gstdio.h>
@@ -758,6 +760,42 @@ ensure_utf8 (const gchar *s)
/* ---------------------------------------------------------------------------------------------------- */
+static gboolean
+add_acl (const gchar *path,
+ uid_t uid,
+ GError **error)
+{
+ gboolean ret = FALSE;
+ acl_t acl = NULL;
+ acl_entry_t entry;
+ acl_permset_t permset;
+
+ acl = acl_get_file(path, ACL_TYPE_ACCESS);
+ if (acl == NULL ||
+ acl_create_entry (&acl, &entry) == -1 ||
+ acl_set_tag_type (entry, ACL_USER) == -1 ||
+ acl_set_qualifier (entry, &uid) == -1 ||
+ acl_get_permset (entry, &permset) == -1 ||
+ acl_add_perm (permset, ACL_READ|ACL_EXECUTE) == -1 ||
+ acl_calc_mask (&acl) == -1 ||
+ acl_set_file (path, ACL_TYPE_ACCESS, acl) == -1)
+ {
+ g_set_error (error,
+ G_IO_ERROR,
+ g_io_error_from_errno (errno),
+ "Adding read ACL for uid %d to `%s' failed: %m",
+ (gint) uid, path);
+ goto out;
+ }
+
+ ret = TRUE;
+
+ out:
+ if (acl != NULL)
+ acl_free (acl);
+ return ret;
+}
+
/*
* calculate_mount_point: <internal>
* @block: A #UDisksBlock.
@@ -803,9 +841,6 @@ calculate_mount_point (UDisksBlock *block,
mount_dir = g_strdup_printf ("/run/media/%s", user_name);
if (!g_file_test (mount_dir, G_FILE_TEST_EXISTS))
{
- gchar *stderr_txt;
- gint exit_status;
-
/* First ensure that /run/media exists */
if (!g_file_test ("/run/media", G_FILE_TEST_EXISTS))
{
@@ -828,36 +863,13 @@ calculate_mount_point (UDisksBlock *block,
mount_dir);
goto out;
}
- /* Then set the ACL such that only $USER can actually access it */
- escaped_user_name = udisks_daemon_util_escape (user_name);;
- s = g_strdup_printf ("setfacl -m \"u:%s:rx\" \"%s\"",
- escaped_user_name,
- mount_dir);
- if (!g_spawn_command_line_sync (s,
- NULL, /* stdout_txt */
- &stderr_txt,
- &exit_status,
- error))
+ /* Finally, add the read+execute ACL for $USER */
+ if (!add_acl (mount_dir, uid, error))
{
- g_free (s);
- if (rmdir (mount_dir) != 0)
- udisks_warning ("Error calling rmdir() on %s: %m", mount_dir);
- goto out;
- }
- if (!(WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 0))
- {
- g_set_error (error,
- UDISKS_ERROR,
- UDISKS_ERROR_FAILED,
- "Command-line `%s' didn't exit normally: %s", s, stderr_txt);
- g_free (stderr_txt);
- g_free (s);
if (rmdir (mount_dir) != 0)
udisks_warning ("Error calling rmdir() on %s: %m", mount_dir);
goto out;
}
- g_free (stderr_txt);
- g_free (s);
}
}
/* otherwise fall back to mounting in /media */
--
cgit v0.9.0.2-2-gbebe

View File

@ -0,0 +1,32 @@
From d8fa361eec2706091e9d7f166f63bb5c0f663f4b Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Mon, 30 Apr 2012 17:29:22 -0400
Subject: [PATCH 01/24] Also check for "target is busy" when checking
umount(8) output
Apparently this changed recently... ideally umount(8) would simply
return a well-defined exit code but that's not the way things work
right now.
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
src/udiskslinuxfilesystem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
index 268f772..c53fba0 100644
--- a/src/udiskslinuxfilesystem.c
+++ b/src/udiskslinuxfilesystem.c
@@ -1582,7 +1582,8 @@ static guint
get_error_code_for_umount (gint exit_status,
const gchar *error_message)
{
- if (strstr (error_message, "device is busy") != NULL)
+ if (strstr (error_message, "device is busy") != NULL ||
+ strstr (error_message, "target is busy") != NULL)
return UDISKS_ERROR_DEVICE_BUSY;
else
return UDISKS_ERROR_FAILED;
--
1.7.10.1

View File

@ -0,0 +1,34 @@
From 6512ec74025a0fec96a58ab330d891e3004b5826 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Thu, 3 May 2012 09:46:43 -0400
Subject: [PATCH] Add work-around to show FS on CDs/USB sticks created using
isohybrid
This happens at least in two cases - when using loop-devices with
LO_PARTSCAN and when dd(1)'ing the image to a USB stick.
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
data/80-udisks2.rules | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/data/80-udisks2.rules b/data/80-udisks2.rules
index f1fe9bc..f6a3e47 100644
--- a/data/80-udisks2.rules
+++ b/data/80-udisks2.rules
@@ -96,3 +96,12 @@ ENV{ID_FS_TYPE}=="ntfs|vfat", \
# read-only non-Linux software installer partitions
ENV{ID_VENDOR}=="Sony", ENV{ID_MODEL}=="PRS*Launcher", ENV{UDISKS_IGNORE}="1"
+
+# Content created using isohybrid (typically used on CDs and USB
+# sticks for bootable media) is a bit special insofar that the
+# interesting content is on a DOS partition with type 0x00 ... which
+# is hidden above. So undo this.
+#
+# See http://mjg59.dreamwidth.org/11285.html for more details
+#
+ENV{ID_PART_TABLE_TYPE}=="dos", ENV{ID_PART_ENTRY_TYPE}=="0x0", ENV{ID_FS_TYPE}=="iso9660", ENV{UDISKS_IGNORE}="0"
--
1.7.10

View File

@ -0,0 +1,56 @@
From 93e82ba32dd51d3b8d786060c4bbe44e62a85bb5 Mon Sep 17 00:00:00 2001
From: David Zeuthen <zeuthen@gmail.com>
Date: Tue, 5 Jun 2012 14:44:48 -0400
Subject: [PATCH] If a block device has ID_PATH set, consider it to be a drive
This fixes problems with the devices where ID_SERIAL or
ID_WWN_WITH_EXTENSION is not set. For example, block devices from the
rts_pstor driver.
See https://bugzilla.redhat.com/show_bug.cgi?id=828492
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
---
src/udiskslinuxdriveobject.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/udiskslinuxdriveobject.c b/src/udiskslinuxdriveobject.c
index 41cc40e..1e8142a 100644
--- a/src/udiskslinuxdriveobject.c
+++ b/src/udiskslinuxdriveobject.c
@@ -665,17 +665,17 @@ udisks_linux_drive_object_uevent (UDisksLinuxDriveObject *object,
static gchar *
check_for_vpd (GUdevDevice *device)
{
- gchar *ret;
+ gchar *ret = NULL;
const gchar *serial;
const gchar *wwn;
+ const gchar *path;
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
- ret = NULL;
-
- /* prefer WWN to serial */
+ /* order of preference: WWN, serial, path */
serial = g_udev_device_get_property (device, "ID_SERIAL");
wwn = g_udev_device_get_property (device, "ID_WWN_WITH_EXTENSION");
+ path = g_udev_device_get_property (device, "ID_PATH");
if (wwn != NULL && strlen (wwn) > 0)
{
ret = g_strdup (wwn);
@@ -684,6 +684,10 @@ check_for_vpd (GUdevDevice *device)
{
ret = g_strdup (serial);
}
+ else if (path != NULL && strlen (path) > 0)
+ {
+ ret = g_strdup (path);
+ }
return ret;
}
--
1.7.10.2

View File

@ -0,0 +1,61 @@
From 076185cd8bc2d912834f0815e4239e9648f760e0 Mon Sep 17 00:00:00 2001
From: David Zeuthen <zeuthen@gmail.com>
Date: Tue, 10 Jul 2012 17:09:16 -0400
Subject: [PATCH] Black-list seemingly invalid WWN for SAMSUNG SP1604N hard
disks
In this case, use the serial number as the VPD (the serial number does
vary) otherwise we'll end up only creating a single Drive object.
This was reported in https://bugzilla.redhat.com/show_bug.cgi?id=838691
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
---
src/udiskslinuxdriveobject.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/src/udiskslinuxdriveobject.c b/src/udiskslinuxdriveobject.c
index ebde954..1aa58a8 100644
--- a/src/udiskslinuxdriveobject.c
+++ b/src/udiskslinuxdriveobject.c
@@ -704,6 +704,28 @@ apply_configuration (UDisksLinuxDriveObject *object)
/* ---------------------------------------------------------------------------------------------------- */
+/* utility routine to blacklist WWNs that are not suitable to use
+ * for identification purposes
+ */
+static gboolean
+is_wwn_black_listed (const gchar *wwn)
+{
+ g_return_val_if_fail (wwn != NULL, FALSE);
+
+ if (g_str_has_prefix (wwn, "0x") || g_str_has_prefix (wwn, "0X"))
+ wwn += 2;
+
+ if (g_ascii_strcasecmp (wwn, "50f0000000000000") == 0)
+ {
+ /* SAMSUNG SP1604N (PATA), see https://bugzilla.redhat.com/show_bug.cgi?id=838691#c4 */
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
static gchar *
check_for_vpd (GUdevDevice *device)
{
@@ -718,7 +740,7 @@ check_for_vpd (GUdevDevice *device)
serial = g_udev_device_get_property (device, "ID_SERIAL");
wwn = g_udev_device_get_property (device, "ID_WWN_WITH_EXTENSION");
path = g_udev_device_get_property (device, "ID_PATH");
- if (wwn != NULL && strlen (wwn) > 0)
+ if (wwn != NULL && strlen (wwn) > 0 && !is_wwn_black_listed (wwn))
{
ret = g_strdup (wwn);
}
--
1.7.10.4

View File

@ -0,0 +1,41 @@
From 698c6c4fae49192e55f669c4b8c2cbad9f92a9fb Mon Sep 17 00:00:00 2001
From: David Zeuthen <zeuthen@gmail.com>
Date: Mon, 17 Dec 2012 15:18:40 -0500
Subject: [PATCH] Use both WWN and serials for VPD, if available
This fixes a problem with SAMSUNG drives returning the same WWN for
different drives:
https://bugzilla.redhat.com/show_bug.cgi?id=887979
Signed-off-by: David Zeuthen <zeuthen@gmail.com>
---
src/udiskslinuxdriveobject.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/udiskslinuxdriveobject.c b/src/udiskslinuxdriveobject.c
index 1aa58a8..f2391b9 100644
--- a/src/udiskslinuxdriveobject.c
+++ b/src/udiskslinuxdriveobject.c
@@ -736,13 +736,16 @@ check_for_vpd (GUdevDevice *device)
g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE);
- /* order of preference: WWN, serial, path */
+ /* order of preference: WWN_serial, WWN, serial, path */
serial = g_udev_device_get_property (device, "ID_SERIAL");
wwn = g_udev_device_get_property (device, "ID_WWN_WITH_EXTENSION");
path = g_udev_device_get_property (device, "ID_PATH");
if (wwn != NULL && strlen (wwn) > 0 && !is_wwn_black_listed (wwn))
{
- ret = g_strdup (wwn);
+ if (serial != NULL && strlen (serial) > 0)
+ ret = g_strdup_printf ("%s_%s", wwn, serial);
+ else
+ ret = g_strdup (wwn);
}
else if (serial != NULL && strlen (serial) > 0)
{
--
1.8.0.2

View File

@ -0,0 +1,35 @@
From e0b8ffe3099735fefd64973e6575c67ac0759be2 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Tue, 15 May 2012 14:17:22 +0000
Subject: Bug 49842 Unhandled rootfs on bind mount
Don't ignore a mount just because if a subtree of the filesystem is
mounted. Because if we do this, we may wrongly conclude the device is
not mounted at all, which then means that it's visible in the desktop
UI and subject to automounting.
In the future, we may want a "a(ss) MountPointsFull" property that in
addition to the mount point also contains the subtree that is mounted
at said mountpoint.
https://bugs.freedesktop.org/show_bug.cgi?id=49842
Signed-off-by: David Zeuthen <davidz@redhat.com>
---
diff --git a/src/udisksmountmonitor.c b/src/udisksmountmonitor.c
index 43adaa5..36e1476 100644
--- a/src/udisksmountmonitor.c
+++ b/src/udisksmountmonitor.c
@@ -433,10 +433,6 @@ udisks_mount_monitor_get_mountinfo (UDisksMountMonitor *monitor,
continue;
}
- /* ignore mounts where only a subtree of a filesystem is mounted */
- if (g_strcmp0 (encoded_root, "/") != 0)
- continue;
-
/* Temporary work-around for btrfs, see
*
* https://bugzilla.redhat.com/show_bug.cgi?id=495152#c31
--
cgit v0.9.0.2-2-gbebe

View File

@ -5,10 +5,15 @@
%define libatasmart_version 0.12
%define dbus_version 1.4.0
# Only enable if using patches that touches configure.ac,
# Makefile.am or other build system related files
#
%define enable_autoreconf 1
Summary: Disk Manager
Name: udisks2
Version: 1.94.0
Release: 1%{?dist}
Release: 11%{?dist}
License: GPLv2+
Group: System Environment/Libraries
URL: http://www.freedesktop.org/wiki/Software/udisks
@ -21,6 +26,7 @@ BuildRequires: libatasmart-devel >= %{libatasmart_version}
BuildRequires: libgudev1-devel >= %{udev_version}
BuildRequires: gtk-doc
BuildRequires: systemd-devel
BuildRequires: libacl-devel
# needed to pull in the system bus daemon
Requires: dbus >= %{dbus_version}
# needed to pull in the udev daemon
@ -47,10 +53,35 @@ Requires: gdisk
# for LUKS devices
Requires: cryptsetup-luks
Requires: acl
# For ejecting removable disks
Requires: eject
# for /proc/self/mountinfo, only available in 2.6.26 or higher
Conflicts: kernel < 2.6.26
%if 0%{?enable_autoreconf}
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: gnome-common
%endif
Patch0: udisks-1.97.0-Add-work-around-to-show-FS-on-CDs-USB-sticks-created.patch
Patch1: udisks-1.97-Also-check-for-target-is-busy-when-checking-umount-8.patch
# https://bugs.freedesktop.org/show_bug.cgi?id=49842
Patch2: udisks2-root-bound-mount-fix.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=828492
Patch3: udisks-1.97.0-If-a-block-device-has-ID_PATH-set-consider-it-to-be-a-drive.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=838691
Patch4: udisks-1.99.0-Black-list-seemingly-invalid-WWN-for-SAMSUNG-SP1604N.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=865801
Patch5: udisks-1.94.0-use-libacl.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=887979
Patch6: udisks-2.0.0-Use-both-WWN-and-serials-for-VPD-if-available.patch
%description
udisks provides a daemon, D-Bus API and command line tools for
managing disks and storage devices. This package is for the udisks 2.x
@ -80,8 +111,18 @@ daemon. This package is for the udisks 2.x series.
%prep
%setup -q -n udisks-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%build
%if 0%{?enable_autoreconf}
autoreconf
%endif
%configure --enable-gtk-doc
make
@ -137,6 +178,36 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
# Note: please don't forget the %{?dist} in the changelog. Thanks
%changelog
* Mon Dec 17 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-11%{?dist}
- Fix VPD / WWN problem for Samsung drives (#887979)
* Fri Oct 12 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-10%{?dist}
- BR gnome-common when doing autoreconf
* Fri Oct 12 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-9%{?dist}
- Use libacl instead of calling out to setfacl(1) (#865801)
* Tue Jul 10 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-8%{?dist}
- Avoid using non-unique WWN for Samsung drives (#838691)
* Thu Jun 14 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 1.94.0-7%{?dist}
- Add a Requires for eject (#810882)
* Tue Jun 05 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-6%{?dist}
- Detect rst_pstor devices as drives (#828492)
* Tue May 22 2012 Peter Robinson <pbrobinson@fedoraproject.org> - 1.94.0-5%{?dist}
- Add upstream patch to fix issue with rootfs being on a bound mount
* Mon May 14 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-4%{?dist}
- Actually apply the patch added in previous commit
* Mon May 14 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-3%{?dist}
- Properly detect umount(8) output for busy filesystem (#819492)
* Thu May 03 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-2%{?dist}
- Include patch so Fedora Live media is shown
* Tue Apr 10 2012 David Zeuthen <davidz@redhat.com> - 1.94.0-1%{?dist}
- Update to release 1.94.0