Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package libtracefs for openSUSE:Factory 
checked in at 2022-12-16 21:26:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libtracefs (Old)
 and      /work/SRC/openSUSE:Factory/.libtracefs.new.1835 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libtracefs"

Fri Dec 16 21:26:08 2022 rev:10 rq:1043363 version:1.6.3

Changes:
--------
--- /work/SRC/openSUSE:Factory/libtracefs/libtracefs.changes    2022-11-25 
13:22:54.607600524 +0100
+++ /work/SRC/openSUSE:Factory/.libtracefs.new.1835/libtracefs.changes  
2022-12-16 21:26:10.399810815 +0100
@@ -1,0 +2,10 @@
+Fri Dec 16 15:06:03 UTC 2022 - Jan Engelhardt <jeng...@inai.de>
+
+- Update to release 1.6.3
+  * Fix a regression of where tracefs_tracing_dir() did not mount
+    the tracefs file system if it was not already mounted.
+    Same for mounting debugfs with tracefs_debug_dir().
+  * Have tracefs_tracing_dir() and tracefs_debug_dir() check if the
+    cached directory still exists and is mounted.
+
+-------------------------------------------------------------------

Old:
----
  libtracefs-1.6.1.tar.gz

New:
----
  libtracefs-1.6.3.tar.gz

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

Other differences:
------------------
++++++ libtracefs.spec ++++++
--- /var/tmp/diff_new_pack.gDW4ZZ/_old  2022-12-16 21:26:10.863813524 +0100
+++ /var/tmp/diff_new_pack.gDW4ZZ/_new  2022-12-16 21:26:10.867813547 +0100
@@ -18,7 +18,7 @@
 
 Name:           libtracefs
 %define lname   libtracefs1
-Version:        1.6.1
+Version:        1.6.3
 Release:        0
 Summary:        Linux kernel trace file system library
 License:        LGPL-2.1-only

++++++ libtracefs-1.6.1.tar.gz -> libtracefs-1.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libtracefs-1.6.1/Makefile 
new/libtracefs-1.6.3/Makefile
--- old/libtracefs-1.6.1/Makefile       2022-11-16 18:06:45.000000000 +0100
+++ new/libtracefs-1.6.3/Makefile       2022-12-12 00:01:44.000000000 +0100
@@ -2,7 +2,7 @@
 # libtracefs version
 TFS_VERSION = 1
 TFS_PATCHLEVEL = 6
-TFS_EXTRAVERSION = 1
+TFS_EXTRAVERSION = 3
 TRACEFS_VERSION = $(TFS_VERSION).$(TFS_PATCHLEVEL).$(TFS_EXTRAVERSION)
 
 export TFS_VERSION
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libtracefs-1.6.1/src/tracefs-utils.c 
new/libtracefs-1.6.3/src/tracefs-utils.c
--- old/libtracefs-1.6.1/src/tracefs-utils.c    2022-11-16 18:06:45.000000000 
+0100
+++ new/libtracefs-1.6.3/src/tracefs-utils.c    2022-12-12 00:01:44.000000000 
+0100
@@ -85,7 +85,8 @@
        return ret;
 }
 
-static char *find_tracing_dir(bool debugfs, bool mount)
+/* Exported for testing purpose only */
+__hidden char *find_tracing_dir(bool debugfs, bool mount)
 {
        char *debug_str = NULL;
        char fspath[PATH_MAX+1];
@@ -229,6 +230,16 @@
        return 0;
 }
 
+/* Used to check if the directory is still mounted */
+static int test_dir(const char *dir, const char *file)
+{
+       char path[strlen(dir) + strlen(file) + 2];
+       struct stat st;
+
+       sprintf(path, "%s/%s", dir, file);
+       return stat(path, &st) < 0 ? 0 : 1;
+}
+
 /**
  * tracefs_tracing_dir - Get tracing directory
  *
@@ -239,13 +250,14 @@
 {
        static const char *tracing_dir;
 
+       /* Do not check custom_tracing_dir */
        if (custom_tracing_dir)
                return custom_tracing_dir;
 
-       if (tracing_dir)
+       if (tracing_dir && test_dir(tracing_dir, "trace"))
                return tracing_dir;
 
-       tracing_dir = trace_find_tracing_dir(false);
+       tracing_dir = find_tracing_dir(false, true);
        return tracing_dir;
 }
 
