commit cb2732092773be399f83e38965b00b84ac7735ef6b5731913074740fbaac4d44 Author: Adrian Schröter Date: Sat May 4 01:35:27 2024 +0200 Sync from SUSE:SLFO:Main udisks2 revision 727ad386a543b3cbc0b40db7b325c7f1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/0001-udisksata-Move-the-low-level-PM-state-call.patch b/0001-udisksata-Move-the-low-level-PM-state-call.patch new file mode 100644 index 0000000..20798f6 --- /dev/null +++ b/0001-udisksata-Move-the-low-level-PM-state-call.patch @@ -0,0 +1,129 @@ +From a7d9b97c9460f65a726b727e9eaee31ea5016538 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Wed, 5 Jan 2022 20:17:55 +0100 +Subject: [PATCH] udisksata: Move the low-level PM state call + +(cherry picked from commit 4588dbeecd23c17d1cb7f7fa60afd56702acd455) +--- + doc/udisks2-sections.txt.daemon.sections.in | 2 + + src/udisksata.c | 62 +++++++++++++++++++++ + src/udisksata.h | 13 +++++ + 3 files changed, 77 insertions(+) + +diff --git a/doc/udisks2-sections.txt.daemon.sections.in b/doc/udisks2-sections.txt.daemon.sections.in +index 12935c4d..9a2bfa03 100644 +--- a/doc/udisks2-sections.txt.daemon.sections.in ++++ b/doc/udisks2-sections.txt.daemon.sections.in +@@ -270,6 +270,8 @@ UDisksAtaCommandProtocol + UDisksAtaCommandInput + UDisksAtaCommandOutput + udisks_ata_send_command_sync ++udisks_ata_get_pm_state ++UDISKS_ATA_PM_STATE_AWAKE + + +
+diff --git a/src/udisksata.c b/src/udisksata.c +index 9491af5e..e6da8c35 100644 +--- a/src/udisksata.c ++++ b/src/udisksata.c +@@ -308,3 +308,65 @@ udisks_ata_send_command_sync (gint fd, + out: + return ret; + } ++ ++/** ++ * udisks_ata_get_pm_state: ++ * @device: ATA drive block device path. ++ * @error: Return location for error. ++ * @pm_state: Return location for the current power state value. ++ * ++ * Get the current power mode state. ++ * ++ * The format of @pm_state is the result obtained from sending the ++ * ATA command `CHECK POWER MODE` to the drive. ++ * ++ * Known values include: ++ * - `0x00`: Device is in PM2: Standby state. ++ * - `0x40`: Device is in the PM0: Active state, the NV Cache power mode is enabled, and the spindle is spun down or spinning down. ++ * - `0x41`: Device is in the PM0: Active state, the NV Cache power mode is enabled, and the spindle is spun up or spinning up. ++ * - `0x80`: Device is in PM1: Idle state. ++ * - `0xff`: Device is in the PM0: Active state or PM1: Idle State. ++ * ++ * Typically user interfaces will report "Drive is spun down" if @pm_state is ++ * 0x00 and "Drive is spun up" otherwise. ++ * ++ * Returns: %TRUE if the operation succeeded, %FALSE if @error is set. ++ */ ++gboolean ++udisks_ata_get_pm_state (const gchar *device, GError **error, guchar *count) ++{ ++ int fd; ++ gboolean rc = FALSE; ++ /* ATA8: 7.8 CHECK POWER MODE - E5h, Non-Data */ ++ UDisksAtaCommandInput input = {.command = 0xe5}; ++ UDisksAtaCommandOutput output = {0}; ++ ++ g_warn_if_fail (device != NULL); ++ ++ fd = open (device, O_RDONLY|O_NONBLOCK); ++ if (fd == -1) ++ { ++ g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED, ++ "Error opening device file %s while getting PM state: %m", ++ device); ++ goto out; ++ } ++ ++ if (!udisks_ata_send_command_sync (fd, ++ -1, ++ UDISKS_ATA_COMMAND_PROTOCOL_NONE, ++ &input, ++ &output, ++ error)) ++ { ++ g_prefix_error (error, "Error sending ATA command CHECK POWER MODE: "); ++ goto out; ++ } ++ /* count field is used for the state, see ATA8: table 102 */ ++ *count = output.count; ++ rc = TRUE; ++ out: ++ if (fd != -1) ++ close (fd); ++ return rc; ++} +diff --git a/src/udisksata.h b/src/udisksata.h +index 1d4918f1..d652f3ab 100644 +--- a/src/udisksata.h ++++ b/src/udisksata.h +@@ -73,6 +73,16 @@ struct _UDisksAtaCommandOutput + guchar *buffer; + }; + ++/** ++ * UDISKS_ATA_PM_STATE_AWAKE: ++ * @pm_state: The power state value. ++ * ++ * Decodes the power state value as returned by #udisks_ata_get_pm_state. ++ * ++ * Returns: %TRUE when the drive is awake, %FALSE when sleeping. ++*/ ++#define UDISKS_ATA_PM_STATE_AWAKE(pm_state) (pm_state >= 0x41) ++ + gboolean udisks_ata_send_command_sync (gint fd, + gint timeout_msec, + UDisksAtaCommandProtocol protocol, +@@ -80,6 +90,9 @@ gboolean udisks_ata_send_command_sync (gint fd, + UDisksAtaCommandOutput *output, + GError **error); + ++gboolean udisks_ata_get_pm_state (const gchar *device, ++ GError **error, ++ guchar *count); + + G_END_DECLS + +-- +2.38.1 + diff --git a/0001-udiskslinuxfilesystem-Make-the-size-property-retriev.patch b/0001-udiskslinuxfilesystem-Make-the-size-property-retriev.patch new file mode 100644 index 0000000..a056ad0 --- /dev/null +++ b/0001-udiskslinuxfilesystem-Make-the-size-property-retriev.patch @@ -0,0 +1,277 @@ +From 9a2a96b46803b1d76d105f3bed994188b8205133 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Sun, 2 Jan 2022 23:45:12 +0100 +Subject: [PATCH] udiskslinuxfilesystem: Make the 'size' property retrieval + on-demand + +Filesystem size value retrieval is very expensive as it typically calls +filesystem tools that read superblock -> doing some I/O. Other +filesystem properties are typically retrieved from existing stateful +sources, either udev or sysfs. + +This change overrides the gdbus-codegen-generated GDBusInterfaceSkeleton +property retrieval and adds a custom hook that retrieves the filesystem +size value when actually requested. + +One limitation of such approach is that the hook is called with +the GDBusObjectManager lock held and thus it needs to be as minimal +as possible and avoiding access to any GDBusObject. +--- + src/udiskslinuxfilesystem.c | 129 +++++++++++++++++++++++++++--------- + 1 file changed, 97 insertions(+), 32 deletions(-) + +diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c +index a8390a04..413a5a37 100644 +--- a/src/udiskslinuxfilesystem.c ++++ b/src/udiskslinuxfilesystem.c +@@ -56,6 +56,7 @@ + #include "udiskssimplejob.h" + #include "udiskslinuxdriveata.h" + #include "udiskslinuxmountoptions.h" ++#include "udisksata.h" + + /** + * SECTION:udiskslinuxfilesystem +@@ -78,6 +79,10 @@ struct _UDisksLinuxFilesystem + { + UDisksFilesystemSkeleton parent_instance; + GMutex lock; ++ guint64 cached_fs_size; ++ gchar *cached_device_file; ++ gchar *cached_fs_type; ++ gboolean cached_drive_is_ata; + }; + + struct _UDisksLinuxFilesystemClass +@@ -85,7 +90,14 @@ struct _UDisksLinuxFilesystemClass + UDisksFilesystemSkeletonClass parent_class; + }; + ++enum ++{ ++ PROP_0, ++ PROP_SIZE, ++}; ++ + static void filesystem_iface_init (UDisksFilesystemIface *iface); ++static guint64 get_filesystem_size (UDisksLinuxFilesystem *filesystem); + + G_DEFINE_TYPE_WITH_CODE (UDisksLinuxFilesystem, udisks_linux_filesystem, UDISKS_TYPE_FILESYSTEM_SKELETON, + G_IMPLEMENT_INTERFACE (UDISKS_TYPE_FILESYSTEM, filesystem_iface_init)); +@@ -106,6 +118,8 @@ udisks_linux_filesystem_finalize (GObject *object) + UDisksLinuxFilesystem *filesystem = UDISKS_LINUX_FILESYSTEM (object); + + g_mutex_clear (&(filesystem->lock)); ++ g_free (filesystem->cached_device_file); ++ g_free (filesystem->cached_fs_type); + + if (G_OBJECT_CLASS (udisks_linux_filesystem_parent_class)->finalize != NULL) + G_OBJECT_CLASS (udisks_linux_filesystem_parent_class)->finalize (object); +@@ -119,6 +133,44 @@ udisks_linux_filesystem_init (UDisksLinuxFilesystem *filesystem) + G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD); + } + ++static void ++udisks_linux_filesystem_get_property (GObject *object, ++ guint prop_id, ++ GValue *value, ++ GParamSpec *pspec) ++{ ++ UDisksLinuxFilesystem *filesystem = UDISKS_LINUX_FILESYSTEM (object); ++ ++ switch (prop_id) ++ { ++ case PROP_SIZE: ++ g_value_set_uint64 (value, get_filesystem_size (filesystem)); ++ break; ++ ++ default: ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); ++ break; ++ } ++} ++ ++static void ++udisks_linux_filesystem_set_property (GObject *object, ++ guint prop_id, ++ const GValue *value, ++ GParamSpec *pspec) ++{ ++ switch (prop_id) ++ { ++ case PROP_SIZE: ++ g_warning ("udisks_linux_filesystem_set_property() should never be called, value = %lu", g_value_get_uint64 (value)); ++ break; ++ ++ default: ++ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); ++ break; ++ } ++} ++ + static void + udisks_linux_filesystem_class_init (UDisksLinuxFilesystemClass *klass) + { +@@ -126,6 +178,10 @@ udisks_linux_filesystem_class_init (UDisksLinuxFilesystemClass *klass) + + gobject_class = G_OBJECT_CLASS (klass); + gobject_class->finalize = udisks_linux_filesystem_finalize; ++ gobject_class->get_property = udisks_linux_filesystem_get_property; ++ gobject_class->set_property = udisks_linux_filesystem_set_property; ++ ++ g_object_class_override_property (gobject_class, PROP_SIZE, "size"); + } + + /** +@@ -144,49 +200,58 @@ udisks_linux_filesystem_new (void) + + /* ---------------------------------------------------------------------------------------------------- */ + ++/* WARNING: called with GDBusObjectManager lock held, avoid any object lookup */ + static guint64 +-get_filesystem_size (UDisksLinuxBlockObject *object) ++get_filesystem_size (UDisksLinuxFilesystem *filesystem) + { + guint64 size = 0; +- UDisksLinuxDevice *device; +- gchar *dev; +- const gchar *type; + GError *error = NULL; + +- device = udisks_linux_block_object_get_device (object); +- dev = udisks_linux_block_object_get_device_file (object); +- type = g_udev_device_get_property (device->udev_device, "ID_FS_TYPE"); ++ if (!filesystem->cached_device_file || !filesystem->cached_fs_type) ++ return 0; ++ ++ /* if the drive is ATA and is sleeping, skip filesystem size check to prevent ++ * drive waking up - nothing has changed anyway since it's been sleeping... ++ */ ++ if (filesystem->cached_drive_is_ata) ++ { ++ guchar pm_state = 0; ++ ++ if (udisks_ata_get_pm_state (filesystem->cached_device_file, NULL, &pm_state)) ++ if (!UDISKS_ATA_PM_STATE_AWAKE (pm_state) && filesystem->cached_fs_size > 0) ++ return filesystem->cached_fs_size; ++ } + +- if (g_strcmp0 (type, "ext2") == 0) ++ if (g_strcmp0 (filesystem->cached_fs_type, "ext2") == 0) + { +- BDFSExt2Info *info = bd_fs_ext2_get_info (dev, &error); ++ BDFSExt2Info *info = bd_fs_ext2_get_info (filesystem->cached_device_file, &error); + if (info) + { + size = info->block_size * info->block_count; + bd_fs_ext2_info_free (info); + } + } +- else if (g_strcmp0 (type, "ext3") == 0) ++ else if (g_strcmp0 (filesystem->cached_fs_type, "ext3") == 0) + { +- BDFSExt3Info *info = bd_fs_ext3_get_info (dev, &error); ++ BDFSExt3Info *info = bd_fs_ext3_get_info (filesystem->cached_device_file, &error); + if (info) + { + size = info->block_size * info->block_count; + bd_fs_ext3_info_free (info); + } + } +- else if (g_strcmp0 (type, "ext4") == 0) ++ else if (g_strcmp0 (filesystem->cached_fs_type, "ext4") == 0) + { +- BDFSExt4Info *info = bd_fs_ext4_get_info (dev, &error); ++ BDFSExt4Info *info = bd_fs_ext4_get_info (filesystem->cached_device_file, &error); + if (info) + { + size = info->block_size * info->block_count; + bd_fs_ext4_info_free (info); + } + } +- else if (g_strcmp0 (type, "xfs") == 0) ++ else if (g_strcmp0 (filesystem->cached_fs_type, "xfs") == 0) + { +- BDFSXfsInfo *info = bd_fs_xfs_get_info (dev, &error); ++ BDFSXfsInfo *info = bd_fs_xfs_get_info (filesystem->cached_device_file, &error); + if (info) + { + size = info->block_size * info->block_count; +@@ -194,10 +259,9 @@ get_filesystem_size (UDisksLinuxBlockObject *object) + } + } + +- g_free (dev); +- g_object_unref (device); + g_clear_error (&error); + ++ filesystem->cached_fs_size = size; + return size; + } + +@@ -234,14 +298,12 @@ void + udisks_linux_filesystem_update (UDisksLinuxFilesystem *filesystem, + UDisksLinuxBlockObject *object) + { ++ UDisksDriveAta *ata = NULL; + UDisksMountMonitor *mount_monitor; + UDisksLinuxDevice *device; +- UDisksDriveAta *ata = NULL; + GPtrArray *p; + GList *mounts; + GList *l; +- gboolean skip_fs_size = FALSE; +- guchar pm_state; + + mount_monitor = udisks_daemon_get_mount_monitor (udisks_linux_block_object_get_daemon (object)); + device = udisks_linux_block_object_get_device (object); +@@ -263,20 +325,24 @@ udisks_linux_filesystem_update (UDisksLinuxFilesystem *filesystem, + g_ptr_array_free (p, TRUE); + g_list_free_full (mounts, g_object_unref); + +- /* if the drive is ATA and is sleeping, skip filesystem size check to prevent +- * drive waking up - nothing has changed anyway since it's been sleeping... ++ /* cached device properties for on-demand filesystem size retrieval */ ++ g_free (filesystem->cached_device_file); ++ g_free (filesystem->cached_fs_type); ++ filesystem->cached_fs_type = g_strdup (g_udev_device_get_property (device->udev_device, "ID_FS_TYPE")); ++ if (g_strcmp0 (filesystem->cached_fs_type, "ext2") == 0 || ++ g_strcmp0 (filesystem->cached_fs_type, "ext3") == 0 || ++ g_strcmp0 (filesystem->cached_fs_type, "ext4") == 0 || ++ g_strcmp0 (filesystem->cached_fs_type, "xfs") == 0) ++ filesystem->cached_device_file = udisks_linux_block_object_get_device_file (object); ++ ++ /* TODO: this only looks for a drive object associated with the current ++ * block object. In case of a complex layered structure this needs to walk ++ * the tree and return a list of physical drives to check the powermanagement on. + */ + ata = get_drive_ata (object); +- if (ata != NULL) +- { +- if (udisks_linux_drive_ata_get_pm_state (UDISKS_LINUX_DRIVE_ATA (ata), NULL, &pm_state)) +- skip_fs_size = ! UDISKS_LINUX_DRIVE_ATA_IS_AWAKE (pm_state); +- } ++ filesystem->cached_drive_is_ata = ata != NULL && udisks_drive_ata_get_pm_supported (ata); + g_clear_object (&ata); + +- if (! skip_fs_size) +- udisks_filesystem_set_size (UDISKS_FILESYSTEM (filesystem), get_filesystem_size (object)); +- + g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (filesystem)); + + g_object_unref (device); +@@ -1872,10 +1938,9 @@ handle_resize (UDisksFilesystem *filesystem, + + /* At least resize2fs might need another uevent after it is done. + */ ++ UDISKS_LINUX_FILESYSTEM (filesystem)->cached_fs_size = 0; + udisks_linux_block_object_trigger_uevent_sync (UDISKS_LINUX_BLOCK_OBJECT (object), + UDISKS_DEFAULT_WAIT_TIMEOUT); +- +- udisks_filesystem_set_size (filesystem, get_filesystem_size (UDISKS_LINUX_BLOCK_OBJECT (object))); + g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (filesystem)); + udisks_filesystem_complete_resize (filesystem, invocation); + udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), TRUE, NULL); +-- +2.38.1 + diff --git a/0001-udiskslinuxmountoptions-Do-not-free-static-daemon-re.patch b/0001-udiskslinuxmountoptions-Do-not-free-static-daemon-re.patch new file mode 100644 index 0000000..81e4260 --- /dev/null +++ b/0001-udiskslinuxmountoptions-Do-not-free-static-daemon-re.patch @@ -0,0 +1,77 @@ +From d205057296957d6064825252a3d3377e809d6fed Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Wed, 6 Oct 2021 17:12:13 +0200 +Subject: [PATCH] udiskslinuxmountoptions: Do not free static daemon resources + +The GResource instance returned from udisks_daemon_resources_get_resource() +that calls g_static_resource_get_resource() internally is marked as +'(transfer none)' and should not be freed. In fact that causes double +free inside the g_static_resource_fini() atexit handler leading +to memory corruption causing random failures of further atexit +handlers such as cryptsetup and openssl destructors. + + Invalid read of size 4 + at 0x4BB03A4: g_resource_unref (gresource.c:527) + by 0x4BB2150: g_static_resource_fini (gresource.c:1449) + by 0x4010ADB: _dl_fini (dl-fini.c:139) + by 0x4EF0DF4: __run_exit_handlers (exit.c:113) + by 0x4EF0F6F: exit (exit.c:143) + by 0x4ED9566: __libc_start_call_main (libc_start_call_main.h:74) + by 0x4ED960B: __libc_start_main@@GLIBC_2.34 (libc-start.c:409) + by 0x128774: (below main) (in udisks/src/.libs/udisksd) + Address 0x5cc5fc0 is 0 bytes inside a block of size 16 free'd + at 0x48430E4: free (vg_replace_malloc.c:755) + by 0x4DB10BC: g_free (gmem.c:199) + by 0x4BB2148: g_static_resource_fini (gresource.c:1448) + by 0x4010ADB: _dl_fini (dl-fini.c:139) + by 0x4EF0DF4: __run_exit_handlers (exit.c:113) + by 0x4EF0F6F: exit (exit.c:143) + by 0x4ED9566: __libc_start_call_main (libc_start_call_main.h:74) + by 0x4ED960B: __libc_start_main@@GLIBC_2.34 (libc-start.c:409) + by 0x128774: (below main) (in udisks/src/.libs/udisksd) + Block was alloc'd at + at 0x484086F: malloc (vg_replace_malloc.c:380) + by 0x4DB47A8: g_malloc (gmem.c:106) + by 0x4BB19C7: UnknownInlinedFun (gresource.c:545) + by 0x4BB19C7: g_resource_new_from_data (gresource.c:613) + by 0x4BB1A88: register_lazy_static_resources_unlocked (gresource.c:1374) + by 0x4BB218C: UnknownInlinedFun (gresource.c:1393) + by 0x4BB218C: UnknownInlinedFun (gresource.c:1387) + by 0x4BB218C: g_static_resource_get_resource (gresource.c:1472) + by 0x14F6A3: UnknownInlinedFun (udisks-daemon-resources.c:284) + by 0x14F6A3: udisks_linux_mount_options_get_builtin (udiskslinuxmountoptions.c:612) + by 0x12CC6E: udisks_daemon_constructed (udisksdaemon.c:441) + by 0x4D1ED96: g_object_new_internal (gobject.c:1985) + by 0x4D20227: g_object_new_valist (gobject.c:2288) + by 0x4D2075C: g_object_new (gobject.c:1788) + by 0x129A5F: udisks_daemon_new (udisksdaemon.c:619) + by 0x129AD5: on_bus_acquired (main.c:63) + by 0x4C35C95: connection_get_cb.lto_priv.0 (gdbusnameowning.c:504) + by 0x4BD3F99: g_task_return_now (gtask.c:1219) + by 0x4BD419A: UnknownInlinedFun (gtask.c:1289) + by 0x4BD419A: g_task_return (gtask.c:1245) + by 0x4C31D51: bus_get_async_initable_cb (gdbusconnection.c:7433) + by 0x4BD3F99: g_task_return_now (gtask.c:1219) + by 0x4BD3FDC: complete_in_idle_cb (gtask.c:1233) + by 0x4DA852A: g_idle_dispatch (gmain.c:5897) + by 0x4DAC33E: UnknownInlinedFun (gmain.c:3381) + by 0x4DAC33E: g_main_context_dispatch (gmain.c:4099) +--- + src/udiskslinuxmountoptions.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/udiskslinuxmountoptions.c b/src/udiskslinuxmountoptions.c +index 7729d401..819c9ba9 100644 +--- a/src/udiskslinuxmountoptions.c ++++ b/src/udiskslinuxmountoptions.c +@@ -614,7 +614,6 @@ udisks_linux_mount_options_get_builtin (void) + "/org/freedesktop/UDisks2/data/builtin_mount_options.conf", + G_RESOURCE_LOOKUP_FLAGS_NONE, + &error); +- g_resource_unref (daemon_resource); + + if (builtin_opts_bytes == NULL) + { +-- +2.38.1 + diff --git a/0001-udiskslinuxprovider-Only-update-related-objects-on-u.patch b/0001-udiskslinuxprovider-Only-update-related-objects-on-u.patch new file mode 100644 index 0000000..28d549b --- /dev/null +++ b/0001-udiskslinuxprovider-Only-update-related-objects-on-u.patch @@ -0,0 +1,115 @@ +From ec380135ed8cf57a70501542081dad51d2d11fa8 Mon Sep 17 00:00:00 2001 +From: Tomas Bzatek +Date: Thu, 6 Jan 2022 20:45:45 +0100 +Subject: [PATCH] udiskslinuxprovider: Only update related objects on utab + changes + +Updating all existing block objects on any utab change +was unnecessary and overly expensive. With the UDisksUtabMonitor +providing specific utab entry, update just block objects +with matching device file. + +Note that there is a room for similar optimization in fstab +and crypttab monitoring. +--- + src/udiskslinuxprovider.c | 33 ++++++++++++++++++++++++++------- + 1 file changed, 26 insertions(+), 7 deletions(-) + +diff --git a/src/udiskslinuxprovider.c b/src/udiskslinuxprovider.c +index cfc6a330..4231a33c 100644 +--- a/src/udiskslinuxprovider.c ++++ b/src/udiskslinuxprovider.c +@@ -39,6 +39,7 @@ + #include "udisksmoduleobject.h" + #include "udisksdaemonutil.h" + #include "udisksconfigmanager.h" ++#include "udisksutabentry.h" + + /** + * SECTION:udiskslinuxprovider +@@ -1559,7 +1560,7 @@ on_housekeeping_timeout (gpointer user_data) + /* ---------------------------------------------------------------------------------------------------- */ + + static void +-update_all_block_objects (UDisksLinuxProvider *provider) ++update_block_objects (UDisksLinuxProvider *provider, const gchar *device_path) + { + GList *objects; + GList *l; +@@ -1572,18 +1573,36 @@ update_all_block_objects (UDisksLinuxProvider *provider) + for (l = objects; l != NULL; l = l->next) + { + UDisksLinuxBlockObject *object = UDISKS_LINUX_BLOCK_OBJECT (l->data); +- udisks_linux_block_object_uevent (object, "change", NULL); ++ ++ if (device_path == NULL) ++ udisks_linux_block_object_uevent (object, "change", NULL); ++ else ++ { ++ gchar *block_dev; ++ gboolean match; ++ ++ block_dev = udisks_linux_block_object_get_device_file (object); ++ match = g_strcmp0 (block_dev, device_path) == 0; ++ g_free (block_dev); ++ if (match) ++ { ++ udisks_linux_block_object_uevent (object, "change", NULL); ++ break; ++ } ++ } + } + + g_list_free_full (objects, g_object_unref); + } + ++/* fstab monitoring */ + static void + mount_monitor_on_mountpoints_changed (GUnixMountMonitor *monitor, + gpointer user_data) + { + UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data); +- update_all_block_objects (provider); ++ /* TODO: compare differences and only update relevant objects */ ++ update_block_objects (provider, NULL); + } + + static void +@@ -1592,7 +1611,7 @@ crypttab_monitor_on_entry_added (UDisksCrypttabMonitor *monitor, + gpointer user_data) + { + UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data); +- update_all_block_objects (provider); ++ update_block_objects (provider, NULL); + } + + static void +@@ -1601,7 +1620,7 @@ crypttab_monitor_on_entry_removed (UDisksCrypttabMonitor *monitor, + gpointer user_data) + { + UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data); +- update_all_block_objects (provider); ++ update_block_objects (provider, NULL); + } + + #ifdef HAVE_LIBMOUNT_UTAB +@@ -1611,7 +1630,7 @@ utab_monitor_on_entry_added (UDisksUtabMonitor *monitor, + gpointer user_data) + { + UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data); +- update_all_block_objects (provider); ++ update_block_objects (provider, udisks_utab_entry_get_source (entry)); + } + + static void +@@ -1620,6 +1639,6 @@ utab_monitor_on_entry_removed (UDisksUtabMonitor *monitor, + gpointer user_data) + { + UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data); +- update_all_block_objects (provider); ++ update_block_objects (provider, udisks_utab_entry_get_source (entry)); + } + #endif +-- +2.38.1 + diff --git a/harden_udisks2-zram-setup@.service.patch b/harden_udisks2-zram-setup@.service.patch new file mode 100644 index 0000000..7eaa59f --- /dev/null +++ b/harden_udisks2-zram-setup@.service.patch @@ -0,0 +1,16 @@ +Index: udisks-2.9.4/modules/zram/data/udisks2-zram-setup@.service.in +=================================================================== +--- udisks-2.9.4.orig/modules/zram/data/udisks2-zram-setup@.service.in ++++ udisks-2.9.4/modules/zram/data/udisks2-zram-setup@.service.in +@@ -5,6 +5,11 @@ After=dev-%i.device + Requires=dev-%i.device + + [Service] ++# added automatically, for details please see ++# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort ++ProtectHostname=true ++RestrictRealtime=true ++# end of automatic additions + Type=oneshot + RemainAfterExit=no + EnvironmentFile=-@zramconfdir@/%i diff --git a/harden_udisks2.service.patch b/harden_udisks2.service.patch new file mode 100644 index 0000000..e944b07 --- /dev/null +++ b/harden_udisks2.service.patch @@ -0,0 +1,16 @@ +Index: udisks-2.9.4/data/udisks2.service.in +=================================================================== +--- udisks-2.9.4.orig/data/udisks2.service.in ++++ udisks-2.9.4/data/udisks2.service.in +@@ -3,6 +3,11 @@ Description=Disk Manager + Documentation=man:udisks(8) + + [Service] ++# added automatically, for details please see ++# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort ++ProtectHostname=true ++RestrictRealtime=true ++# end of automatic additions + Type=dbus + BusName=org.freedesktop.UDisks2 + ExecStart=@udisksdprivdir@/udisksd diff --git a/udisks-2.9.4.tar.bz2 b/udisks-2.9.4.tar.bz2 new file mode 100644 index 0000000..89f6128 --- /dev/null +++ b/udisks-2.9.4.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b6b60ebab0d5e09624120c5d158882e87d8c2473db60783b63deeba74cb18d1c +size 1699288 diff --git a/udisks2.changes b/udisks2.changes new file mode 100644 index 0000000..c9a4459 --- /dev/null +++ b/udisks2.changes @@ -0,0 +1,937 @@ +------------------------------------------------------------------- +Tue Nov 22 08:21:22 UTC 2022 - Thomas Blume + +- avoid wakening spun-down disks on unrelated events (bsc#1120608) + * add: + 0001-udisksata-Move-the-low-level-PM-state-call.patch + 0001-udiskslinuxfilesystem-Make-the-size-property-retriev.patch + 0001-udiskslinuxprovider-Only-update-related-objects-on-u.patch + +------------------------------------------------------------------- +Wed Nov 16 08:14:50 UTC 2022 - Thomas Blume + +- fix crash during shutdown (bsc#1205371) + * add: + 0001-udiskslinuxmountoptions-Do-not-free-static-daemon-re.patch + +------------------------------------------------------------------- +Fri May 20 07:45:36 UTC 2022 - Johannes Segitz + +- Added hardening to systemd service(s) (bsc#1181400). Added patch(es): + * harden_udisks2-zram-setup@.service.patch + * harden_udisks2.service.patch + +------------------------------------------------------------------- +Mon Jan 31 15:28:11 UTC 2022 - Bjørn Lie + +- Drop gtk-doc BuildRequires, and pass disable-gtk-doc to + configure, the included gtk-docs are fine, we do not need to + build them ourselves. + +------------------------------------------------------------------- +Thu Jan 27 08:00:22 UTC 2022 - Bjørn Lie + +- Stop packaging libudisks_vdo standalone module, it is deprecated. + Do this via passing explicit disable-vdo to configure and + dropping libblockdev-vdo-devel BuildRequires. Add a + libudisks2_0_vdo Obsoletes to ease updates. +- No longer remove upstream config files, we want to be able to + load modules on demand. Note that we move an example file to docs + to keep sysconfdir clean of non-conf files. +- Add a default_luks_encryption define, and set it to luks2, sed + this macro into source, future versions of udisks will not need + this, as upstream moves to luks2 by default. +- Ghost a dir/file created by us. +- Split out API docs into separate docs sub-package. + +------------------------------------------------------------------- +Wed Nov 17 18:30:14 UTC 2021 - Luciano Santos + +- Update to version 2.9.4: + + Many fixes, improvements, and additions to the code. + + Mount options: + - Always use errors=remount-ro for ext filesystems; + - Add ntfs3 kernel driver options. + + Build: Remove warnings unknown to clang. + + Tests: Adapt to clang differences when causing a segfault. + +- Changes from version 2.9.3: + + Many fixes, improvements, and additions to the code and test. +- Add "%tmpfiles_create %{_tmpfilesdir}/udisks2.conf" call in %post + section to make sure /run/media will be created right after the + instalation of udisks2. + +------------------------------------------------------------------- +Fri Feb 12 00:00:13 UTC 2021 - Dirk Müller + +- update to 2.9.2: + * udiskslinuxblock: Survive a missing /etc/crypttab + * lvm2: Fix leaking BDLVMVDOPooldata + * tests: Test modules that are actually enabled during build + * build: Exclude VDO module from distcheck build + * udisksfstabentry: Add udisks_fstab_entry_has_opt() + * udiskslinuxblock: Reflect fstab "noauto" mount option in + HintAuto + * udiskslinuxblock: Update hints after fstab change + * tests: Add tests for Block hints + * udiskslinuxfilesystemhelpers: Make TakeOwnership() race free + * tests: Extend filesystem test_take_ownership tests with + symlinks + * mount options: Allow 'nosymfollow' mount option for + unprivileged mounts + * udisksstate: Silence the block device busy messages on cleanup + lock + * udev: Distinguish mmcblk-class device types + * udev: Propagate mmcblk disk attributes to mmcblk_boot devices + * udiskslinuxdrive: Tweak the 'removable'/'ejectable' hints for + mmcblk-class devices + * udiskslinuxblock: Tweak the hints for mmcblk-class devices + * udisksdaemonutil: Refactor udisks_daemon_util_trigger_uevent() + out of UDisksLinuxBlockObject + * udiskslinuxmanager: Trigger uevent after loop device setup + * tests: Remove scsi_debug serial number checks + * tests: Skip zram tests if zram module is already loaded + * treewide: Fix typos + * AUTHORS: Add tbzatek as the maintainer + * tests: Do not use nilfs2 as an example of non-resizable FS + * Memory leak fixes + * doc: Update config file path +- Drop udisks2-Fix-memory-leaks.patch, and + udisks2-lvm2-Fix-leaking-BDLVMVDOPooldata.patch (upstream). + +------------------------------------------------------------------- +Sat Dec 19 16:16:59 UTC 2020 - Bjørn Lie + +- Add upstream bugfix patches: + + udisks2-Fix-memory-leaks.patch + + udisks2-lvm2-Fix-leaking-BDLVMVDOPooldata.patch + +------------------------------------------------------------------- +Sun Sep 6 07:24:30 UTC 2020 - Milan Savić + +- Update to version 2.9.1: + + This is mostly a bugfix release, notable changes include: + - active modules are now tracked in a daemon state file and + are automatically reloaded on next startup in case of + previous unclean daemon shutdown + - further improvements in object property updates while + handling method calls + - zram module fixes: + + compatibility improvements with existing zram generators + and toolkits + + the zram-setup@.service systemd unit has been renamed to + udisks2-zram-setup@.service + + related udev rules have been separated into + 90-udisks2-zram.rules + + the zram.conf.d path is now configurable and defaults to + /usr/lib/zram.conf.d + +- Update to version 2.9.0: + + This 2.9.0 release brings many changes to the daemon core, + internal modularity and the libudisks2 library. + No public API has been removed, there is a couple of + deprecations however. + + There's a major change in how and when D-Bus object properties + are updated. As a general rule when a method call returns + affected objects should now have their properties updated by + that moment. This is an ongoing task and while majority of the + daemon API has been covered, there are pending issues in some + of the modules. + + Configurable mount options is a new big feature for this + release, allowing sysadmins to re-define default mount options + for each filesystem type. Extensive documentation is available + at http://storaged.org/doc/udisks2-api/latest/mount_options.html + + Internal module API has been reworked, modules should now be + enabled separately via the new EnableModule() call that also + reports initialization failures. + The old org.freedesktop.UDisks2.Manager.EnableModules() call + has been deprecated. + + Additional feature highlights: + - building the daemon can now be disabled via configure switch, + only libudisks2 will be built + - removed the systemd mount cleanup service, mount state is now + tracked separately for persistent and non-persistent mount + points and cleanup of lingering persistent mount points is + performed on daemon startup (e.g. on system boot) + - new LVM-VDO integration, deprecated the standalone VDO module + - added support for (un)locking BitLocker devices + - libudisks2 now includes generated GDBus code for compiled-in + modules, separate pkg-config files are provided as well + +------------------------------------------------------------------- +Thu Nov 14 18:35:03 UTC 2019 - Bjørn Lie + +- Update to version 2.8.4: + + This udisks-2.8.4 release brings couple of bugfixes, docs and + test fixes and translation updates. With ongoing focus on + development towards udisks-2.9.0, this is just a small + maintenance release. + +------------------------------------------------------------------- +Thu Sep 19 12:14:12 UTC 2019 - Ludwig Nussel + +- Do not recommend lang package. The lang package already has a + supplements. + +------------------------------------------------------------------- +Tue Jul 9 09:26:58 UTC 2019 - Thomas Blume + +- don't call systemd uninstall macro for clean-mount-point@.service + template (boo#1139996) + +------------------------------------------------------------------- +Thu Jun 13 18:06:34 UTC 2019 - Bjørn Lie + +- Update to version 2.8.3: + + This release brings many memory leak fixes with similar work + done in libblockdev-2.22. While libblockdev version requirement + remains unchanged, it's strongly recommended to use both + releases together to get full coverage of the fixes. + + Other notable changes include: + - Default and supported encryption types are now exposed on the + org.freedesktop.UDisks2.Manager interface. + - Minor org.freedesktop.UDisks2.Filesystem improvements related + to updating properties upon method call return. + - Various test fixes and improvements. + - Updated translations. + +------------------------------------------------------------------- +Wed Mar 20 13:40:19 CET 2019 - ro@suse.de + +- update to 2.8.2 + + migration from intltool to gettext, udisks no longer depends + on gnome-common + + added 'windows_names' as a default mount option for ntfs-3g + + fixed an issue potentially leading to open filedescriptors + exhaustion +- drop buildreq for intltool + +------------------------------------------------------------------- +Wed Feb 13 17:50:45 UTC 2019 - Jan Engelhardt + +- Generalize VDO description. +- Fix faulty grammar. + +------------------------------------------------------------------- +Tue Feb 12 07:53:01 UTC 2019 - bjorn.lie@gmail.com + +- Add more info to description of vdo. + +------------------------------------------------------------------- +Wed Jan 30 21:34:08 UTC 2019 - bjorn.lie@gmail.com + +- Add libblockdev-vdo-devel BuildRequires: Build the new vdo + module. Following this, add new vdo sub-package. + +------------------------------------------------------------------- +Thu Jan 24 21:17:14 UTC 2019 - bjorn.lie@gmail.com + +- Update to version 2.8.1: + + Mostly bugfixes. +- Changes from version 2.8.0: + + Introduce a new VDO module that is built on top of + libblockdev-vdo. + + General bugfixes. + + Support creating LUKS 2 encrypted devices and other + LUKS-related enhancements. + +------------------------------------------------------------------- +Thu Jan 24 20:55:44 UTC 2019 - bjorn.lie@gmail.com + +- Add explicit libblockdev-lvm-dbus-devel BuildRequires: Previously + pulled in implicitly. + +------------------------------------------------------------------- +Fri Jan 11 11:54:40 UTC 2019 - Dominique Leuenberger + +- Update to version 2.7.8: + + Fix string format vulnerability (CVE-2018-17336) + +------------------------------------------------------------------- +Wed Apr 25 22:59:33 UTC 2018 - luc14n0@linuxmail.org + +- Add missing libblockdev-loop Requires tag: it is needed by + default. + +------------------------------------------------------------------- +Wed Mar 28 02:56:37 UTC 2018 - luc14n0@linuxmail.org + +- Require specific libblockdev plugins in due udisks2's modules, + following libblockdev's plugins split (bsc#1086447). +- Drop redundant libblockdev-devel BuildRequires: it is not needed + once its pkgconfig module is already a requirement. + +------------------------------------------------------------------- +Tue Mar 6 00:34:27 UTC 2018 - luc14n0@linuxmail.org + +- Fix BuildRequires/Requires tags related to libblockdev and + libatasmart dependencies. +- Drop storaged Provides tags since there is no need for them. +- Switch libconfig-devel and libstoragemgmt-devel BuildRequires by + their pkgconfig modules counterparts. +- Add a Recommends tag for the btrfs module to offer support for + the openSUSE's file system of choice by default. + +------------------------------------------------------------------- +Thu Mar 1 14:32:37 UTC 2018 - jengelh@inai.de + +- Rectify grammar issues in summaries + +------------------------------------------------------------------- +Fri Nov 17 02:40:30 UTC 2017 - luc14n0@linuxmail.org + +- Update to version 2.7.6: + + Add: UdisksUtabEntry and read-write lock. + + Fix escaping mountpoint for the cleanup service. + + Check for all LUKS devices when looking for + CryptoBackingDevice. + + First implementation of udisksutabmonitor. + + Invoke job_complete in the proper context in order to avoid + deadlocks. + + Generate autocleanup functions for interfaces. + + Update documentation. +- Changes from version 2.7.5: + + Add: + - 'no-discard' option to formatting methods. + - An assertion method for checking an objects interfaces. + + Fix: + - Possible NULL pointer dereference in: + udiskslinuxdrive.c, udiskslinuxmdraidobject.c and + udisksclient.c + - Resource leak. + - size_str memory leaks in UDisksObjectInfo. + - Copy-paste error in apply_configuration_thread_func from + udiskslinuxdriveata.c. + - "Deadcode" and ignore "check return" warnings in udisksctl.c. + + Resolve mountpoint to the real path. + + Include exFAT as a possible partition type for ID 0x07. + + Always try to read configuration from crypttab in + handle_unlock. + + Make sure the table_type is consistent in + handle_create_partition. + + Wait for device to become initialized before probing it. + + Use different mode/dmode for shared file systems. +- Changes from version 2.7.4: + + Add: New function to set label on swap devices. + + Fix: + - Uninitalized value in "udisks_linux_loop_update"; + - Loop device automounting in GNOME. + + Run cryptsetup before returning from non-blocking Format. + + Use new libblockdev functionality to disable checks during + init. + + Do not try to create file watchers for RAIDs without + redundancy. + + Try to use libblockdev to get RAID array size. + + Re-add support the legacy BIOS bootable GPT flag. +- Changes from version 2.7.3: + + Add: + - Version info to docstrings of the partition Resize function; + - New ResolveDevice function; + - New OpenDevice function; + - some missing functions to doc/udisks2-sections.txt.in.in. + + Fix: + - Wrong GSList pointer declaration in + "handle_get_block_devices"; + - "supports_owners" flag for UDF; + - ExFAT partition type; + - Bash completion for udisksctl; + - Force unmounting; + - Building documentation with new gtk-doc. + + Process partition resize update before return. + + Wait for cleartext device object to disappear on Lock(). + + Ignore Asus Zendisk virtual CDROM and ZFS member partitions. + + Set corrent part type/id and GUID for UDF formatted partitions. + + Use LUKS specific partition ID and GUID. + + Make iSCSI Login and Logout wait for DBus objects update. + + Disable cleaning using blivet for now. + + Start even if a libblockdev plugin fails to load. +- Changes from version 2.7.2: + + Add: + - Filesystem Resize, Check and Repair; + - A new "Partitions" property to "PartitionTable" interface; + - A function to: + . "take ownership" of a filesystem; + . List all block devices. + - A function to wait for an object to disappear. + + Fix: + - Detection of drives created using isohybrid images + (fdo#1437791); + - Setting "SetupByUID" property when adding a new loop device; + - How we create UDF file systems. + + Wait for: + - The bcache object to disappear after BcacheDestroy; + - Zram objects to disappear on DestroyDevices(). + + Resize method for Partition interface. + + Trigger change uevent on disk after adding partitions to it. + + Use the assert with multiple tries for Block.Configuration. + + Do not wait for partitions to appear after LoopSetup. + + Try harder to ignore WD SmartWare virtual CDs. +- Changes from version 2.7.1: + + Don't always fail on missing LibStorageMgmt support. + + Fix: + - Broken partition authorization code; + - How UDisksClient filters property changes; + - The position to wait for a partition to appear at. + + Don't use serial as unique ID for drive objects. + + udiskslinuxblockbcache.c: Fix uninitialized variable. + + udisksiscsiutil.c: Correct strncpy lengths. + + udiskslinuxiscsisessionobject.c: Correct precondition check. + + lsm_linux_drive.c: Remove std_lsm_vol_data_free error case. + + udiskslinuxvolumegroupobject.c: Remove variable shadow lvs_p. + + udiskssimplejob.c: Allow NULL for message. + + Re-create sysfs watchers for changed mdraid devices. + + UDisksClient: Do not try remove changed_blacklist hash table in + finalize. + + Query methods for available utility binaries. + + Clear GError after calling "bd_part_get_part_by_pos". + + Use "model_serial" as unique ID for drive objects. + + Add "--yes" arg when resizing filesystem with "lvresize". + + Do not trigger extra uevents for newly created partitions. + + Free the partition spec libblockdev gives us. + + Allow the user to specify the partition type. +- Changes from version 2.7.0: + + udisksdaemonutil.c: Fix GVariant resource leak. + + Use libblockdev swap plugin for swapspace. + + Use libblockdev FS plugin for mounting and unmounting devices. + + Use libblockdev: + - For: + . Partitioning code; + . Wiping newly created partitions; + . LUKS operations. + - To get LUKS UUID for LUKS open; + - As a library not just the plugins; + - MDRAID code and wipefs calls in MDRAID code. + + Use libblockdev-lvm for: + - LV and VG operations; + - VolumeGroupCreate() too; + - When updating VG on Poll() call. + + Fix: + - bd_reinit and g_clear_error calls in btrfs, zram and bcache; + - Docstring of 'CreateSnapshot' method in '.Filesystem.BTRFS'; + - Requires and BuildRequires for libblockdev; + - API for BcacheCreate function. + + Add: + - Libblockdev MDRAID and FS plugins to BuildRequires; + - 'options' parameter do zRAM 'Refresh' function; + - A function for running threaded jobs synchronously; + - A new configure option --enable-available-modules. + + Remove unused variables in handle_mdraid_create. + + Create Job objects for partitioning related actions. + + Change: + - btrfs module API to be consistent with udisks core; + - bcache properties do CamelCase; + - ZRAM 'CreateDevices' function to return newly created; + - zRAM properties to CamelCase. + + Bcache, btrfs and zRAM modules: Handle invocations in threads. + + Do not try to set GError over the top of a previous GError. + + zRAM: Extract used CompAlgorithm as a single value. + ZRAMs. + + Move new partition start if overlaps with extended partition + metadata. + + Do not start threaded jobs automatically + + Require and initialize the libblockdev-lvm plugin + + Check that blockdev/lvm.h is available if LVM2 support + requested. + + Also create thin pools using libblockdev-lvm. + + Get VGs with bd_lvm_vgs() run in a thread. + + Update information about PVs, LVs and VGs using + libblockdev-lvm. + + Get rid of the udisks-lvm helper program. + + Use: + - Info for metadata LV when updating LV which has one; + - Systemd-defined macros in the spec file template; + - bd_lvm_vgreduce() instead of running 'vgreduce'. + + REMOVE-ME: use the CLI-based libblockdev-lvm plugin. + + Make sure we have the AX_CHECK_ENABLE_DEBUG macro. + + Also check if libblockdev supports bcache. + + Require 'udev' not 'systemd-udev'. +- Adopt the use of %make_build and %make_install while dropping + deprecated use of raw commands, following the best practices. +- Pass disable-static to configure as static libs are enabled by + default. And enable-bcache, enable-btrfs, enable-lsm, + enable-lvm2, enable-lvmcache and enable-zram to enable new + available features. +- Add blkid, blockdev, libsystemd and mount pkgconfig modules, and + libbd_btrfs-devel, libbd_crypto-devel, libbd_fs-devel, + libbd_kbd-devel, libbd_loop-devel, libbd_lvm-devel, + libbd_mdraid-devel, libbd_part-devel, libbd_swap-devel, + libconfig-devel, libstoragemgmt-devel, lvm2-devel BuildRequires + as new dependencies. +- Add libblockdev, libbd_crypto, libbd_fs, libbd_loop, + libbd_mdraid, libbd_part and libbd_swap Requires as new run time + requirements. +- Add e2fsprogs, xfsprogs, and dosfstools Requires, being the first + needed by mkfs.ext3, mkfs.ext3 and e2label. The second, by + mkfs.xfs and xfs_admin. And the third, by mkfs.vfat. +- Add gio-unix-2.0 and gmodule-2.0 pkgconfig BuildRequires: note + that they was already being pulled with pkgconfig(glib-2.0) and + used, once they live in the same devel package. +- Drop pkgconfig(udev) BuildRequires: no longer needed. +- Replace libgudev-1_0-devel and pkgconfig(systemd) BuildRequires + by gudev-1.0 and libsystemd, respectively. +- Add LGPL-2.0+ to the preamble License tag once the preamble + License tag is used for the source RPM and binary RPM packages. +- Correct some subpackages LGPL-2.1+ License tags to LGPL-2.0+ as + pointed by the COPYING and source files. + +------------------------------------------------------------------- +Wed Jul 5 10:03:57 UTC 2017 - Thomas.Blume@suse.com + +- Update to version 2.6.5 (fate#323354) + * switch to new maintained codestream at + https://github.com/storaged-project/udisks + * Detailed changelog in /usr/share/doc/packages/udisks2/NEWS + +------------------------------------------------------------------- +Fri Dec 9 09:44:18 UTC 2016 - dimstar@opensuse.org + +- Update to version 2.1.8: + + Allow NTFS mount option "big_writes". + + Don't coldplug uninitilized udev devices. + + Detect old (non-Pro) MemoryStick cards. + + Lock the partition table while creating a new partition. + + exfat: Drop umask=0077 default. + + udisks2.service: Add KillSignal=SIGINT. + + btrfs: Add support for changing label. + + Updated translations. +- Replace pkgconfig(libsystemd-login) BuildRequires with + pkgconfig(libsystemd): the two have been merged since + systemd 209. +- Drop udisks2-Reread-partition-table-before-wiping.patch: fixed + upstream. + +------------------------------------------------------------------- +Fri Apr 15 14:43:34 UTC 2016 - zaitor@opensuse.org + +- Add udisks2-Reread-partition-table-before-wiping.patch: Reread + partition table before wiping when creating new partitions + (fdo#85477). + +------------------------------------------------------------------- +Fri Mar 4 07:46:25 UTC 2016 - sor.alexei@meowr.ru + +- Update to 2.1.7: + + Allow disabling ACL. + + udisksctl: Properly redirect stdout. + + Catch bogus UUID changes of MDRAIDs. + + Fix udiskctl help for glib 2.45. + + udisks2.service.in: Add [Install] section. + + Fix translator comments in udisksobjectinfo.c. + + integration-test: Explicitly require UDisks 2.0 typelib. + + integration-test: Fix wait_timeout/busy error messages. + + integration-test: PEP-8 fixes. + + integration-test: Fix Polkit.test_removable_fs. + + test_polkitd.py: Fix race condition in waiting for test + polkitd. + + integration-test: Fix race condition in fake CD drive creation. + + integration-test: Add timeout to readd_device(). + + Add support for read look-ahead ATA settings (fdo#92488). +- Add tarball signing. +- Change group to System/Daemons. + +------------------------------------------------------------------- +Thu Jul 9 21:55:49 UTC 2015 - zaitor@opensuse.org + +- Update to version 2.1.6: + + udev rules: Stop hardcoding sed path. + + Fix crash on inaccessible RAID member "state" attribute. + + UDF: Drop umask=0077 default. + + Install udisksd into a libexecdir. + + Fail before formatting if partition contains a partition table. + + Fix udisks_daemon_util_file_set_contents() return value + handling. + + Remove deprecated g_io_scheduler_* calls. + + integration-tests: + - Settle while waiting for property change. + - Don't fail if a SMART test was aborted. + - Add a wrapper to write and flush stderr. + + Don't ignore isohybrid udf filesystems. + + Add support for creating f2fs filesystems. + + Decide whether devices are on the same seat by uid, not pid. + + UDisksSpawnedJob: Retrieve uid/gid info before forking. + +------------------------------------------------------------------- +Fri Mar 6 16:00:45 UTC 2015 - sor.alexei@meowr.ru + +- Update to 2.1.5: + * configure: stop using tmpl files for docs. + * docs: include the annotation glossary. + * Drop default [df]mask for VFAT and NTFS. + * Drop unused goto label. + * Fix crash in udisks_client_finalize(). + * Fix format string signedness warnings. + * integration-tests: Don't assume ordering in mount-points + property. + * integration-test: Skip double mount check for NTFS. + * integration-test: Stop requiring the build dependencies. + * integration-test: Test fstab parsing. + * Make UdisksClient.get_size_for_display() units translatable. + * Provide fallback for systems without ACL support. + * Recognize PARTUUID and PARTLABEL in fstab. + * Support mounting in /media for FHS compatibility. + * Update translations. +- Add recommended /usr/sbin/rcudisks2 service alias. +- Remove obsolete definitions. + +------------------------------------------------------------------- +Fri Dec 19 12:35:16 UTC 2014 - zaitor@opensuse.org + +- Update to version 2.1.4: + + Add GPT partition types from the Discoverable Partitions + Specification. + + Remove newly-added "Auto-enabled swap" GTP partition type. + + Fine-tune GTP partitions some more. + + Send SCSI SYNCHRONIZE CACHE before powering down a drive. + + Fix buffer overflow in pick_word_at(). + + Add Intel Fast Flash Standby partition GPT type. + + Skip password strength checks when changing LUKS passphrase. + + Fix build with clang. + + Revert "Fix standby timers". + + integration-test: + - Update for logind. + - Fix code formatting. + - sync file systems in sync(). + - integration-test: Drop sync_workaround, fix property testing. + - integration-test: Better failure messages. + - integration-test: Fix btrfs test. + + Fix display ID for generic FAT. + + Update obsolete gnome-common and automake macros. + + build: + - Use config-aux/ directory. + - Enable gcc colors. + + Drop obsolete g_type_init(). + + Drop obsolete polkit_unix_process_new(). + + Fix docs for SmartUpdate(). + + Hide Microsoft reserved partition. + + Identify JetFlash Transcend drives as thumb drives. + + Fix sorting of mount points. + + Fix fallback media icons for nonremovable media. + + Fix polkit auth string. + + Hide DIAGS and IntelRST partitions. + + Add a man page for umount.udisks2. + + Support building against libsystemd library. + + udisks: Change name for Intel SW RAID. + + Use internal pm check for smart poll. + + Fix standby timers. + + Fix TOCTOU race when making directories. + + Add missing #include. + + Properly initialize all used variables. + + udiskslinuxmanager.c: Don't use uninitialized wait_data struct. + + Remove useless assignments. + + udisks_linux_drive_object_uevent(): Handle null device. + + Hide Windows Recovery Environment partitions. + + Updated translations. + +------------------------------------------------------------------- +Mon Mar 10 10:03:31 UTC 2014 - pwieczorkiewicz@suse.com + +- Update to version 2.1.3: + + Identify SD Card Reader in ChromeBook Pixel + + Send SCSI START STOP UNIT when powering down a drive + + udisksctl: add power-off verb to power off drives + + udisksctl: fix grammar + + Prefer /dev/VG/LV for LVM2 volumes. + + Fix buffer overflow in mount path parsing. If users have + the possibility to create very long mount points, such as + with FUSE, they could cause udisksd to crash, or even to + run arbitrary code as root with specially crafted mount paths. + (bnc#865854, CVE-2014-0004) + + Use SECTOR_COUNT=1 when issuing ATA IDENTIFY COMMAND + + Use reentrant version of getpwuid() for thread safety + + udisks_daemon_util_get_caller_uid_sync(): Add missing goto + + Fix crash when loop-deleting non-loop device + +------------------------------------------------------------------- +Sun Feb 16 22:27:14 UTC 2014 - zaitor@opensuse.org + +- Update to version 2.1.2: + + Add exfat mount options. + + Hide more rescue partitions. + + Build fails due to missing IT_PROG_INTLTOOL macro (fdo#67679). + + Add exfat FS integration test. + + Drop "david" user name from publish make rules. + + Use dosfstools instead of mtools. + + Add polkit authorization variables for removable media. + + Fix crash when waiting for loop device. +- Drop udisks2-20131026-removable-devices-polkit-auth.patch: fixed + upstream. + +------------------------------------------------------------------- +Tue Dec 10 08:33:56 UTC 2013 - pwieczorkiewicz@suse.com + +- Added udisks2-20131026-removable-devices-polkit-auth.patch. + It adds polkit authorization variables for removable media, which + allow restricting or granting access to removable media based on + its type using polkit authorization rules (fate#312966 fdo#72122). + +------------------------------------------------------------------- +Sun Nov 24 04:06:19 UTC 2013 - crrodriguez@opensuse.org + +- define _udevrulesdir only if not already defined +- run %udev_rules_update, if defined. + +------------------------------------------------------------------- +Wed Aug 21 07:04:30 UTC 2013 - dimstar@opensuse.org + +- Update to version 2.1.1: + + Properly identify firewire devices as non-system devices. + + Identify Lexar Dual Slot USB 3.0 Reader Professional as a card + reader. + + Identify Transcend USB 3.0 Multi-Card reader as such. + + Promote ZFS partition type to generic. + + UDisksClient: Make it possible to get part desc based on the + part table subtype. + + Add ChromeOS partition types. + + Use new SSD icon from g-i-t-e. + + Identify Patriot Memory USB sticks as thumb drives. + + Fix test for logind availability. + + Fix hiding of "WD SmartWare" partitions. + + integration-test: Fix for nonexisting /run/udev/rules.d/. + + integration-test: For VFAT, ignore case for label comparison. + +------------------------------------------------------------------- +Mon Mar 18 08:58:58 UTC 2013 - dimstar@opensuse.org + +- Update to version 2.1.0: + + mdraid: Remove spurious argument for the format. + + Support broken setups where ID_SERIAL is available but + ID_SERIAL_SHORT is not. + + Call the right D-Bus completion routines. + + integration-test: Update for mkntfs. + + Updated translations. + +------------------------------------------------------------------- +Sun Mar 3 23:10:24 UTC 2013 - hrvoje.senjan@gmail.com + +- Update to version 2.0.92: + + Fix out of source build - set xsltproc path. + + Fold UDisksPersistentStore class into UDisksCleanup. + + Rename UDisksCleanup to UDisksState. + + Don't leak UDisksLinuxDevice when handling uevent. + + Check for NULL pointer when creating MD-RAID array. + + Use own udev namespace for MD-RAID properties. + + Introduce UDISKS_FILESYSTEM_SHARED=1 to use /media for + mounting. + + Don't wipe extended partitions. + + Make sure logical partitions stay within the extended + partition. + +------------------------------------------------------------------- +Thu Jan 17 20:49:53 UTC 2013 - dimstar@opensuse.org + +- Update to version 2.0.91: + + Don't bail in MD-RAID file monitor event handler. + + Add MDRaid:RequestSyncAction() method. + + Add MDRaid:SyncRate and MDRaid:SyncRemainingTime properties. + + Get the MD-RAID sync rate from the right file. + + Pull new translations from Transifex. + + Use correct polkit action. + + Fix up comments in polkit policy file. +- Changes from version 2.0.90: + + Initial MD-RAID support. +- Drop fix_polkit_action_name.diff: it's not applied anyway. + +------------------------------------------------------------------- +Thu Jan 17 07:36:09 UTC 2013 - vuntz@opensuse.org + +- Really apply fix_polkit_action_name.diff. + +------------------------------------------------------------------- +Mon Jan 07 13:30:34 UTC 2013 - stefan.bruens@rwth-aachen.de + +- Fix name of polkit action (fdo#58629): + modify-device-system-other-seat -> modify-device-other-seat + +------------------------------------------------------------------- +Sun Jan 6 21:02:27 UTC 2013 - dimstar@opensuse.org + +- Add gptfdisk Requires: sgdisk is called by udisksd to modify the + partition tables (bnc#796853). + +------------------------------------------------------------------- +Mon Nov 12 22:22:01 UTC 2012 - hrvoje.senjan@gmail.com + +- Update to version 2.0.0 + + configure.ac: raise gudev dependency + + Add --disable-man configure option + + Update list of recovery/system partitions + + Add support for creating exFAT filesystems and changing exFAT + labels + + Add textual descriptions for IMSM Raid members + + Use all-caps for RAID + + Only do the isohybrid hack for the first partition + + Don't complain about missing /etc/crypttab file + + Don't complain about missing /etc/fstab file + + Make it work without requiring the kernel to be CONFIG_SWAP=y + + Mention the right file when complaing about /proc/swaps + + Fix glaringly wrong documentation for Filesystem.Mount() + + Move bash completion script into + /usr/share/bash-completion/completions + + Don't require that users define UDISKS_API_IS_SUBJECT_TO_CHANGE + + Remove udisks_daemon_util_on_other_seat() from sections.txt + + Add workaround annotation for + udisks_client_get_block_for_dev() + + Enable large file support + + Various doc and tests fixes + + Bugs fixed: fdo#51063. + + Updated translations. +- Drop systemd-dynamic-check.diff: fixed upstream. +- Dropped gnome-common BuildRequires and call to gnome-autogen.sh, + as the patch which needed that is dropped. + +------------------------------------------------------------------- +Wed Oct 24 12:16:42 UTC 2012 - meissner@suse.com + +- remove the rpmlintrc after adding the privs bnc#779404 + +------------------------------------------------------------------- +Wed Oct 17 13:03:06 UTC 2012 - fcrozat@suse.com + +- Fix build with new udev rules directory location. + +------------------------------------------------------------------- +Tue Sep 25 09:19:57 UTC 2012 - dimstar@opensuse.org + +- Update to version 1.99.0: + + Catch up with latest polkit guidance + + Don't require auth for Standby'ing non-system drives on own + seat + + Mark Realtek rts5229 based card readers as flash drives + + Black-list seemingly invalid WWN for SAMSUNG SP1604N hard disks + + Ignore non-Linux software on SanDisk Cruzer + + Add drive configuration interfaces and configuration files + + Add "Linux Filesystem" GPT partition type + + Add support for VMWare filesystem types and GPT partition types + + Update integration tests. + + Bugs fixed: + - fdo#51439: udisks should hide lvm PVs +- Changes from version 1.98.0: + + Drive: Refuse to eject drives that appear to be in use + + udisksd: work if polkitd is not available + + Updated documentations + + Bugs fixed: + - fdo49842: Unhandled rootfs on bind mount +- Drop udisks-hide-lvm-raid-partitions.patch: fixed upstream. + +------------------------------------------------------------------- +Tue Sep 25 09:14:34 UTC 2012 - vuntz@opensuse.org + +- Update systemd-dynamic-check.diff with patch sent upstream. +- Add gnome-common BuildRequires and call to gnome-autogen.sh, as + needed by the patch now. + +------------------------------------------------------------------- +Tue Jul 3 15:39:33 CEST 2012 - tiwai@suse.de + +- Add systemd-dynamic-check.diff: add a check of running systemd + (bnc#769570) + +------------------------------------------------------------------- +Tue Jun 26 18:18:09 UTC 2012 - gber@opensuse.org + +- Added udisks-hide-lvm-raid-partitions.patch in order to hide + partitions marked as containing LVM and RAID. This is only useful + for encrypted partitions (fixes fdo#51439 and bnc#737038). + +------------------------------------------------------------------- +Fri May 11 14:51:00 UTC 2012 - vuntz@opensuse.org + +- Update to version 1.97.0: + + Several improvements for loop devices + + Also check for "target is busy" when checking umount(8) output + + UDisksCleanup: Remove stale entries when adding new ones + + Add work-around to show FS on CDs/USB sticks created using + isohybrid + + Several code improvements + + Update path to mounted-fs file in documentation +- Changes from version 1.96.0: + + Actually link with libsystemd-login +- Changes from version 1.95.0: + + Add multi-seat support + + Add versioning macros + + Use libacl library instead of setfacl(1) + + Work around missing serial/wwn on VMware hard disks + + Add separate polkit actions for ejecting media + + Make $(udisks2.device) in authentication messages include the + vendor/model + + Remove unused .filesystem-unmount-others-shared polkit action + + Documentation fixes and improvements + + Updated translations +- Add libacl-devel BuildRequires: it's now really used. + +------------------------------------------------------------------- +Wed Apr 11 09:33:59 UTC 2012 - vuntz@opensuse.org + +- Update to version 1.94.0: + + Pass --readonly to cryptsetup(8) if device to unlock is + read-only + + Add udev rules for identifying devices which should not be + shown + + Fix unmounting large disks when not asked to + + Make escaping work properly with non-ASCII UTF-8 strings + + Change some D-Bus types from bytestring ('ay') to UTF8 ('s') + + Convert some g_warning() uses to udisks_warning() + + Improved documentation. + +------------------------------------------------------------------- +Tue Mar 6 09:00:40 UTC 2012 - vuntz@opensuse.org + +- Update to version 1.93.0: + + Force MediaRemovable to TRUE for e.g. SD cards using the mmc + layer + + Ensure that whatever we pass as -t to mount(8) is in a + whitelist + + Ensure that the loop file name we pass to the kernel is always + NUL-terminated + + Properly escape all device files + + Improved documentation. +- Remove libacl-devel BuildRequires: not needed anymore. + +------------------------------------------------------------------- +Mon Feb 27 12:57:10 UTC 2012 - vuntz@opensuse.org + +- Update to version 1.92.0: + + client: Fix bit shifts of flags on 32 bit + + Avoid using $XDG_RUNTIME_DIR/media for now + + Don't free object twice when deleting a loop device + + Use /run/media/$USER for mounting + + Move to /usr-only setup and get rid of hardcoded paths to /lib + and sbin +- Changes from version 1.91.0: + + Install a systemd service file if systemd is used + + Ensure PATH is set + + Fix use of memset(3) + + Use org.freedesktop.UDisks2.* for errors, not + org.freedesktop.UDisks.* + + For mount options, switch from comment=udisks to x-udisks + + Prefer mounting in /run/user/$USER/media instead of /media + + With /media and /run on tmfs, switch to temporary store for + mounted-fs + + Make sure that Drive:SortKey sorts e.g. sdz before sdaa + + Do coldplug for block devices twice + + Use g_dbus_interface_dup_object() and check return value + + Shut up valgrind complaing about LOOP_GET_STATUS64 ioctl + + Fix a couple of uninitialized warnings and simplify SMART + self-test handling + + udisksctl: + - nuke PORT column in output of 'status' verb + - sort the drives using Drive:SortKey for 'status' verb + + Documentation fixes. + + Build fixes. + + Updated translations. +- Add systemd-related packaging: + + Add pkgconfig(systemd) BuildRequires. + + Use %{?systemd_requires}. + + Call %service_{add,del}_* macros in scriptlets for + udisks2.service. +- Add pkgconfig(udev) BuildRequires, now needed to find right path + for udev files. +- Add libacl-devel BuildRequires, now needed. + +------------------------------------------------------------------- +Sat Jan 21 10:02:13 UTC 2012 - vuntz@opensuse.org + +- New udisks2 source package, based on udisks source package. +- First version (1.90.0). +- udisks 2.x is parallel-installable with udisks 1.x. + diff --git a/udisks2.spec b/udisks2.spec new file mode 100644 index 0000000..d00cfbf --- /dev/null +++ b/udisks2.spec @@ -0,0 +1,360 @@ +# +# spec file for package udisks2 +# +# Copyright (c) 2022 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define somajor 0 +%define libudisks lib%{name}-%{somajor} +%define libblockdev_version 2.19 +# valid options are 'luks1' or 'luks2' - Note, remove this and the sed call, as upstream moves to luks2 as default +%define default_luks_encryption luks2 + +Name: udisks2 +Version: 2.9.4 +Release: 0 +Summary: Disk Manager +License: GPL-2.0-or-later AND LGPL-2.0-or-later +Group: System/Daemons +URL: https://github.com/storaged-project/udisks +Source0: %{url}/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2 +Patch0: harden_udisks2-zram-setup@.service.patch +Patch1: harden_udisks2.service.patch +Patch2: 0001-udiskslinuxmountoptions-Do-not-free-static-daemon-re.patch +Patch3: 0001-udisksata-Move-the-low-level-PM-state-call.patch +Patch4: 0001-udiskslinuxfilesystem-Make-the-size-property-retriev.patch +Patch5: 0001-udiskslinuxprovider-Only-update-related-objects-on-u.patch +BuildRequires: chrpath +BuildRequires: docbook-xsl-stylesheets +BuildRequires: gobject-introspection-devel >= 0.6.2 +BuildRequires: libacl-devel +BuildRequires: libblockdev-btrfs-devel >= %{libblockdev_version} +BuildRequires: libblockdev-crypto-devel >= %{libblockdev_version} +BuildRequires: libblockdev-fs-devel >= %{libblockdev_version} +BuildRequires: libblockdev-kbd-devel >= %{libblockdev_version} +BuildRequires: libblockdev-loop-devel >= %{libblockdev_version} +BuildRequires: libblockdev-lvm-dbus-devel >= %{libblockdev_version} +BuildRequires: libblockdev-lvm-devel >= %{libblockdev_version} +BuildRequires: libblockdev-mdraid-devel >= %{libblockdev_version} +BuildRequires: libblockdev-part-devel >= %{libblockdev_version} +BuildRequires: libblockdev-swap-devel >= %{libblockdev_version} +BuildRequires: lvm2-devel +BuildRequires: pkgconfig +BuildRequires: xsltproc +BuildRequires: pkgconfig(blkid) >= 2.17.0 +BuildRequires: pkgconfig(blockdev) >= 2.19 +BuildRequires: pkgconfig(gio-unix-2.0) >= 2.50 +BuildRequires: pkgconfig(glib-2.0) >= 2.50 +BuildRequires: pkgconfig(gmodule-2.0) +BuildRequires: pkgconfig(gudev-1.0) >= 165 +BuildRequires: pkgconfig(libatasmart) >= 0.17 +BuildRequires: pkgconfig(libconfig) >= 1.3.2 +BuildRequires: pkgconfig(libstoragemgmt) >= 1.3.0 +BuildRequires: pkgconfig(libsystemd) >= 209 +BuildRequires: pkgconfig(mount) >= 2.30 +BuildRequires: pkgconfig(polkit-agent-1) >= 0.102 +BuildRequires: pkgconfig(polkit-gobject-1) >= 0.102 +BuildRequires: pkgconfig(systemd) +BuildRequires: pkgconfig(udev) +BuildRequires: pkgconfig(uuid) +Requires: %{libudisks} = %{version} +# For LUKS devices +Requires: cryptsetup +# Needed to pull in the system bus daemon +Requires: dbus-1 >= 1.4.0 +# For mkfs.vfat +Requires: dosfstools +# For mkfs.ext3, mkfs.ext3, e2label +Requires: e2fsprogs +# For ejecting removable disks +Requires: eject +# sgdisk is called by udisksd to modify the partition tables... thus a needed tool. +Requires: gptfdisk +# We need at least this version for bugfixes/features etc. +Requires: libatasmart-utils >= 0.17 +Requires: libblockdev >= %{libblockdev_version} +Requires: libblockdev-crypto >= %{libblockdev_version} +Requires: libblockdev-fs >= %{libblockdev_version} +Requires: libblockdev-loop >= %{libblockdev_version} +Requires: libblockdev-mdraid >= %{libblockdev_version} +Requires: libblockdev-part >= %{libblockdev_version} +Requires: libblockdev-swap >= %{libblockdev_version} +# Needed to pull in the udev daemon +Requires: udev >= 208 +# For mount, umount, mkswap +Requires: util-linux +# For mkfs.xfs, xfs_admin +Requires: xfsprogs +Recommends: %{libudisks}_btrfs +# Add Obsoletes to ease removal of deprecated standalone vdo module +Obsoletes: libudisks2-0_vdo <= 2.9.4 +%{?systemd_requires} +# Upstream First - Policy: +# Never add any patches to this package without the upstream commit id +# in the patch. Any patches added here without a very good reason to make +# an exception will be silently removed with the next version update. + +%description +The Udisks project provides a daemon, tools and libraries to access and +manipulate disks, storage devices and technologies. + +%package -n %{libudisks} +Summary: Dynamic library to access the UDisksd daemon +License: LGPL-2.0-or-later +Group: System/Libraries + +%description -n %{libudisks} +This package contains the dynamic library, which provides +access to the UDisksd daemon. + +%package -n typelib-1_0-UDisks-2_0 +Summary: Introspection bindings for the UDisks Client Library version 2 +License: LGPL-2.0-or-later +Group: System/Libraries + +%description -n typelib-1_0-UDisks-2_0 +UDisks provides a daemon, D-Bus API and command line tools +for managing disks and storage devices. + +This package provides the GObject Introspection bindings for +the UDisks client library. + +%package -n %{libudisks}-devel +Summary: Development files for UDisks +License: LGPL-2.0-or-later +Group: Development/Libraries/C and C++ +Requires: %{libudisks} >= %{version} + +%description -n %{libudisks}-devel +This package contains the development files for the library libUDisks2, a +dynamic library, which provides access to the UDisksd daemon. + +%package docs +Summary: Developer documentation for %{name} +BuildArch: noarch + +%description docs +This package contains developer documentation for %{name}. + +%package -n %{libudisks}_bcache +Summary: UDisks module for Bcache +License: GPL-2.0-or-later +Group: System/Libraries +Requires: %{libudisks} >= %{version} +Requires: libblockdev-kbd >= %{libblockdev_version} + +%description -n %{libudisks}_bcache +This package contains the UDisks module for bcache support. + +%package -n %{libudisks}_btrfs +Summary: UDisks module for btrfs +License: GPL-2.0-or-later +Group: System/Libraries +Requires: %{libudisks} >= %{version} +Requires: libblockdev-btrfs >= %{libblockdev_version} + +%description -n %{libudisks}_btrfs +This package contains the UDisks module for btrfs support. + +%package -n %{libudisks}_lsm +Summary: UDisks module for LSM +License: GPL-2.0-or-later +Group: System/Libraries +Requires: %{libudisks} >= %{version} +Requires: libstoragemgmt >= 1.3.0 + +%description -n %{libudisks}_lsm +This package contains the UDisks module for LSM support. + +%package -n %{libudisks}_lvm2 +Summary: UDisks module for LVM2 +License: GPL-2.0-or-later +Group: System/Libraries +Requires: %{libudisks} >= %{version} +Requires: libblockdev-lvm >= %{libblockdev_version} +Requires: lvm2 + +%description -n %{libudisks}_lvm2 +This package contains the UDisks module for LVM2 support. + +%package -n %{libudisks}_zram +Summary: UDisks module for Zram +License: GPL-2.0-or-later +Group: System/Libraries +Requires: %{libudisks} = %{version} +Requires: libblockdev-kbd >= %{libblockdev_version} +Requires: libblockdev-swap >= %{libblockdev_version} + +%description -n %{libudisks}_zram +This package contains the UDisks module for zram support. + +%lang_package + +%prep +%autosetup -p1 -n udisks-%{version} +# Move to luks2 as default +sed -i udisks/udisks2.conf.in -e "s/encryption=luks1/encryption=%{default_luks_encryption}/" + +%build +%configure \ + --disable-static \ + --disable-gtk-doc \ + --docdir=%{_docdir}/%{name} \ + --enable-bcache \ + --enable-btrfs \ + --enable-lsm \ + --enable-lvm2 \ + --enable-lvmcache \ + --enable-zram \ + --disable-vdo \ + %{nil} +%make_build + +%install +%make_install +find %{buildroot} -name "*.la" -print -type f -delete +chrpath --delete %{buildroot}/%{_sbindir}/umount.udisks2 +chrpath --delete %{buildroot}/%{_bindir}/udisksctl +chrpath --delete %{buildroot}/%{_libexecdir}/udisks2/udisksd +%find_lang udisks2 + +# Create udisks2 rclink +mkdir -p %{buildroot}/%{_sbindir} +ln -sf %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name} + +# Move example config file to docs +mkdir -p %{buildroot}%{_docdir}/%{name} +mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example %{buildroot}%{_docdir}/%{name}/mount_options.conf.example + +%post -n %{libudisks} -p /sbin/ldconfig +%postun -n %{libudisks} -p /sbin/ldconfig + +%pre -n %{name} +%service_add_pre udisks2.service + +%post -n %{name} +%{?udev_rules_update:%udev_rules_update} +%service_add_post udisks2.service +%tmpfiles_create %{_tmpfilesdir}/udisks2.conf + +%preun -n %{name} +%service_del_preun udisks2.service + +%postun -n %{name} +%service_del_postun udisks2.service + +%pre -n %{libudisks}_zram +%service_add_pre udisks2-zram-setup@.service + +%post -n %{libudisks}_zram +%service_add_post udisks2-zram-setup@.service + +%preun -n %{libudisks}_zram +%service_del_preun udisks2-zram-setup@.service + +%postun -n %{libudisks}_zram +%service_del_postun udisks2-zram-setup@.service + +%files +%doc AUTHORS NEWS +%{_bindir}/udisksctl +%{_datadir}/dbus-1/system.d/org.freedesktop.UDisks2.conf +%dir %{_sysconfdir}/udisks2 +%dir %{_sysconfdir}/udisks2/modules.conf.d +%config %{_sysconfdir}/udisks2/udisks2.conf +%doc %{_docdir}/%{name}/mount_options.conf.example +%{_tmpfilesdir}/udisks2.conf +%ghost %{_rundir}/media +%{_datadir}/bash-completion/completions/udisksctl +%{_unitdir}/udisks2.service +%dir %{_udevrulesdir} +%{_udevrulesdir}/80-udisks2.rules +%{_udevrulesdir}/90-udisks2-zram.rules +%{_sbindir}/rc%{name} +%{_sbindir}/umount.udisks2 +%dir %{_libexecdir}/udisks2 +%{_libexecdir}/udisks2/udisksd +%{_mandir}/man1/udisksctl.1%{?ext_man} +%{_mandir}/man5/udisks2.conf.5%{?ext_man} +%{_mandir}/man8/udisksd.8%{?ext_man} +%{_mandir}/man8/udisks.8%{?ext_man} +%{_mandir}/man8/umount.udisks2.8%{?ext_man} +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.policy +%{_datadir}/dbus-1/system-services/org.freedesktop.UDisks2.service +# Permissions for local state data are 0700 to avoid leaking information +# about e.g. mounts to unprivileged users +%attr(0700,root,root) %dir %{_localstatedir}/lib/udisks2 + +%files -n %{libudisks} +%license COPYING +%{_libdir}/libudisks2.so.* + +%files -n typelib-1_0-UDisks-2_0 +%{_libdir}/girepository-1.0/UDisks-2.0.typelib + +%files -n %{libudisks}-devel +%doc HACKING README.md +%{_libdir}/libudisks2.so +%dir %{_includedir}/udisks2 +%dir %{_includedir}/udisks2/udisks +%{_includedir}/udisks2/udisks/*.h +%{_libdir}/pkgconfig/udisks2.pc +%{_libdir}/pkgconfig/udisks2-bcache.pc +%{_libdir}/pkgconfig/udisks2-btrfs.pc +%{_libdir}/pkgconfig/udisks2-lsm.pc +%{_libdir}/pkgconfig/udisks2-lvm2.pc +%{_libdir}/pkgconfig/udisks2-zram.pc +%{_datadir}/gir-1.0/UDisks-2.0.gir + +%files docs +%doc %{_datadir}/gtk-doc/html/udisks2/ + +%files -n %{libudisks}_bcache +%dir %{_libdir}/udisks2 +%dir %{_libdir}/udisks2/modules +%{_libdir}/udisks2/modules/libudisks2_bcache.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.bcache.policy + +%files -n %{libudisks}_btrfs +%dir %{_libdir}/udisks2 +%dir %{_libdir}/udisks2/modules +%{_libdir}/udisks2/modules/libudisks2_btrfs.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.btrfs.policy + +%files -n %{libudisks}_lsm +%dir %{_sysconfdir}/udisks2/modules.conf.d +%attr(0600,root,root) %config %{_sysconfdir}/udisks2/modules.conf.d/udisks2_lsm.conf +%dir %{_libdir}/udisks2 +%dir %{_libdir}/udisks2/modules +%{_libdir}/udisks2/modules/libudisks2_lsm.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.lsm.policy +%{_mandir}/man5/udisks2_lsm.conf.5%{?ext_man} + +%files -n %{libudisks}_lvm2 +%dir %{_libdir}/udisks2 +%dir %{_libdir}/udisks2/modules +%{_libdir}/udisks2/modules/libudisks2_lvm2.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.lvm2.policy + +%files -n %{libudisks}_zram +%dir %{_libdir}/udisks2 +%dir %{_libdir}/udisks2/modules +%{_libdir}/udisks2/modules/libudisks2_zram.so +%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.zram.policy +%{_unitdir}/udisks2-zram-setup@.service + +%files lang -f udisks2.lang + +%changelog