Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package umockdev for openSUSE:Factory 
checked in at 2024-11-12 19:19:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/umockdev (Old)
 and      /work/SRC/openSUSE:Factory/.umockdev.new.2017 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "umockdev"

Tue Nov 12 19:19:53 2024 rev:22 rq:1223400 version:0.18.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/umockdev/umockdev.changes        2024-10-14 
13:06:23.998670921 +0200
+++ /work/SRC/openSUSE:Factory/.umockdev.new.2017/umockdev.changes      
2024-11-12 19:20:06.048147988 +0100
@@ -1,0 +2,10 @@
+Thu Oct 31 14:19:29 UTC 2024 - Eugenio Paolantonio 
<eugenio.paolanto...@suse.com>
+
+- Add 0001-t_system_single-handle-missing-selinux-context.patch:
+  * tests: umockdev-record: t_system_single: handle missing
+    SELinux context on /dev/null (Cherry-picked from commit
+    f5c3a2e4ecbb2ab733b19b0bf84c8334cedd8ba2)
+  * Fixes testsuite failure in SLFO.
+- Move to the %autosetup macro
+
+-------------------------------------------------------------------

New:
----
  0001-t_system_single-handle-missing-selinux-context.patch

BETA DEBUG BEGIN:
  New:
- Add 0001-t_system_single-handle-missing-selinux-context.patch:
  * tests: umockdev-record: t_system_single: handle missing
BETA DEBUG END:

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

Other differences:
------------------
++++++ umockdev.spec ++++++
--- /var/tmp/diff_new_pack.XA0fAv/_old  2024-11-12 19:20:06.584170446 +0100
+++ /var/tmp/diff_new_pack.XA0fAv/_new  2024-11-12 19:20:06.588170614 +0100
@@ -25,6 +25,8 @@
 License:        LGPL-2.1-or-later
 URL:            https://github.com/martinpitt/umockdev/
 Source:         
https://github.com/martinpitt/umockdev/releases/download/%{version}/%{name}-%{version}.tar.xz
+# PATCH-FIX-UPSTREAM 0001-t_system_single-handle-missing-selinux-context.patch 
gh#martinpitt/umockdev#256 eugenio.paolanto...@suse.com -- tests: 
umockdev-record: t_system_single: handle missing SELinux context on /dev/null
+Patch1:         0001-t_system_single-handle-missing-selinux-context.patch
 BuildRequires:  cmake
 BuildRequires:  gtk-doc
 BuildRequires:  meson
@@ -90,7 +92,7 @@
 umockdev.
 
 %prep
-%setup -q
+%autosetup -p1
 
 %build
 %meson

++++++ 0001-t_system_single-handle-missing-selinux-context.patch ++++++
>From f5c3a2e4ecbb2ab733b19b0bf84c8334cedd8ba2 Mon Sep 17 00:00:00 2001
From: Eugenio Paolantonio <eugenio.paolanto...@suse.com>
Date: Wed, 30 Oct 2024 14:15:30 +0100
Subject: [PATCH] tests: umockdev-record: t_system_single: handle missing
 SELinux context on /dev/null

/sys/fs/selinux might exist, yet the checked path might have no
context defined.

Drop the check for the selinux pseudo-fs, and check the eventual
errno if lgetfilecon() fails.

On ENODATA (context doesn't exist, or the process can't access it),
ENOTSUP (extended attributes not supported/disabled) and ENOSYS
(lgetxattr syscall used by lgetfilecon() not available), ensure
__DEVCONTEXT is not there and continue.

On every other error, fail the test case as before.

Signed-off-by: Eugenio Paolantonio <eugenio.paolanto...@suse.com>
---
 tests/test-umockdev-record.vala | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/tests/test-umockdev-record.vala b/tests/test-umockdev-record.vala
index 8672ee1..2c362fa 100644
--- a/tests/test-umockdev-record.vala
+++ b/tests/test-umockdev-record.vala
@@ -201,13 +201,25 @@ t_system_single ()
     assert_in("P: /devices/virtual/mem/null", sout);
     assert_in("E: DEVNAME=/dev/zero", sout);
 #if HAVE_SELINUX
-    // we may run on a system without SELinux
-    if (FileUtils.test("/sys/fs/selinux", FileTest.EXISTS)) {
-        string context;
-        assert_cmpint (Selinux.lgetfilecon ("/dev/null", out context), 
CompareOperator.GT, 0);
-        assert_in("E: __DEVCONTEXT=" + context + "\n", sout);
+    string context;
+    int res = Selinux.lgetfilecon ("/dev/null", out context);
+    if (res > 0) {
+        assert_in ("E: __DEVCONTEXT=" + context + "\n", sout);
+    } else if (res == -1 && (Posix.errno == Posix.ENODATA ||
+                             Posix.errno == Posix.ENOTSUP ||
+                             Posix.errno == Posix.ENOSYS)) {
+        // If SELinux is not available, or is available but
+        // there is no context defined for /dev/null,
+        // we should skip this check as there is
+        // no context recorded.
+        //
+        // ENODATA: context doesn't exist, or the process
+        //          can't access it
+        // ENOTSUP: extended attributes not supported/disabled
+        // ENOSYS:  lgetxattr syscall not available
+        assert (!sout.contains("E: __DEVCONTEXT"));
     } else {
-        assert(!sout.contains("E: __DEVCONTEXT"));
+        assert_cmpint (res, CompareOperator.GT, 0);
     }
 #endif
 }

Reply via email to