diff -Nru libxmlb-0.3.8/contrib/libxmlb.spec.in libxmlb-0.3.10/contrib/libxmlb.spec.in --- libxmlb-0.3.8/contrib/libxmlb.spec.in 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/contrib/libxmlb.spec.in 2022-09-11 10:09:18.000000000 +0000 @@ -71,7 +71,8 @@ %files %doc README.md %license LICENSE -%{_libexecdir}/xb-tool +%{_bindir}/xb-tool +%{_mandir}/man1/xb-tool.1* %dir %{_libdir}/girepository-1.0 %{_libdir}/girepository-1.0/Xmlb-2.0.typelib %{_libdir}/libxmlb.so.2* diff -Nru libxmlb-0.3.8/debian/changelog libxmlb-0.3.10/debian/changelog --- libxmlb-0.3.8/debian/changelog 2022-04-10 19:46:50.000000000 +0000 +++ libxmlb-0.3.10/debian/changelog 2022-12-22 22:54:36.000000000 +0000 @@ -1,3 +1,20 @@ +libxmlb (0.3.10-2) unstable; urgency=medium + + * No-change upload to trigger a full rebuild + + -- Matthias Klumpp Thu, 22 Dec 2022 23:54:36 +0100 + +libxmlb (0.3.10-1) unstable; urgency=medium + + * New upstream release: 0.3.10 + - Resolves double-free corruption (Closes: #1019262) + - xb-tool has been moved to PATH + - Various other crash fixes + * Bump standards version: No changes needed + * Add new package for xb-tool, which is now in PATH + + -- Matthias Klumpp Tue, 20 Dec 2022 18:16:38 +0100 + libxmlb (0.3.8-1) unstable; urgency=medium * New upstream release: 0.3.8 diff -Nru libxmlb-0.3.8/debian/control libxmlb-0.3.10/debian/control --- libxmlb-0.3.8/debian/control 2022-04-10 19:44:43.000000000 +0000 +++ libxmlb-0.3.10/debian/control 2022-12-20 17:15:25.000000000 +0000 @@ -15,7 +15,7 @@ liblzma-dev, meson (>= 0.52.0), shared-mime-info -Standards-Version: 4.6.0 +Standards-Version: 4.6.1 Homepage: https://github.com/hughsie/libxmlb Vcs-Git: https://salsa.debian.org/efi-team/libxmlb.git Vcs-Browser: https://salsa.debian.org/efi-team/libxmlb @@ -41,7 +41,7 @@ liblzma-dev, ${misc:Depends}, ${shlibs:Depends} -Description: development files for libxmlb +Description: Development files for libxmlb This package provides development libraries for libxmlb. . The libxmlb library takes XML source, and @@ -67,6 +67,23 @@ return some strings without actually parsing the entire document. This is all done using (almost) zero allocations and no actual copying of the binary data. +Package: libxmlb-utils +Architecture: any +Depends: libxmlb2 (= ${binary:Version}), + shared-mime-info, + ${misc:Depends}, + ${shlibs:Depends} +Description: Binary XML library - Command-line utility + The libxmlb library takes XML source, and + converts it to a structured binary representation with a deduplicated string + table -- where the strings have the NULs included. + . + This allows an application to mmap the binary XML file, do an XPath query and + return some strings without actually parsing the entire document. This is all + done using (almost) zero allocations and no actual copying of the binary data. + . + This package contains the `xb-tool` command-line utility. + Package: libxmlb-tests Architecture: any Depends: libxmlb2 (= ${binary:Version}), @@ -82,4 +99,4 @@ return some strings without actually parsing the entire document. This is all done using (almost) zero allocations and no actual copying of the binary data. . - This package contains the installed tests for libxmlb1. + This package contains the installed tests for libxmlb. diff -Nru libxmlb-0.3.8/debian/libxmlb-dev.install libxmlb-0.3.10/debian/libxmlb-dev.install --- libxmlb-0.3.8/debian/libxmlb-dev.install 2022-04-10 19:44:43.000000000 +0000 +++ libxmlb-0.3.10/debian/libxmlb-dev.install 2022-12-20 17:07:29.000000000 +0000 @@ -1,6 +1,5 @@ usr/include/ usr/lib/*/*.so usr/lib/*/pkgconfig -usr/lib/*/xb-tool usr/share/gir-1.0 usr/share/gtk-doc diff -Nru libxmlb-0.3.8/debian/libxmlb-utils.install libxmlb-0.3.10/debian/libxmlb-utils.install --- libxmlb-0.3.8/debian/libxmlb-utils.install 1970-01-01 00:00:00.000000000 +0000 +++ libxmlb-0.3.10/debian/libxmlb-utils.install 2022-12-20 17:11:19.000000000 +0000 @@ -0,0 +1,2 @@ +usr/bin/* +usr/share/man/man1/* diff -Nru libxmlb-0.3.8/debian/rules libxmlb-0.3.10/debian/rules --- libxmlb-0.3.8/debian/rules 2022-04-10 19:44:43.000000000 +0000 +++ libxmlb-0.3.10/debian/rules 2022-12-20 17:08:25.000000000 +0000 @@ -2,7 +2,3 @@ %: dh $@ --with gir - -override_dh_install-arch: - mv debian/tmp/usr/libexec/xb-tool debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH) - dh_install -a diff -Nru libxmlb-0.3.8/debian/watch libxmlb-0.3.10/debian/watch --- libxmlb-0.3.8/debian/watch 2022-04-10 19:44:43.000000000 +0000 +++ libxmlb-0.3.10/debian/watch 2022-12-20 17:15:18.000000000 +0000 @@ -1,4 +1,4 @@ -version=3 +version=4 + opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/libxmlb-$1\.tar\.gz/ \ https://github.com/hughsie/libxmlb/tags .*/v?(\d\S*)\.tar\.gz - diff -Nru libxmlb-0.3.8/meson.build libxmlb-0.3.10/meson.build --- libxmlb-0.3.8/meson.build 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/meson.build 2022-09-11 10:09:18.000000000 +0000 @@ -1,5 +1,5 @@ project('libxmlb', 'c', - version : '0.3.8', + version : '0.3.10', license : 'LGPL-2.1+', meson_version : '>=0.47.0', default_options : ['warning_level=2', 'c_std=c99'], @@ -103,16 +103,18 @@ ) if host_machine.system() == 'windows' - libexecdir = get_option('libexecdir') + bindir = get_option('bindir') installed_test_bindir = get_option('libexecdir') installed_test_datadir = get_option('datadir') else prefix = get_option('prefix') datadir = join_paths(prefix, get_option('datadir')) + bindir = join_paths(prefix, get_option('bindir')) libexecdir = join_paths(prefix, get_option('libexecdir')) installed_test_bindir = join_paths(libexecdir, 'installed-tests', meson.project_name()) installed_test_datadir = join_paths(datadir, 'installed-tests', meson.project_name()) endif +mandir = join_paths(prefix, get_option('mandir')) gio = dependency('gio-2.0', version : '>= 2.45.8') giounix = dependency('gio-unix-2.0', version : '>= 2.45.8', required: false) diff -Nru libxmlb-0.3.8/NEWS libxmlb-0.3.10/NEWS --- libxmlb-0.3.8/NEWS 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/NEWS 2022-09-11 10:09:18.000000000 +0000 @@ -1,3 +1,21 @@ +Version 0.3.10 +~~~~~~~~~~~~~~ +Released: 2022-09-11 + +Bugfixes: + - Fix dumping and exporting multiple files from the CLI (Richard Hughes) + - Watch files before loading them into the builder (Philip Withnall) + - Fix potential double free when filtering by language (Sergio Costas Rodriguez) + +Version 0.3.9 +~~~~~~~~~~~~~ +Released: 2022-05-24 + +Bugfixes: + - Fix the crash for when the root tree has no children (Richard Hughes) + - Fix the crash when getting the element for the [empty] root (Richard Hughes) + - Install xb-tool into bindir (Richard Hughes) + Version 0.3.8 ~~~~~~~~~~~~~ Released: 2022-03-22 diff -Nru libxmlb-0.3.8/RELEASE libxmlb-0.3.10/RELEASE --- libxmlb-0.3.8/RELEASE 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/RELEASE 2022-09-11 10:09:18.000000000 +0000 @@ -2,10 +2,10 @@ 1. Write NEWS entries for libxmlb in the same format as usual. -git shortlog 0.3.7.. | grep -i -v trivial | grep -v Merge > NEWS.new +git shortlog 0.3.9.. | grep -i -v trivial | grep -v Merge > NEWS.new -Version 0.3.8 -~~~~~~~~~~~~~ +Version 0.3.10 +~~~~~~~~~~~~~~ Released: 2022-xx-xx New Features: @@ -15,7 +15,7 @@ Commit changes to git: # MAKE SURE THESE ARE CORRECT -export release_ver="0.3.8" +export release_ver="0.3.10" git commit -a -m "Release libxmlb ${release_ver}" --no-verify git tag -s -f -m "Release libxmlb ${release_ver}" "${release_ver}" diff -Nru libxmlb-0.3.8/src/meson.build libxmlb-0.3.10/src/meson.build --- libxmlb-0.3.8/src/meson.build 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/meson.build 2022-09-11 10:09:18.000000000 +0000 @@ -96,7 +96,14 @@ libxmlb, ], install : true, - install_dir : libexecdir + install_dir : bindir +) +configure_file( + input : 'xb-tool.1', + output : 'xb-tool.1', + configuration : conf, + install: true, + install_dir: join_paths(mandir, 'man1'), ) endif diff -Nru libxmlb-0.3.8/src/xb-builder.c libxmlb-0.3.10/src/xb-builder.c --- libxmlb-0.3.8/src/xb-builder.c 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-builder.c 2022-09-11 10:09:18.000000000 +0000 @@ -254,6 +254,15 @@ if (!xb_builder_source_fixup(source, root_tmp, error)) return FALSE; + /* check to see if the root was ignored */ + if (xb_builder_node_has_flag(root_tmp, XB_BUILDER_NODE_FLAG_IGNORE)) { + g_set_error_literal(error, + G_IO_ERROR, + G_IO_ERROR_INVALID_DATA, + "root node cannot be ignored"); + return FALSE; + } + /* a single root with no siblings was required */ if (helper->compile_flags & XB_BUILDER_COMPILE_FLAG_SINGLE_ROOT) { if (xb_builder_node_get_children(root_tmp)->len > 1) { @@ -271,7 +280,8 @@ children = xb_builder_node_get_children(helper->current); for (guint i = 0; i < children->len; i++) { XbBuilderNode *bn = g_ptr_array_index(children, i); - xb_builder_node_add_child(bn, info); + if (!xb_builder_node_has_flag(bn, XB_BUILDER_NODE_FLAG_IGNORE)) + xb_builder_node_add_child(bn, info); } } @@ -432,7 +442,7 @@ for (guint i = 0; i < nodes->len; i++) { XbBuilderNode *bn2 = g_ptr_array_index(nodes, i); if (xb_builder_node_get_priority(bn2) < prio_best) - g_ptr_array_add(nodes_to_destroy, bn2); + g_ptr_array_add(nodes_to_destroy, g_object_ref(bn2)); /* never visit this node again */ xb_builder_node_set_priority(bn2, -2); @@ -755,7 +765,7 @@ XbBuilderNodetabHelper nodetab_helper = { .buf = NULL, }; - g_autoptr(GPtrArray) nodes_to_destroy = g_ptr_array_new(); + g_autoptr(GPtrArray) nodes_to_destroy = g_ptr_array_new_with_free_func((GDestroyNotify)g_object_unref); g_autoptr(GTimer) timer = xb_silo_start_profile(priv->silo); g_autoptr(XbBuilderCompileHelper) helper = NULL; @@ -803,6 +813,10 @@ root = g_object_ref(helper->root); } + /* watch the source */ + if (!xb_builder_watch_source(self, source, cancellable, error)) + return NULL; + if (priv->profile_flags & XB_SILO_PROFILE_FLAG_DEBUG) g_debug("compiling %s…", source_guid); if (!xb_builder_compile_source(helper, source, root, cancellable, &error_local)) { @@ -818,10 +832,6 @@ source_guid); return NULL; } - - /* watch the source */ - if (!xb_builder_watch_source(self, source, cancellable, error)) - return NULL; } /* run any node functions */ @@ -981,6 +991,10 @@ if (flags & XB_BUILDER_COMPILE_FLAG_WATCH_BLOB) load_flags |= XB_SILO_LOAD_FLAG_WATCH_BLOB; + /* ensure all the sources are watched */ + if (!xb_builder_watch_sources(self, cancellable, error)) + return NULL; + /* profile new silo if needed */ xb_silo_set_profile_flags(silo_tmp, priv->profile_flags); @@ -1014,19 +1028,16 @@ (flags & XB_BUILDER_COMPILE_FLAG_IGNORE_GUID) > 0) { g_autoptr(GBytes) blob = xb_silo_get_bytes(silo_tmp); - g_debug("loading silo with file contents"); - if (!xb_silo_load_from_bytes(priv->silo, blob, load_flags, error)) - return NULL; - - /* ensure all the sources are watched */ - if (!xb_builder_watch_sources(self, cancellable, error)) - return NULL; - /* ensure backing file is watched for changes */ if (flags & XB_BUILDER_COMPILE_FLAG_WATCH_BLOB) { if (!xb_silo_watch_file(priv->silo, file, cancellable, error)) return NULL; } + + g_debug("loading silo with file contents"); + if (!xb_silo_load_from_bytes(priv->silo, blob, load_flags, error)) + return NULL; + return g_object_ref(priv->silo); } } diff -Nru libxmlb-0.3.8/src/xb-builder-node.h libxmlb-0.3.10/src/xb-builder-node.h --- libxmlb-0.3.8/src/xb-builder-node.h 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-builder-node.h 2022-09-11 10:09:18.000000000 +0000 @@ -58,7 +58,9 @@ XbBuilderNode * xb_builder_node_new(const gchar *element); XbBuilderNode * -xb_builder_node_insert(XbBuilderNode *parent, const gchar *element, ...) G_GNUC_NULL_TERMINATED; +xb_builder_node_insert(XbBuilderNode *parent, + const gchar *element, + ...) G_GNUC_NULL_TERMINATED G_GNUC_WARN_UNUSED_RESULT; void xb_builder_node_insert_text(XbBuilderNode *parent, const gchar *element, const gchar *text, ...) G_GNUC_NULL_TERMINATED; diff -Nru libxmlb-0.3.8/src/xb-machine.c libxmlb-0.3.10/src/xb-machine.c --- libxmlb-0.3.8/src/xb-machine.c 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-machine.c 2022-09-11 10:09:18.000000000 +0000 @@ -391,7 +391,7 @@ /* indexed text */ if (text_len >= 3) { if (str[0] == '$' && str[1] == '\'' && str[text_len - 1] == '\'') { - gchar *tmp = g_strndup(str + 2, text_len - 3); + g_autofree gchar *tmp = g_strndup(str + 2, text_len - 3); XbOpcode *opcode; if (!xb_stack_push(opcodes, &opcode, error)) return FALSE; @@ -1061,8 +1061,7 @@ tmp); return FALSE; } - if (result != NULL) - *result = xb_opcode_get_val(&opcode_success); + *result = xb_opcode_get_val(&opcode_success); /* success */ return TRUE; diff -Nru libxmlb-0.3.8/src/xb-node.c libxmlb-0.3.10/src/xb-node.c --- libxmlb-0.3.8/src/xb-node.c 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-node.c 2022-09-11 10:09:18.000000000 +0000 @@ -200,6 +200,8 @@ g_return_val_if_fail(XB_IS_NODE(self), NULL); + if (priv->sn == NULL) + return NULL; sn = xb_silo_get_parent_node(priv->silo, priv->sn); if (sn == NULL) return NULL; @@ -224,6 +226,8 @@ g_return_val_if_fail(XB_IS_NODE(self), NULL); + if (priv->sn == NULL) + return NULL; sn = xb_silo_get_next_node(priv->silo, priv->sn); if (sn == NULL) return NULL; @@ -248,6 +252,8 @@ g_return_val_if_fail(XB_IS_NODE(self), NULL); + if (priv->sn == NULL) + return NULL; sn = xb_silo_get_child_node(priv->silo, priv->sn); if (sn == NULL) return NULL; @@ -301,7 +307,7 @@ g_return_if_fail(XB_IS_NODE(self)); ri->node = self; - ri->position = xb_silo_get_child_node(priv->silo, priv->sn); + ri->position = priv->sn != NULL ? xb_silo_get_child_node(priv->silo, priv->sn) : NULL; ri->first_iter = TRUE; } @@ -422,6 +428,8 @@ { XbNodePrivate *priv = GET_PRIVATE(self); g_return_val_if_fail(XB_IS_NODE(self), NULL); + if (priv->sn == NULL) + return NULL; return xb_silo_get_node_text(priv->silo, priv->sn); } @@ -443,8 +451,9 @@ g_return_val_if_fail(XB_IS_NODE(self), G_MAXUINT64); + if (priv->sn == NULL) + return G_MAXUINT64; tmp = xb_silo_get_node_text(priv->silo, priv->sn); - ; if (tmp == NULL) return G_MAXUINT64; if (g_str_has_prefix(tmp, "0x")) @@ -467,6 +476,8 @@ { XbNodePrivate *priv = GET_PRIVATE(self); g_return_val_if_fail(XB_IS_NODE(self), NULL); + if (priv->sn == NULL) + return NULL; return xb_silo_get_node_tail(priv->silo, priv->sn); } @@ -476,7 +487,7 @@ * * Gets the element name for a specific node. * - * Returns: a string, or %NULL for unset + * Returns: a string, or %NULL for the root node * * Since: 0.1.0 **/ @@ -485,6 +496,8 @@ { XbNodePrivate *priv = GET_PRIVATE(self); g_return_val_if_fail(XB_IS_NODE(self), NULL); + if (priv->sn == NULL) + return NULL; return xb_silo_get_node_element(priv->silo, priv->sn); } @@ -508,6 +521,8 @@ g_return_val_if_fail(XB_IS_NODE(self), NULL); g_return_val_if_fail(name != NULL, NULL); + if (priv->sn == NULL) + return NULL; a = xb_silo_get_node_attr_by_str(priv->silo, priv->sn, name); if (a == NULL) return NULL; @@ -563,7 +578,7 @@ g_return_if_fail(XB_IS_NODE(self)); ri->node = self; - ri->position = xb_silo_node_get_attr_count(priv->sn); + ri->position = priv->sn != NULL ? xb_silo_node_get_attr_count(priv->sn) : 0; } /** @@ -632,6 +647,8 @@ { XbNodePrivate *priv = GET_PRIVATE(self); g_return_val_if_fail(XB_IS_NODE(self), 0); + if (priv->sn == NULL) + return 0; return xb_silo_get_node_depth(priv->silo, priv->sn); } diff -Nru libxmlb-0.3.8/src/xb-self-test.c libxmlb-0.3.10/src/xb-self-test.c --- libxmlb-0.3.8/src/xb-self-test.c 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-self-test.c 2022-09-11 10:09:18.000000000 +0000 @@ -729,6 +729,64 @@ } static gboolean +xb_builder_ignore_cb(XbBuilderFixup *self, XbBuilderNode *bn, gpointer user_data, GError **error) +{ + if (xb_builder_node_get_element(bn) != NULL) + xb_builder_node_add_flag(bn, XB_BUILDER_NODE_FLAG_IGNORE); + return TRUE; +} + +static void +xb_builder_node_vfunc_ignore_func(void) +{ + XbNodeChildIter iter; + gboolean ret; + const gchar *element; + g_autoptr(GError) error = NULL; + g_autoptr(XbBuilder) builder = xb_builder_new(); + g_autoptr(XbBuilderFixup) fixup = NULL; + g_autoptr(XbBuilderSource) source = xb_builder_source_new(); + g_autoptr(XbBuilderNode) info = NULL; + g_autoptr(XbSilo) silo = NULL; + g_autoptr(XbNode) n = NULL; + g_autoptr(XbNode) c = NULL; + g_autoptr(XbNode) c2 = NULL; + + /* add fixup */ + fixup = xb_builder_fixup_new("AlwaysIgnore", xb_builder_ignore_cb, NULL, NULL); + xb_builder_source_add_fixup(source, fixup); + + /* import some XML with metadata */ + ret = xb_builder_source_load_xml(source, + "gimp.desktop", + XB_BUILDER_SOURCE_FLAG_NONE, + &error); + g_assert_no_error(error); + g_assert_true(ret); + info = xb_builder_node_insert(NULL, "info", NULL); + xb_builder_node_insert_text(info, "foo", "bar", NULL); + xb_builder_source_set_info(source, info); + xb_builder_import_source(builder, source); + + /* compile */ + silo = xb_builder_compile(builder, XB_BUILDER_COMPILE_FLAG_NONE, NULL, &error); + g_assert_no_error(error); + g_assert_nonnull(silo); + n = xb_silo_get_root(silo); + g_assert_nonnull(n); + element = xb_node_get_element(n); + g_assert_null(element); + c = xb_node_get_child(n); + g_assert_null(c); + c = xb_node_get_next(n); + g_assert_null(c); + xb_node_child_iter_init(&iter, n); + ret = xb_node_child_iter_next(&iter, &c2); + g_assert_false(ret); + g_assert_null(c2); +} + +static gboolean xb_builder_upgrade_appstream_cb(XbBuilderFixup *self, XbBuilderNode *bn, gpointer user_data, @@ -2681,6 +2739,7 @@ g_test_add_func("/libxmlb/builder{node-vfunc-remove}", xb_builder_node_vfunc_remove_func); g_test_add_func("/libxmlb/builder{node-vfunc-depth}", xb_builder_node_vfunc_depth_func); g_test_add_func("/libxmlb/builder{node-vfunc-error}", xb_builder_node_vfunc_error_func); + g_test_add_func("/libxmlb/builder{node-vfunc-ignore}", xb_builder_node_vfunc_ignore_func); g_test_add_func("/libxmlb/builder{ignore-invalid}", xb_builder_ignore_invalid_func); g_test_add_func("/libxmlb/builder{custom-mime}", xb_builder_custom_mime_func); g_test_add_func("/libxmlb/builder{chained-adapters}", xb_builder_chained_adapters_func); @@ -2705,9 +2764,9 @@ g_test_add_func("/libxmlb/xpath-parent-subnode", xb_xpath_parent_subnode_func); g_test_add_func("/libxmlb/multiple-roots", xb_builder_multiple_roots_func); g_test_add_func("/libxmlb/single-root", xb_builder_single_root_func); - if (g_test_perf()) + if (g_test_perf()) { g_test_add_func("/libxmlb/threading", xb_threading_func); - if (g_test_perf()) g_test_add_func("/libxmlb/speed", xb_speed_func); + } return g_test_run(); } diff -Nru libxmlb-0.3.8/src/xb-silo.c libxmlb-0.3.10/src/xb-silo.c --- libxmlb-0.3.8/src/xb-silo.c 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-silo.c 2022-09-11 10:09:18.000000000 +0000 @@ -334,6 +334,12 @@ g_return_val_if_fail(XB_IS_SILO(self), NULL); g_return_val_if_fail(error == NULL || *error == NULL, NULL); + /* sanity check */ + if (hdr->strtab > priv->datasz) { + g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "strtab invalid"); + return NULL; + } + g_string_append_printf(str, "magic: %08x\n", (guint)hdr->magic); g_string_append_printf(str, "guid: %s\n", priv->guid); g_string_append_printf(str, "strtab: @%" G_GUINT32_FORMAT "\n", hdr->strtab); @@ -1022,8 +1028,7 @@ g_hash_table_remove_all(priv->strtab_tags); g_clear_pointer(&priv->guid, g_free); - if (priv->mmap != NULL) - g_mapped_file_unref(priv->mmap); + g_clear_pointer(&priv->mmap, g_mapped_file_unref); fn = g_file_get_path(file); priv->mmap = g_mapped_file_new(fn, FALSE, error); diff -Nru libxmlb-0.3.8/src/xb-silo-query.c libxmlb-0.3.10/src/xb-silo-query.c --- libxmlb-0.3.8/src/xb-silo-query.c 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-silo-query.c 2022-09-11 10:09:18.000000000 +0000 @@ -643,7 +643,7 @@ * * Please note: Only a tiny subset of XPath 1.0 is supported. * - * Returns: (transfer none): a #XbNode, or %NULL if unfound + * Returns: (transfer full): a #XbNode, or %NULL if unfound * * Since: 0.3.0 **/ diff -Nru libxmlb-0.3.8/src/xb-tool.1 libxmlb-0.3.10/src/xb-tool.1 --- libxmlb-0.3.8/src/xb-tool.1 1970-01-01 00:00:00.000000000 +0000 +++ libxmlb-0.3.10/src/xb-tool.1 2022-09-11 10:09:18.000000000 +0000 @@ -0,0 +1,19 @@ +.\" Report problems in https://github.com/hughsie/libxmlb +.TH man 1 "18 April 2022" @PACKAGE_VERSION@ "xb-tool man page" +.SH NAME +xb-tool \- standalone XMLb utility +.SH SYNOPSIS +xb-tool [CMD] +.SH DESCRIPTION +This tool allows creating, dumping and querying binary XML blobs. +.PP +Additionally \fBxb-tool\fR can be used to profile specfic tokenized queries. +.SH OPTIONS +The xb-tool command takes various options depending on the action. +Run \fBxb-tool --help\fR for the full list. +.SH EXIT STATUS +Commands that successfully execute will return "0", otherwise "1". +.SH BUGS +No known bugs. +.SH AUTHOR +Richard Hughes (richard@hughsie.com) diff -Nru libxmlb-0.3.8/src/xb-tool.c libxmlb-0.3.10/src/xb-tool.c --- libxmlb-0.3.8/src/xb-tool.c 2022-03-22 14:16:04.000000000 +0000 +++ libxmlb-0.3.10/src/xb-tool.c 2022-09-11 10:09:18.000000000 +0000 @@ -188,7 +188,7 @@ /* load blobs */ for (guint i = 0; values[i] != NULL; i++) { g_autofree gchar *str = NULL; - g_autoptr(GFile) file = g_file_new_for_path(values[0]); + g_autoptr(GFile) file = g_file_new_for_path(values[i]); g_autoptr(XbSilo) silo = xb_silo_new(); if (!xb_silo_load_from_file(silo, file, flags, NULL, error)) return FALSE; @@ -223,7 +223,7 @@ /* load blobs */ for (guint i = 0; values[i] != NULL; i++) { g_autofree gchar *str = NULL; - g_autoptr(GFile) file = g_file_new_for_path(values[0]); + g_autoptr(GFile) file = g_file_new_for_path(values[i]); g_autoptr(XbSilo) silo = xb_silo_new(); if (!xb_silo_load_from_file(silo, file, flags, NULL, error)) return FALSE;