SHA256
1
0
forked from pool/ldmtool

3 Commits

Author SHA256 Message Date
6b2d730cda Accepting request 1288590 from Virtualization
Update ldmtool to version 0.2.5 with additional upstream fixes

OBS-URL: https://build.opensuse.org/request/show/1288590
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ldmtool?expand=0&rev=6
2025-06-26 09:39:50 +00:00
dc138d7031 - Update to version 0.2.5 (jsc#PED-12706)
OBS-URL: https://build.opensuse.org/package/show/Virtualization/ldmtool?expand=0&rev=19
2025-06-25 17:28:04 +00:00
85304c7a38 - Update to version 0.2.5
* Fix crash while creating mapper for a volume which lacks of
    partitions
  * Make libldm to parse and return volume GUID
  * Change the way we sanitise LDM partition name
  * Set UUID for device mapper devices (partitions and volumes)
  * Fix potential memory leak
  * Use device mapper device UUID instead of name to find device in
    a tree
  * New API: ldm_volume_dm_get_device
  * New API: ldm_partition_dm_get_device
  * Fix bug in libldm to allow for all spanned LDM volumes to bex
    correctly identified/mounted
- Upstream fixes post 0.2.5
  001-Add-example-systemd-unit-file.patch
  002-ldmtool-fix-NULL-pointer-dereference.patch
  003-Add-ability-to-override-device-mapper-UUID.patch
  004-src-Fix-declaration-of-ldm_new.patch
  005-Update-gtkdocize.patch
- Drop patch contained in new tarball
  Remove-deprecated-g_type_class_add_private.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/ldmtool?expand=0&rev=18
2025-06-25 17:21:38 +00:00
10 changed files with 668 additions and 228 deletions

View File

@@ -0,0 +1,59 @@
Subject: Add example systemd unit file.
From: Richard W.M. Jones rjones@redhat.com Mon Mar 22 10:10:56 2021 +0000
Date: Wed Mar 24 10:19:13 2021 +0000:
Git: 5014da5b90713123157b2604ac566514682e7f37
See also:
https://github.com/mdbooth/libldm/issues/20
diff --git a/.gitignore b/.gitignore
index 4d3a17c..d999470 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@
/config.status
/configure
/ldm-1.0.pc
+/ldm.service
/libldm-*/
/libldm-*.tar.gz
/libtool
diff --git a/Makefile.am b/Makefile.am
index 646cf90..f0a4ab9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,4 +23,6 @@ SUBDIRS = src test docs/reference/libldm docs/reference/ldmtool
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = ldm-1.0.pc
+noinst_DATA = ldm.service
+
EXTRA_DIST = libldm.spec COPYING.lgpl COPYING.gpl
diff --git a/configure.ac b/configure.ac
index db4bbab..b5ba481 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,4 +119,5 @@ AC_CONFIG_FILES([docs/reference/libldm/Makefile])
AC_CONFIG_FILES([docs/reference/ldmtool/Makefile])
AC_CONFIG_FILES([ldm-1.0.pc])
AC_CONFIG_FILES([libldm.spec])
+AC_CONFIG_FILES([ldm.service])
AC_OUTPUT
diff --git a/ldm.service.in b/ldm.service.in
new file mode 100644
index 0000000..cd586ff
--- /dev/null
+++ b/ldm.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Activate Windows Logical Disk Manager volumes
+Documentation=man:ldmtool(1)
+
+[Service]
+ExecStart=@bindir@/ldmtool create all
+ExecStop=@bindir@/ldmtool remove all
+Type=oneshot
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target

View File

@@ -0,0 +1,41 @@
Subject: ldmtool: fix NULL pointer dereference
From: Vincent Mailhol mailhol.vincent@wanadoo.fr Tue Jun 20 17:00:24 2023 +0900
Date: Tue Jun 20 10:21:16 2023 +0100:
Git: 674da9bd4f482cd5e07e3f8f4b648d366b2c23bb
If /sys/block can not be opened, get_devices() returns NULL.
cmdline() does not check this result and below code snippet:
scanned = get_devices();
devices = (gchar **) scanned->data;
results in a segmentation fault.
Add a check on scanned.
Relevant logs:
Unable to open /sys/block: No such file or directory
[ 0.777352] ldmtool[164]: segfault at 0 ip 0000563a225cd6a5 sp 00007ffe54965a60 error 4 in ldmtool[563a225cb000+3000]
[ 0.778278] Code: 18 64 48 33 1c 25 28 00 00 00 75 5e 48 83 c4 28 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 2e 0f 1f 84 00 00 00 00 00 e8 db fd ff ff <4c> 8b 20 48 89 44 24 08 4c 89 e7 e8 0b e1 ff ff 45 31 c0 4c 89 e1
Fixes: 25d9635e4ee5 ("Add ldmtool")
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
See: https://listman.redhat.com/archives/libguestfs/2023-June/031841.html
diff --git a/src/ldmtool.c b/src/ldmtool.c
index 6957c1a..dbe2c8c 100644
--- a/src/ldmtool.c
+++ b/src/ldmtool.c
@@ -746,6 +746,8 @@ cmdline(LDM * const ldm, gchar **devices,
GArray * scanned = NULL;
if (!devices) {
scanned = get_devices();
+ if (!scanned)
+ return FALSE;
devices = (gchar **) scanned->data;
}

View File

@@ -0,0 +1,395 @@
From 8023f57e851d6ef42368fa8f5e1f95f40adec57a Mon Sep 17 00:00:00 2001
From: Takeshi Suzuki <takeshi.suzuki@rubrik.com>
Date: Thu, 30 May 2024 01:25:39 +0000
Subject: [PATCH 3/5] Add ability to override device mapper UUID
---
docs/reference/ldmtool/ldmtool.xml | 13 ++++-
src/Makefile.am | 2 +-
src/ldm.c | 17 +++++-
src/ldm.h | 16 +++++-
src/ldmtool.c | 91 +++++++++++++++++++++---------
test/Makefile.am | 2 +-
6 files changed, 108 insertions(+), 33 deletions(-)
diff --git a/docs/reference/ldmtool/ldmtool.xml b/docs/reference/ldmtool/ldmtool.xml
index 3d1631b..89049c9 100644
--- a/docs/reference/ldmtool/ldmtool.xml
+++ b/docs/reference/ldmtool/ldmtool.xml
@@ -94,6 +94,17 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>--uuid_override</option> <replaceable>uuid</replaceable>
+ </term>
+ <listitem>
+ <para>
+ User specified UUID for use with device mapper. This can only be
+ used in single action mode for a single volume.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
@@ -151,7 +162,7 @@
<refsect2>
<title>Single action mode</title>
-
+
<para>
When invoked to run a single action all block devices will be scanned by
default. In this case, if any block devices are specified with the
diff --git a/src/Makefile.am b/src/Makefile.am
index 06a5d44..2e21b15 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,7 @@ bin_PROGRAMS = ldmtool
ldmtool_CFLAGS = $(AM_CFLAGS) $(GOBJECT_CFLAGS) $(JSON_CFLAGS) \
$(GIO_UNIX_CFLAGS)
ldmtool_LDADD = -lreadline $(builddir)/$(libname) $(GOBJECT_LIBS) \
- $(JSON_LIBS) $(GIO_UNIX_LIBS)
+ $(JSON_LIBS) $(GIO_UNIX_LIBS) $(UUID_LIBS)
# GObject introspection fails. This seems to be because g-ir-scanner incorrectly
# guesses the symbol prefix as 'l_dm', although explicitly passing in the
diff --git a/src/ldm.c b/src/ldm.c
index 4766bb0..47f393f 100644
--- a/src/ldm.c
+++ b/src/ldm.c
@@ -524,6 +524,9 @@ struct _LDMVolumePrivate
_int_volume_type _int_type;
guint32 _n_comps;
guint32 _n_comps_i;
+
+ /* User specified UUID for device mapper */
+ uuid_t uuid_override;
};
G_DEFINE_TYPE_WITH_PRIVATE(LDMVolume, ldm_volume, G_TYPE_OBJECT)
@@ -2441,7 +2444,11 @@ static GString *
_dm_vol_uuid(const LDMVolumePrivate * const vol)
{
char ldm_vol_uuid[37];
- uuid_unparse_lower(vol->guid, ldm_vol_uuid);
+ if (!uuid_is_null(vol->uuid_override)) {
+ uuid_unparse_lower(vol->uuid_override, ldm_vol_uuid);
+ } else {
+ uuid_unparse_lower(vol->guid, ldm_vol_uuid);
+ }
GString * dm_uuid = g_string_new("");
g_string_printf(dm_uuid, "%s%s-%s",
@@ -3154,7 +3161,7 @@ ldm_volume_dm_create(const LDMVolume * const o, GString **created,
}
gboolean r = name != NULL;
-
+
if (created)
*created = name;
else if (name)
@@ -3218,3 +3225,9 @@ out:
return r;
}
+
+void ldm_volume_override_uuid(LDMVolume * const o,
+ const uuid_t uuid_override) {
+ LDMVolumePrivate * const vol = o->priv;
+ uuid_copy(vol->uuid_override, uuid_override);
+}
diff --git a/src/ldm.h b/src/ldm.h
index fd615b4..87fff7b 100644
--- a/src/ldm.h
+++ b/src/ldm.h
@@ -18,6 +18,8 @@
#ifndef LIBLDM_LDM_H__
#define LIBLDM_LDM_H__
+#include <uuid/uuid.h>
+
#include <glib-object.h>
G_BEGIN_DECLS
@@ -259,7 +261,7 @@ LDM *ldm_new();
/**
* ldm_add:
* @o: An #LDM object
- * @path: The path of the device
+ * @path: The path of the device
* @err: A #GError to receive any generated errors
*
* Scan device @path and add its metadata to LDM object @o.
@@ -303,7 +305,7 @@ GArray *ldm_get_disk_groups(LDM *o);
*
* Returns: (element-type LDMVolume)(transfer container):
* An array of volumes
- */
+ */
GArray *ldm_disk_group_get_volumes(LDMDiskGroup *o);
/**
@@ -497,6 +499,16 @@ gboolean ldm_volume_dm_create(const LDMVolume *o, GString **created,
gboolean ldm_volume_dm_remove(const LDMVolume *o, GString **removed,
GError **err);
+/**
+ * ldm_volume_override_uuid:
+ * @o: An #LDMVolume
+ * @uuid_override: User specified UUID for device mapper
+ *
+ * Set the UUID used for device mapper. If no override is set, the volume's
+ * GUID will be used.
+ */
+void ldm_volume_override_uuid(LDMVolume * const o, const uuid_t uuid_override);
+
/**
* ldm_partition_get_disk:
* @o: An #LDMPartition
diff --git a/src/ldmtool.c b/src/ldmtool.c
index dbe2c8c..7ccd072 100644
--- a/src/ldmtool.c
+++ b/src/ldmtool.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <uuid/uuid.h>
#include <wordexp.h>
#include <glib-object.h>
@@ -74,13 +75,22 @@ gboolean usage_remove(void)
return FALSE;
}
-typedef gboolean (*_action_t) (LDM *ldm, gint argc, gchar **argv,
- JsonBuilder *jb);
+typedef struct {
+ /* User specified UUID for device mapper */
+ uuid_t uuid_override;
+} _options_t;
-gboolean ldm_scan(LDM *ldm, gint argc, gchar **argv, JsonBuilder *jb);
-gboolean ldm_show(LDM *ldm, gint argc, gchar **argv, JsonBuilder *jb);
-gboolean ldm_create(LDM *ldm, gint argc, gchar **argv, JsonBuilder *jb);
-gboolean ldm_remove(LDM *ldm, gint argc, gchar **argv, JsonBuilder *jb);
+typedef gboolean (*_action_t) (LDM *ldm, const _options_t * const opts,
+ gint argc, gchar **argv, JsonBuilder *jb);
+
+gboolean ldm_scan(LDM *ldm, const _options_t * const opts, gint argc,
+ gchar **argv, JsonBuilder *jb);
+gboolean ldm_show(LDM *ldm, const _options_t * const opts, gint argc,
+ gchar **argv, JsonBuilder *jb);
+gboolean ldm_create(LDM *ldm, const _options_t * const opts, gint argc,
+ gchar **argv, JsonBuilder *jb);
+gboolean ldm_remove(LDM *ldm, const _options_t * const opts, gint argc,
+ gchar **argv, JsonBuilder *jb);
typedef struct {
const char * name;
@@ -96,14 +106,15 @@ static const _command_t commands[] = {
};
gboolean
-do_command(LDM * const ldm, const int argc, char *argv[], gboolean *result,
+do_command(LDM * const ldm, const _options_t * const opts,
+ const int argc, char *argv[], gboolean *result,
GOutputStream * const out,
JsonGenerator * const jg, JsonBuilder * const jb)
{
const _command_t *i = commands;
while (i->name) {
if (g_strcmp0(i->name, argv[0]) == 0) {
- if ((i->action)(ldm, argc - 1, argv + 1, jb)) {
+ if ((i->action)(ldm, opts, argc - 1, argv + 1, jb)) {
GError *err = NULL;
json_generator_set_root(jg, json_builder_get_root(jb));
if (!json_generator_to_stream(jg, out, NULL, &err)) {
@@ -174,8 +185,8 @@ _scan(LDM *const ldm, gboolean ignore_errors,
}
gboolean
-ldm_scan(LDM *const ldm, const gint argc, gchar ** const argv,
- JsonBuilder * const jb)
+ldm_scan(LDM *const ldm, const _options_t * const opts, const gint argc,
+ gchar ** const argv, JsonBuilder * const jb)
{
return _scan(ldm, FALSE, argc, argv, jb);
}
@@ -477,8 +488,8 @@ show_disk(LDM *const ldm, const gint argc, gchar ** const argv,
}
gboolean
-ldm_show(LDM *const ldm, const gint argc, gchar ** const argv,
- JsonBuilder * const jb)
+ldm_show(LDM *const ldm, const _options_t * const opts, const gint argc,
+ gchar ** const argv, JsonBuilder * const jb)
{
if (argc == 0) return usage_show();
@@ -499,8 +510,8 @@ typedef gboolean (*_usage_t)();
typedef gboolean (*_vol_action_t)(const LDMVolume *, GString **, GError **);
static gboolean
-_ldm_vol_action(LDM *const ldm, const gint argc, gchar ** const argv,
- JsonBuilder * const jb,
+_ldm_vol_action(LDM *const ldm, const _options_t * const opts, const gint argc,
+ gchar ** const argv, JsonBuilder * const jb,
const gchar * const action_desc,
_usage_t const usage, _vol_action_t const action)
{
@@ -509,6 +520,11 @@ _ldm_vol_action(LDM *const ldm, const gint argc, gchar ** const argv,
if (argc == 1) {
if (g_strcmp0(argv[0], "all") != 0) return (*usage)();
+ if (!uuid_is_null(opts->uuid_override)) {
+ g_warning("UUID override cannot be used for multiple volumes");
+ return FALSE;
+ }
+
GArray *dgs = ldm_get_disk_groups(ldm);
for (guint i = 0; i < dgs->len; i++) {
LDMDiskGroup * const dg = g_array_index(dgs, LDMDiskGroup *, i);
@@ -567,6 +583,10 @@ _ldm_vol_action(LDM *const ldm, const gint argc, gchar ** const argv,
return FALSE;
}
+ if (!uuid_is_null(opts->uuid_override)) {
+ ldm_volume_override_uuid(vol, opts->uuid_override);
+ }
+
GError *err = NULL;
GString *device = NULL;
if (!(*action)(vol, &device, &err)) {
@@ -592,25 +612,30 @@ _ldm_vol_action(LDM *const ldm, const gint argc, gchar ** const argv,
}
gboolean
-ldm_create(LDM *const ldm, const gint argc, gchar ** const argv,
- JsonBuilder * const jb)
+ldm_create(LDM *const ldm, const _options_t * const opts, const gint argc,
+ gchar ** const argv, JsonBuilder * const jb)
{
- return _ldm_vol_action(ldm, argc, argv, jb,
+ return _ldm_vol_action(ldm, opts, argc, argv, jb,
"create", usage_create, ldm_volume_dm_create);
}
gboolean
-ldm_remove(LDM *const ldm, const gint argc, gchar ** const argv,
- JsonBuilder * const jb)
+ldm_remove(LDM *const ldm, const _options_t * const opts, const gint argc,
+ gchar ** const argv, JsonBuilder * const jb)
{
- return _ldm_vol_action(ldm, argc, argv, jb,
+ return _ldm_vol_action(ldm, opts, argc, argv, jb,
"remove", usage_remove, ldm_volume_dm_remove);
}
gboolean
-shell(LDM * const ldm, gchar ** const devices,
+shell(LDM * const ldm, const _options_t * const opts, gchar ** const devices,
JsonGenerator * const jg, GOutputStream * const out)
{
+ if (!uuid_is_null(opts->uuid_override)) {
+ g_warning("UUID override cannot be used in shell mode");
+ return FALSE;
+ }
+
int history_len = 0;
rl_readline_name = "ldmtool";
@@ -659,7 +684,7 @@ shell(LDM * const ldm, gchar ** const devices,
free(line);
gboolean result = FALSE;
- if (!do_command(ldm, argc, argv, &result, out, jg, jb)) {
+ if (!do_command(ldm, opts, argc, argv, &result, out, jg, jb)) {
if (g_strcmp0("quit", argv[0]) == 0 ||
g_strcmp0("exit", argv[0]) == 0)
{
@@ -739,7 +764,7 @@ get_devices(void)
}
gboolean
-cmdline(LDM * const ldm, gchar **devices,
+cmdline(LDM * const ldm, const _options_t * const opts, gchar **devices,
JsonGenerator * const jg, GOutputStream * const out,
const int argc, char *argv[])
{
@@ -757,7 +782,7 @@ cmdline(LDM * const ldm, gchar **devices,
jb = json_builder_new();
gboolean result;
- if (!do_command(ldm, argc, argv, &result, out, jg, jb)) {
+ if (!do_command(ldm, opts, argc, argv, &result, out, jg, jb)) {
g_warning("Unrecognised command: %s", argv[0]);
goto error;
}
@@ -789,11 +814,14 @@ int
main(int argc, char *argv[])
{
static gchar **devices = NULL;
+ static gchar *uuid_override_str = NULL;
static const GOptionEntry entries[] =
{
{ "device", 'd', 0, G_OPTION_ARG_FILENAME_ARRAY,
&devices, "Block device to scan for LDM metadata", NULL },
+ { "uuid_override", 0, 0, G_OPTION_ARG_STRING,
+ &uuid_override_str, "UUID override for device mapper", NULL },
{ NULL }
};
@@ -813,6 +841,17 @@ main(int argc, char *argv[])
}
g_option_context_free(context);
+ _options_t opts;
+ uuid_clear(opts.uuid_override);
+ if (uuid_override_str) {
+ if (uuid_parse(uuid_override_str, opts.uuid_override)) {
+ g_warning("Failed to parse %s as a UUID", uuid_override_str);
+ return 1;
+ }
+ g_free(uuid_override_str);
+ uuid_override_str = NULL;
+ }
+
#if !GLIB_CHECK_VERSION(2,35,0)
g_type_init();
#endif
@@ -828,11 +867,11 @@ main(int argc, char *argv[])
json_generator_set_indent(jg, 2);
if (argc > 1) {
- if (!cmdline(ldm, devices, jg, out, argc - 1, argv + 1)) {
+ if (!cmdline(ldm, &opts, devices, jg, out, argc - 1, argv + 1)) {
ret = 1;
}
} else {
- if (!shell(ldm, devices, jg, out)) {
+ if (!shell(ldm, &opts, devices, jg, out)) {
ret = 1;
}
}
diff --git a/test/Makefile.am b/test/Makefile.am
index 423034f..ec80394 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -21,7 +21,7 @@ EXTRA_DIST = checkmount.pl data/ldm-data.tar.xz
check_PROGRAMS = partread ldmread
partread_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/src
-partread_LDADD = $(top_builddir)/src/libldm-1.0.la
+partread_LDADD = $(top_builddir)/src/libldm-1.0.la $(UUID_LIBS)
ldmread_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/src $(GOBJECT_CFLAGS)
ldmread_LDADD = $(top_builddir)/src/libldm-1.0.la $(GOBJECT_LIBS)
--
2.48.1

View File

@@ -0,0 +1,56 @@
Subject: src: Fix declaration of ldm_new
From: Richard W.M. Jones rjones@redhat.com Thu Feb 6 13:43:01 2025 +0000
Date: Thu Feb 6 13:43:01 2025 +0000:
Git: f0321d8e8dab69780b9baffb54b9336ee8df8d41
GCC 15 forbids declaring a function with () instead of (void).
Declaring it properly reveals an actual bug in ldmtool.
ldmtool.c: In function main:
ldmtool.c:859:23: error: too many arguments to function ldm_new; expected 0, have 1
859 | LDM * const ldm = ldm_new(&err);
| ^~~~~~~ ~~~~
In file included from ldmtool.c:38:
ldm.h:259:6: note: declared here
259 | LDM *ldm_new();
| ^~~~~~~
diff --git a/src/ldm.c b/src/ldm.c
index 47f393f..baa66bf 100644
--- a/src/ldm.c
+++ b/src/ldm.c
@@ -2354,7 +2354,7 @@ error:
}
LDM *
-ldm_new()
+ldm_new(void)
{
LDM *ldm = LDM_CAST(g_object_new(LDM_TYPE, NULL));
ldm->priv->disk_groups = g_array_sized_new(FALSE, FALSE,
diff --git a/src/ldm.h b/src/ldm.h
index 87fff7b..62e1fee 100644
--- a/src/ldm.h
+++ b/src/ldm.h
@@ -256,7 +256,7 @@ GType ldm_disk_group_get_type(void);
*
* Returns: (transfer full): a new #LDM object
*/
-LDM *ldm_new();
+LDM *ldm_new(void);
/**
* ldm_add:
diff --git a/src/ldmtool.c b/src/ldmtool.c
index 7ccd072..eaf3bf6 100644
--- a/src/ldmtool.c
+++ b/src/ldmtool.c
@@ -856,7 +856,7 @@ main(int argc, char *argv[])
g_type_init();
#endif
- LDM * const ldm = ldm_new(&err);
+ LDM * const ldm = ldm_new();
int ret = 0;

View File

@@ -0,0 +1,79 @@
Subject: Update gtkdocize
From: Richard W.M. Jones rjones@redhat.com Thu Feb 6 13:44:14 2025 +0000
Date: Thu Feb 6 13:44:14 2025 +0000:
Git: 1eafb653ac6347a9d4281848c8295f9daffb1613
diff --git a/gtk-doc.make b/gtk-doc.make
old mode 100755
new mode 100644
index 7d9a27f..fb2e7e2
--- a/gtk-doc.make
+++ b/gtk-doc.make
@@ -57,6 +57,7 @@ DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \
sgml.stamp html.stamp pdf.stamp
SCANOBJ_FILES = \
+ $(DOC_MODULE).actions \
$(DOC_MODULE).args \
$(DOC_MODULE).hierarchy \
$(DOC_MODULE).interfaces \
@@ -135,7 +136,7 @@ scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB)
gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES)
$(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \
scanobj_options=""; \
- gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \
+ gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\--verbose"; \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
scanobj_options="--verbose"; \
@@ -197,13 +198,13 @@ GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references";
html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
$(GTK_DOC_V_HTML)rm -rf html && mkdir html && \
mkhtml_options=""; \
- gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \
+ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\--verbose"; \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
mkhtml_options="$$mkhtml_options --verbose"; \
fi; \
fi; \
- gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
+ gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\--path"; \
if test "$$?" = "0"; then \
mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \
fi; \
@@ -226,7 +227,7 @@ GTK_DOC_V_PDF_0=@echo " DOC Building PDF";
pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files)
$(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \
mkpdf_options=""; \
- gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \
+ gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\--verbose"; \
if test "$$?" = "0"; then \
if test "x$(V)" = "x1"; then \
mkpdf_options="$$mkpdf_options --verbose"; \
@@ -235,7 +236,7 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_cont
if test "x$(HTML_IMAGES)" != "x"; then \
for img in $(HTML_IMAGES); do \
part=`dirname $$img`; \
- echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \
+ echo $$mkpdf_options | grep >/dev/null "\--imgdir=$$part "; \
if test $$? != 0; then \
mkpdf_options="$$mkpdf_options --imgdir=$$part"; \
fi; \
@@ -249,10 +250,10 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_cont
clean-local:
@rm -f *~ *.bak
@rm -rf .libs
- @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \
+ @if echo $(SCAN_OPTIONS) | grep -q "\--rebuild-types" ; then \
rm -f $(DOC_MODULE).types; \
fi
- @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \
+ @if echo $(SCAN_OPTIONS) | grep -q "\--rebuild-sections" ; then \
rm -f $(DOC_MODULE)-sections.txt; \
fi
diff --git a/m4/gtk-doc.m4 b/m4/gtk-doc.m4
old mode 100755
new mode 100644

View File

@@ -1,216 +0,0 @@
From f97b057e70b66bcf502a4923f64d8b999b5814c3 Mon Sep 17 00:00:00 2001
From: Liang Yan <lyan@suse.com>
Date: Sat, 27 Oct 2018 11:07:10 -0400
Subject: [PATCH] Remove deprecated g_type_class_add_private()
The API has been deprecated, which causes build failures,
use the G_DEFINE_TYPE_WITH_PRIVATE() macro instead.
Signed-off-by: Liang Yan <lyan@suse.com>
---
--- a/src/ldm.c
+++ b/src/ldm.c
@@ -267,15 +267,13 @@ ldm_ ## object ## _get_ ## property(cons
/* LDM */
-#define LDM_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), LDM_TYPE, LDMPrivate))
-
struct _LDMPrivate
{
GArray *disk_groups;
};
-G_DEFINE_TYPE(LDM, ldm, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(LDM, ldm, G_TYPE_OBJECT)
+
static void
ldm_dispose(GObject * const object)
@@ -290,7 +288,7 @@ ldm_dispose(GObject * const object)
static void
ldm_init(LDM * const o)
{
- o->priv = LDM_GET_PRIVATE(o);
+ o->priv = ldm_get_instance_private(o);
bzero(o->priv, sizeof(*o->priv));
}
@@ -300,14 +298,10 @@ ldm_class_init(LDMClass * const klass)
GObjectClass *object_class = G_OBJECT_CLASS(klass);
object_class->dispose = ldm_dispose;
- g_type_class_add_private(klass, sizeof(LDMPrivate));
}
/* LDMDiskGroup */
-#define LDM_DISK_GROUP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), LDM_TYPE_DISK_GROUP, LDMDiskGroupPrivate))
-
struct _LDMDiskGroupPrivate
{
uuid_t guid;
@@ -326,7 +320,7 @@ struct _LDMDiskGroupPrivate
GArray *comps;
};
-G_DEFINE_TYPE(LDMDiskGroup, ldm_disk_group, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(LDMDiskGroup, ldm_disk_group, G_TYPE_OBJECT)
enum {
PROP_LDM_DISK_GROUP_PROP0,
@@ -396,7 +390,6 @@ ldm_disk_group_class_init(LDMDiskGroupCl
object_class->finalize = ldm_disk_group_finalize;
object_class->get_property = ldm_disk_group_get_property;
- g_type_class_add_private(klass, sizeof(LDMDiskGroupPrivate));
/**
* LDMDiskGroup:guid:
@@ -431,7 +424,7 @@ ldm_disk_group_class_init(LDMDiskGroupCl
static void
ldm_disk_group_init(LDMDiskGroup * const o)
{
- o->priv = LDM_DISK_GROUP_GET_PRIVATE(o);
+ o->priv = ldm_disk_group_get_instance_private(o);
bzero(o->priv, sizeof(*o->priv));
}
@@ -457,9 +450,6 @@ ldm_volume_type_get_type(void)
/* LDMVolume */
-#define LDM_VOLUME_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), LDM_TYPE_VOLUME, LDMVolumePrivate))
-
typedef enum {
_VOLUME_TYPE_GEN = 0x3,
_VOLUME_TYPE_RAID5 = 0x4
@@ -491,7 +481,7 @@ struct _LDMVolumePrivate
guint32 _n_comps_i;
};
-G_DEFINE_TYPE(LDMVolume, ldm_volume, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(LDMVolume, ldm_volume, G_TYPE_OBJECT)
enum {
PROP_LDM_VOLUME_PROP0,
@@ -577,7 +567,6 @@ ldm_volume_class_init(LDMVolumeClass * c
object_class->finalize = ldm_volume_finalize;
object_class->get_property = ldm_volume_get_property;
- g_type_class_add_private(klass, sizeof(LDMVolumePrivate));
/**
* LDMVolume:name:
@@ -677,7 +666,7 @@ ldm_volume_class_init(LDMVolumeClass * c
static void
ldm_volume_init(LDMVolume * const o)
{
- o->priv = LDM_VOLUME_GET_PRIVATE(o);
+ o->priv = ldm_volume_get_instance_private(o);
bzero(o->priv, sizeof(*o->priv));
/* We don't have a trivial way to initialize this array to the correct size
@@ -717,8 +706,6 @@ _cleanup_comp(gpointer const data)
/* LDMPartition */
-#define LDM_PARTITION_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), LDM_TYPE_PARTITION, LDMPartitionPrivate))
struct _LDMPartitionPrivate
{
@@ -735,7 +722,7 @@ struct _LDMPartitionPrivate
LDMDisk *disk;
};
-G_DEFINE_TYPE(LDMPartition, ldm_partition, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(LDMPartition, ldm_partition, G_TYPE_OBJECT)
enum {
PROP_LDM_PARTITION_PROP0,
@@ -796,7 +783,6 @@ ldm_partition_class_init(LDMPartitionCla
object_class->finalize = ldm_partition_finalize;
object_class->get_property = ldm_partition_get_property;
- g_type_class_add_private(klass, sizeof(LDMPartitionPrivate));
/**
* LDMPartition:name:
@@ -846,15 +832,12 @@ ldm_partition_class_init(LDMPartitionCla
static void
ldm_partition_init(LDMPartition * const o)
{
- o->priv = LDM_PARTITION_GET_PRIVATE(o);
+ o->priv = ldm_partition_get_instance_private(o);
bzero(o->priv, sizeof(*o->priv));
}
/* LDMDisk */
-#define LDM_DISK_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), LDM_TYPE_DISK, LDMDiskPrivate))
-
struct _LDMDiskPrivate
{
guint32 id;
@@ -870,7 +853,7 @@ struct _LDMDiskPrivate
gchar *device; // NULL until device is found
};
-G_DEFINE_TYPE(LDMDisk, ldm_disk, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE(LDMDisk, ldm_disk, G_TYPE_OBJECT)
enum {
PROP_LDM_DISK_PROP0,
@@ -948,7 +931,6 @@ ldm_disk_class_init(LDMDiskClass * const
object_class->finalize = ldm_disk_finalize;
object_class->get_property = ldm_disk_get_property;
- g_type_class_add_private(klass, sizeof(LDMDiskPrivate));
/**
* LDMDisk:name:
@@ -1062,7 +1044,7 @@ ldm_disk_class_init(LDMDiskClass * const
static void
ldm_disk_init(LDMDisk * const o)
{
- o->priv = LDM_DISK_GET_PRIVATE(o);
+ o->priv = ldm_disk_get_instance_private(o);
bzero(o->priv, sizeof(*o->priv));
}
@@ -2301,7 +2283,7 @@ error:
}
LDM *
-ldm_new()
+ldm_new(void)
{
LDM *ldm = LDM_CAST(g_object_new(LDM_TYPE, NULL));
ldm->priv->disk_groups = g_array_sized_new(FALSE, FALSE,
--- a/src/ldm.h
+++ b/src/ldm.h
@@ -254,7 +254,7 @@ GType ldm_disk_group_get_type(void);
*
* Returns: (transfer full): a new #LDM object
*/
-LDM *ldm_new();
+LDM *ldm_new(void);
/**
* ldm_add:
--- a/src/ldmtool.c
+++ b/src/ldmtool.c
@@ -783,7 +783,7 @@ main(int argc, char *argv[])
g_type_init();
#endif
- LDM * const ldm = ldm_new(&err);
+ LDM * const ldm = ldm_new();
int ret = 0;

View File

@@ -1,3 +1,28 @@
-------------------------------------------------------------------
Wed Jun 25 10:35:14 MDT 2025 - carnold@suse.com
- Update to version 0.2.5 (jsc#PED-12706)
* Fix crash while creating mapper for a volume which lacks of
partitions
* Make libldm to parse and return volume GUID
* Change the way we sanitise LDM partition name
* Set UUID for device mapper devices (partitions and volumes)
* Fix potential memory leak
* Use device mapper device UUID instead of name to find device in
a tree
* New API: ldm_volume_dm_get_device
* New API: ldm_partition_dm_get_device
* Fix bug in libldm to allow for all spanned LDM volumes to bex
correctly identified/mounted
- Upstream fixes post 0.2.5
001-Add-example-systemd-unit-file.patch
002-ldmtool-fix-NULL-pointer-dereference.patch
003-Add-ability-to-override-device-mapper-UUID.patch
004-src-Fix-declaration-of-ldm_new.patch
005-Update-gtkdocize.patch
- Drop patch contained in new tarball
Remove-deprecated-g_type_class_add_private.patch
-------------------------------------------------------------------
Tue Jan 5 11:11:11 UTC 2021 - olaf@aepfle.de

View File

@@ -1,7 +1,7 @@
#
# spec file for package ldmtool
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -20,17 +20,19 @@
%define sover 1_0-0
Name: ldmtool
Version: 0.2.4
Version: 0.2.5
Release: 0
Summary: A tool to manage Windows dynamic disks
License: GPL-3.0-only
Group: System/Base
URL: https://github.com/mdbooth/libldm
# Disable until the create a tarball with the 2.4.0 release
#Source0: %{url}/downloads/%{srcname}-%{version}.tar.gz
URL: https://github.com/mdbooth/libldm
Source0: %{srcname}-%{version}.tar.gz
Patch0: Remove-deprecated-g_type_class_add_private.patch
Patch1: 001-Add-example-systemd-unit-file.patch
Patch2: 002-ldmtool-fix-NULL-pointer-dereference.patch
Patch3: 003-Add-ability-to-override-device-mapper-UUID.patch
Patch4: 004-src-Fix-declaration-of-ldm_new.patch
Patch5: 005-Update-gtkdocize.patch
BuildRequires: autoconf
BuildRequires: automake
@@ -60,7 +62,6 @@ Library for managing Microsoft Windows dynamic disks, which use Microsoft's
LDM metadata. It can inspect them, and also create and remove device-mapper
block devices which can be mounted.
%package -n %{srcname}-%{sover}-devel
Summary: Development files for %{name}
License: LGPL-3.0-only
@@ -98,8 +99,8 @@ find "%buildroot" -type f -name '*.la' -delete
%{_libdir}/*.so.*
%files -n %{srcname}-%{sover}-devel
%{_includedir}/*
%{_libdir}/*.so
%{_includedir}/ldm.h
%{_libdir}/libldm*.so
%{_libdir}/pkgconfig/ldm-1.0.pc
%{_datadir}/gtk-doc

Binary file not shown.

BIN
libldm-0.2.5.tar.gz LFS Normal file

Binary file not shown.