Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package bolt for openSUSE:Factory checked in 
at 2025-06-26 11:34:26
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/bolt (Old)
 and      /work/SRC/openSUSE:Factory/.bolt.new.7067 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "bolt"

Thu Jun 26 11:34:26 2025 rev:18 rq:1288453 version:0.9.10

Changes:
--------
--- /work/SRC/openSUSE:Factory/bolt/bolt.changes        2025-06-04 
20:26:53.000831502 +0200
+++ /work/SRC/openSUSE:Factory/.bolt.new.7067/bolt.changes      2025-06-26 
11:34:33.757938894 +0200
@@ -1,0 +2,7 @@
+Wed Jun 25 07:27:16 UTC 2025 - Robert Frohl <rfr...@suse.com>
+
+- update to 0.9.10:
+  * Fix bolt exits when opening an empty version file
+  * Fix failure on integration test due to the change of the latest pygobject
+
+-------------------------------------------------------------------

Old:
----
  bolt-0.9.9.tar.bz2

New:
----
  bolt-0.9.10.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ bolt.spec ++++++
--- /var/tmp/diff_new_pack.r7v0OW/_old  2025-06-26 11:34:34.333962790 +0200
+++ /var/tmp/diff_new_pack.r7v0OW/_new  2025-06-26 11:34:34.333962790 +0200
@@ -18,7 +18,7 @@
 
 %global _hardened_build 1
 Name:           bolt
-Version:        0.9.9
+Version:        0.9.10
 Release:        0
 Summary:        Thunderbolt 3 device manager
 License:        LGPL-2.1-or-later