@@ -260,10 +272,10 @@
 {
        static const char *debug_dir;
 
-       if (debug_dir)
+       if (debug_dir && test_dir(debug_dir, "tracing"))
                return debug_dir;
 
-       debug_dir = trace_find_tracing_dir(true);
+       debug_dir = find_tracing_dir(true, true);
        return debug_dir;
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/libtracefs-1.6.1/utest/tracefs-utest.c 
new/libtracefs-1.6.3/utest/tracefs-utest.c
--- old/libtracefs-1.6.1/utest/tracefs-utest.c  2022-11-16 18:06:45.000000000 
+0100
+++ new/libtracefs-1.6.3/utest/tracefs-utest.c  2022-12-12 00:01:44.000000000 
+0100
@@ -15,6 +15,8 @@
 #include <kbuffer.h>
 #include <pthread.h>
 
+#include <sys/mount.h>
+
 #include <CUnit/CUnit.h>
 #include <CUnit/Basic.h>
 
@@ -47,6 +49,10 @@
 #define SQL_5_SQL      "select end.common_pid as pid, 
(end.common_timestamp.usecs - start.common_timestamp.usecs) as irq_lat from 
irq_disable as start join irq_enable as end on start.common_pid = 
end.common_pid, start.parent_offs == end.parent_offs where start.common_pid != 
0"
 #define SQL_5_START    "irq_disable"
 
+#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
+#define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing"
+#define TRACEFS_DEFAULT2_PATH "/sys/kernel/debug/tracing"
+
 static struct tracefs_instance *test_instance;
 static struct tep_handle *test_tep;
 struct test_sample {
@@ -740,6 +746,92 @@
        test_instance_follow_events(test_instance);
 }
 
+extern char *find_tracing_dir(bool debugfs, bool mount);
+static void test_mounting(void)
+{
+       const char *tracing_dir;
+       const char *debug_dir;
+       struct stat st;
+       char *save_tracing = NULL;
+       char *save_debug = NULL;
+       char *path;
+       char *dir;
+       int ret;
+
+       /* First, unmount all instances of debugfs */
+       do {
+               dir = find_tracing_dir(true, false);
+               if (dir) {
+                       ret = umount(dir);
+                       CU_TEST(ret == 0);
+                       if (ret < 0)
+                               return;
+                       /* Save the first instance that's not /sys/kernel/debug 
*/
+                       if (!save_debug && strcmp(dir, DEBUGFS_DEFAULT_PATH) != 
0)
+                               save_debug = dir;
+                       else
+                               free(dir);
+               }
+       } while (dir);
+
+       /* Next, unmount all instances of tracefs */
+       do {
+               dir = find_tracing_dir(false, false);
+               if (dir) {
+                       ret = umount(dir);
+                       CU_TEST(ret == 0);
+                       if (ret < 0)
+                               return;
+                       /* Save the first instance that's not in /sys/kernel/ */
+                       if (!save_tracing && strncmp(dir, "/sys/kernel/", 12) 
!= 0)
+                               save_tracing = dir;
+                       else
+                               free(dir);
+               }
+       } while (dir);
+
+       /* Mount first the tracing dir (which should mount at 
/sys/kernel/tracing */
+       tracing_dir = tracefs_tracing_dir();
+       CU_TEST(tracing_dir != NULL);
+       if (tracing_dir != NULL) {
+               CU_TEST(strcmp(tracing_dir, TRACEFS_DEFAULT_PATH) == 0 ||
+                       strcmp(tracing_dir, TRACEFS_DEFAULT2_PATH) == 0);
+               if (strncmp(tracing_dir, "/sys/kernel/", 12) != 0)
+                       printf("Tracing directory mounted at '%s'\n",
+                              tracing_dir);
+
+               /* Make sure the directory has content.*/
+               asprintf(&path, "%s/trace", tracing_dir);
+               CU_TEST(stat(path, &st) == 0);
+               free(path);
+       }
+
+       /* Now mount debugfs dir, which should mount at /sys/kernel/debug */
+       debug_dir = tracefs_debug_dir();
+       CU_TEST(debug_dir != NULL);
+       if (debug_dir != NULL) {
+               CU_TEST(strcmp(debug_dir, DEBUGFS_DEFAULT_PATH) == 0);
+               if (strcmp(debug_dir, DEBUGFS_DEFAULT_PATH) != 0)
+                       printf("debug directory mounted at '%s'\n",
+                              debug_dir);
+
+               /* Make sure the directory has content.*/
+               asprintf(&path, "%s/tracing", debug_dir);
+               CU_TEST(stat(path, &st) == 0);
+               free(path);
+       }
+
+       if (save_debug)
+               mount("debugfs", save_debug, "debugfs", 0, NULL);
+
+       if (save_tracing &&
+           (!save_debug || strncmp(save_debug, save_tracing, 
strlen(save_debug) != 0)))
+               mount("tracefs", save_tracing, "tracefs", 0, NULL);
+
+       free(save_debug);
+       free(save_tracing);
+}
+
 static int read_trace_cpu_file(struct test_cpu_data *data)
 {
        unsigned long long ts;
@@ -2248,7 +2340,8 @@
                fprintf(stderr, "Suite \"%s\" cannot be ceated\n", 
TRACEFS_SUITE);
                return;
        }
-       CU_add_test(suite, "Follow events", test_follow_events);
+
+       CU_add_test(suite, "Test tracefs/debugfs mounting", test_mounting);
        CU_add_test(suite, "trace cpu read",
                    test_trace_cpu_read);
        CU_add_test(suite, "trace cpu pipe",
@@ -2265,6 +2358,10 @@
                    test_system_event);
        CU_add_test(suite, "tracefs_iterate_raw_events API",
                    test_iter_raw_events);
+
+       /* Follow events test must be after the iterate raw events above */
+       CU_add_test(suite, "Follow events", test_follow_events);
+
        CU_add_test(suite, "tracefs_tracers API",
                    test_tracers);
        CU_add_test(suite, "tracefs_local events API",

Reply via email to