++++++ bolt-0.9.9.tar.bz2 -> bolt-0.9.10.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bolt-0.9.9/CHANGELOG.md new/bolt-0.9.10/CHANGELOG.md
--- old/bolt-0.9.9/CHANGELOG.md 2025-06-03 10:41:50.000000000 +0200
+++ new/bolt-0.9.10/CHANGELOG.md        2025-06-25 04:52:56.000000000 +0200
@@ -1,3 +1,10 @@
+## Version 0.9.10
+
+Released: 2025-06-25
+
+- Fix bolt exits when opening an empty version file [#194 !300]
+- Fix failure on integration test due to the change of the latest pygobject 
[#195 !301]
+
 ## Version 0.9.9
 
 Released: 2025-06-03
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bolt-0.9.9/boltd/bolt-store.c 
new/bolt-0.9.10/boltd/bolt-store.c
--- old/bolt-0.9.9/boltd/bolt-store.c   2025-06-03 10:41:50.000000000 +0200
+++ new/bolt-0.9.10/boltd/bolt-store.c  2025-06-25 04:52:56.000000000 +0200
@@ -230,6 +230,7 @@
   g_autoptr(GError) err = NULL;
   g_autoptr(DIR) root = NULL;
   g_autofree char *path = NULL;
+  g_autofree gchar *version_path = NULL;
   BoltStore *store = BOLT_STORE (initable);
   gboolean ok;
 
@@ -248,6 +249,23 @@
                           &store->version,
                           &err);
 
+  /* if bolt failed to get version number from the file "version",
+   * bolt will write the version number to the "version" file and
+   * assume the version of the file store is the default version
+   * (BOLT_STORE_VERSION). */
+  version_path = g_build_filename (path, "version", NULL);
+  if (!ok && g_file_test (version_path, G_FILE_TEST_IS_REGULAR))
+    {
+      g_clear_error (&err);
+      bolt_debug (LOG_TOPIC ("store"), "Failed on reading version number. 
Rewrite the version and assume the file store version is %d", 
BOLT_STORE_VERSION);
+      bolt_write_uint_at (dirfd (root),
+                          "version",
+                          BOLT_STORE_VERSION,
+                          &err);
+      store->version = BOLT_STORE_VERSION;
+      return TRUE;
+    }
+
   if (!ok && !bolt_err_notfound (err))
     return bolt_error_propagate (error, &err);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bolt-0.9.9/meson.build new/bolt-0.9.10/meson.build
--- old/bolt-0.9.9/meson.build  2025-06-03 10:41:50.000000000 +0200
+++ new/bolt-0.9.10/meson.build 2025-06-25 04:52:56.000000000 +0200
@@ -1,6 +1,6 @@
 project('bolt',
   'c',
-  version: '0.9.9',
+  version: '0.9.10',
   license : 'LGPL-2.1-or-later',
   meson_version: '>= 0.60.0',
   default_options: ['warning_level=1',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bolt-0.9.9/tests/test-integration 
new/bolt-0.9.10/tests/test-integration
--- old/bolt-0.9.9/tests/test-integration       2025-06-03 10:41:50.000000000 
+0200
+++ new/bolt-0.9.10/tests/test-integration      2025-06-25 04:52:56.000000000 
+0200
@@ -1101,11 +1101,6 @@
         # a well known key that can be used in testing
         cls.key = 
"b68bce095a13ac39e9254a88b189a38f240487aa6f78f803390a0cdeceb774d8"
 
-        # monkey patch Gio.IOErrorEnum to have a.quark() method
-        # so it behaves like Gio.DBusError
-        io_error_quark = GLib.quark_from_static_string("g-io-error-quark")
-        setattr(Gio.IOErrorEnum, "quark", lambda _self: io_error_quark)
-
     @classmethod
     def tearDownClass(cls):
         cls.test_bus.down()
@@ -1269,17 +1264,27 @@
         mt = TbDomain(host=TbHost([TbDevice("Dock")]))
         return mt
 
-    def assertGError(self, have, want):
+    @staticmethod
+    def assertGError(self, have, want_domain, want_code):
+        if have.domain == want_domain and have.code == int(want_code):
+            return
+
+        msg = "want: [%s (%d)], have [%s]" % (Gio.DBusError, int(want_code), 
have)
+        raise self.failureException(msg)
+
+    def assertGErrorDBusError(self, have, want):
         if hasattr(have, "exception"):
             have = have.exception
 
-        domain = GLib.quark_to_string(want.quark())
-        code = int(want)
-        if have.domain == domain and have.code == code:
-            return
+        domain = GLib.quark_to_string(Gio.DBusError.quark())
+        self.assertGError(self, have, domain, want)
 
-        msg = "want: [%s (%d)], have [%s]" % (want, code, have)
-        raise self.failureException(msg)
+    def assertGErrorIOErrorEnum(self, have, want):
+        if hasattr(have, "exception"):
+            have = have.exception
+
+        domain = GLib.quark_to_string(Gio.io_error_quark())
+        self.assertGError(self, have, domain, want)
 
     def assertDeviceEqual(self, local, remote):
         self.assertTrue(local and remote)
@@ -1601,7 +1606,7 @@
         for remote, uid in remotes:
             with self.assertRaises(GLib.GError) as cm:
                 client.enroll(uid)
-            self.assertGError(cm, Gio.DBusError.ACCESS_DENIED)
+            self.assertGErrorDBusError(cm, Gio.DBusError.ACCESS_DENIED)
 
         # enable the authorization again now
         with client.record() as tape:
@@ -1740,18 +1745,18 @@
         # try to set the bootacl, without PolKit allowing it
         with self.assertRaises(GLib.GError) as cm:
             domain.bootacl = [""]
-        self.assertGError(cm, Gio.DBusError.ACCESS_DENIED)
+        self.assertGErrorDBusError(cm, Gio.DBusError.ACCESS_DENIED)
         self.polkitd.SetAllowed(["org.freedesktop.bolt.manage"])
 
         # try to set an invalid bootacl
         with self.assertRaises(GLib.GError) as cm:
             domain.bootacl = [""]
-        self.assertGError(cm, Gio.IOErrorEnum.INVALID_ARGUMENT)
+        self.assertGErrorIOErrorEnum(cm, Gio.IOErrorEnum.INVALID_ARGUMENT)
 
         # try to set an invalid bootacl, 2nd time
         with self.assertRaises(GLib.GError) as cm:
             domain.bootacl = None
-        self.assertGError(cm, Gio.IOErrorEnum.INVALID_ARGUMENT)
+        self.assertGErrorIOErrorEnum(cm, Gio.IOErrorEnum.INVALID_ARGUMENT)
 
         # remove all entries
         with domain.record() as tape:
@@ -2004,7 +2009,7 @@
             remote = self.client.device_by_uid(d.unique_id)
             with self.assertRaises(GLib.GError) as cm:
                 remote.authorize()
-            self.assertGError(cm, Gio.DBusError.ACCESS_DENIED)
+            self.assertGErrorDBusError(cm, Gio.DBusError.ACCESS_DENIED)
 
         self.polkitd.SetAllowed(["org.freedesktop.bolt.authorize"])
         before = int(time.time())
@@ -2367,7 +2372,7 @@
         for d in to_enroll:
             with self.assertRaises(GLib.GError) as cm:
                 client.enroll(d.unique_id)
-            self.assertGError(cm, Gio.DBusError.ACCESS_DENIED)
+            self.assertGErrorDBusError(cm, Gio.DBusError.ACCESS_DENIED)
 
         self.polkitd.SetAllowed(["org.freedesktop.bolt.enroll"])
 
@@ -2639,7 +2644,7 @@
         for remote in devices:
             with self.assertRaises(GLib.GError) as cm:
                 client.forget(remote.uid)
-            self.assertGError(cm, Gio.DBusError.ACCESS_DENIED)
+            self.assertGErrorDBusError(cm, Gio.DBusError.ACCESS_DENIED)
 
         self.polkitd.SetAllowed(["org.freedesktop.bolt.manage"])
 
@@ -2685,13 +2690,13 @@
 
         with self.assertRaises(GLib.GError) as cm:
             remote.label = "not authorized"
-        self.assertGError(cm, Gio.DBusError.ACCESS_DENIED)
+        self.assertGErrorDBusError(cm, Gio.DBusError.ACCESS_DENIED)
 
         self.polkitd.SetAllowed(["org.freedesktop.bolt.manage"])
         for val in ["", " ", "     "]:
             with self.assertRaises(GLib.GError) as cm:
                 remote.label = val
-            self.assertGError(cm, Gio.DBusError.INVALID_ARGS)
+            self.assertGErrorDBusError(cm, Gio.DBusError.INVALID_ARGS)
 
         self.assertEqual(remote.label, "%s %s" % (local.vendor_name, 
local.device_name))
 
@@ -2731,7 +2736,7 @@
             local.unique_id
         ):
             remote.label = "denied"
-        self.assertGError(cm, Gio.IOErrorEnum.PERMISSION_DENIED)
+        self.assertGErrorIOErrorEnum(cm, Gio.IOErrorEnum.PERMISSION_DENIED)
         self.assertEqual(remote.label, label)
 
         # check store update failures
@@ -2739,7 +2744,7 @@
             local.unique_id
         ):
             remote.policy = "iommu"
-        self.assertGError(cm, Gio.IOErrorEnum.PERMISSION_DENIED)
+        self.assertGErrorIOErrorEnum(cm, Gio.IOErrorEnum.PERMISSION_DENIED)
         self.assertEqual(remote.policy, policy)
 
         self.daemon_stop()
@@ -2768,7 +2773,7 @@
         # we are not allowed to manage the device
         with self.assertRaises(GLib.GError) as cm:
             remote.policy = "iommu"
-        self.assertGError(cm, Gio.DBusError.ACCESS_DENIED)
+        self.assertGErrorDBusError(cm, Gio.DBusError.ACCESS_DENIED)
 
         self.polkitd.SetAllowed(
             ["org.freedesktop.bolt.manage", "org.freedesktop.bolt.enroll"]
@@ -2777,7 +2782,7 @@
         # device is not stored
         with self.assertRaises(GLib.GError) as cm:
             remote.policy = "iommu"
-        self.assertGError(cm, Gio.DBusError.INVALID_ARGS)
+        self.assertGErrorDBusError(cm, Gio.DBusError.INVALID_ARGS)
 
         # enroll the device with manual policy
         policy = BoltClient.POLICY_MANUAL
@@ -2790,7 +2795,7 @@
         # policy is invalid
         with self.assertRaises(GLib.GError) as cm:
             remote.policy = "foobar"
-        self.assertGError(cm, Gio.DBusError.INVALID_ARGS)
+        self.assertGErrorDBusError(cm, Gio.DBusError.INVALID_ARGS)
 
         # store update failure check is done in test_device_store_failures
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/bolt-0.9.9/tests/test-store.c 
new/bolt-0.9.10/tests/test-store.c
--- old/bolt-0.9.9/tests/test-store.c   2025-06-03 10:41:50.000000000 +0200
+++ new/bolt-0.9.10/tests/test-store.c  2025-06-25 04:52:56.000000000 +0200
@@ -929,6 +929,56 @@
 
 }
 
+static void
+test_store_empty_version (TestStore *tt, gconstpointer user_data)
+{
+  g_autoptr(BoltDevice) dev = NULL;
+  g_autoptr(GError) err = NULL;
+  g_autoptr(DIR) root = NULL;
+  g_autofree gchar *path = NULL;
+  g_autofree gchar *version_path = NULL;
+  char uid[] = "fbc83890-e9bf-45e5-a777-b3728490989c";
+  guint version;
+  gboolean ok;
+
+  /* when opening an empty version file, bolt shouldn't exit
+   * #194 */
+
+  root = bolt_opendir (tt->path, &err);
+  g_assert_no_error (err);
+  g_assert_nonnull (root);
+
+  version = bolt_store_get_version (tt->store);
+  g_assert_cmpuint (version, ==, BOLT_STORE_VERSION);
+
+  dev = g_object_new (BOLT_TYPE_DEVICE,
+                      "uid", uid,
+                      "name", "Laptop",
+                      "vendor", "GNOME.org",
+                      "status", BOLT_STATUS_DISCONNECTED,
+                      NULL);
+
+  ok = bolt_store_put_device (tt->store, dev, BOLT_POLICY_AUTO, NULL, &err);
+  g_assert_no_error (err);
+  g_assert_true (ok);
+
+  /* close the store */
+  g_clear_object (&tt->store);
+
+  /* set an empty string to the version file */
+  version_path = g_build_filename (tt->path, "version", NULL);
+  g_file_set_contents (version_path, "", -1, &err);
+  g_assert_no_error (err);
+
+  /* re-create the store object and bolt shouldn't exit */
+  tt->store = bolt_store_new (tt->path, &err);
+  g_assert_no_error (err);
+  g_assert_nonnull (tt->store);
+
+  version = bolt_store_get_version (tt->store);
+  g_assert_cmpuint (version, ==, 1);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -1005,5 +1055,12 @@
               test_store_upgrade,
               test_store_tear_down);
 
+  g_test_add ("/daemon/store/empty-version",
+              TestStore,
+              &test_context,
+              test_store_setup,
+              test_store_empty_version,
+              test_store_tear_down);
+
   return g_test_run ();
 }

Reply via email to