Public bug reported:

The test of bolt fails with the new version due to a crash:
https://autopkgtest.ubuntu.com/results/autopkgtest-impish/impish/amd64/b/bolt/20210917_063952_c9336@/log.gz

...
  Trace/breakpoint trap (core dumped)

The bolt test really uses umockdev, d/t/control has gir1.2-umockdev-1.0 and
python3-dbusmock and the new version causes this.

Retrying autopkgtest locally with no, all and just umockdev from proposed
and it seems reproducible.
 - impish-release - works
 - impish-all-proposed - crashes
 - impish-release + umockdev+libc6 from proposed - crashes

Repro:
$ umockdev-wrapper /usr/libexec/installed-tests/bolt/test-power

FYI:
Downgrading to umockdev 0.16.2-1 in the same environment does not
eliminate the issue. So it might happen at the bolt test-build time.

Debian has the same issue in:
https://ci.debian.net/data/autopkgtest/testing/amd64/b/bolt/15587717/log.gz

The new mockdev fails to create /sys/bus which is requested by the test.
From there the error path is what crashes, but the root cause is why we enter
the error-path in the first place.

One should be aware, this fail is "normal" if the environment is not mocked.
Even in the good case the different calls with/without umockdev lead to
exactly the same crash.
# good
$ umockdev-wrapper /usr/libexec/installed-tests/bolt/test-power
# same crash as the new version has with umockdev-wrapper
$ gdb /usr/libexec/installed-tests/bolt/test-power

This is based on ldpreload.
$ cat /usr/bin/umockdev-wrapper
#!/bin/sh
# Wrapper program to preload the libumockdev library, so that test programs can
# set $UMOCKDEV_DIR for redirecting sysfs and other queries to a test bed.
exec env LD_PRELOAD=libumockdev-preload.so.0:$LD_PRELOAD "$@"

Gut feeling: it seems the mocking no more happens, and due to that
it runs into the non-mocked crash

Debugging with that:
$ pull-lp-source bolt
$ cd bolt-0.9.1/tests
$ gdb /usr/libexec/installed-tests/bolt/test-power
(gdb) set environment LD_PRELOAD libumockdev-preload.so.0
(gdb) b mock_sysfs_init
(gdb) run

With that we can see that while the crash is somewhere inside g_warning the
reason is in the g_mkdir failing with the new umockdev.


Good-case

Breakpoint 1, mock_sysfs_init (ms=0x5555555b6400) at ../tests/mock-sysfs.c:165
165     {
(gdb) n
171       ms->bed = umockdev_testbed_new ();
(gdb) 
[New Thread 0x7ffff6e65640 (LWP 11444)]
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used 
after threads are created
# DEBUG: umockdev.vala:104: Created udev test bed /tmp/umockdev.RQBNA1
172       ms->domains = g_hash_table_new_full (g_str_hash, g_str_equal,
(gdb) 
[New Thread 0x7ffff6664640 (LWP 11445)]
175       ms->devices = g_hash_table_new (g_str_hash, g_str_equal);
(gdb) 
180       sys = umockdev_testbed_get_sys_dir (ms->bed);
(gdb) 
182       bus = g_build_filename (sys, "bus", NULL);
(gdb) p sys
$1 = 0x5555555b99a0 "/tmp/umockdev.RQBNA1/sys"
(gdb) n
183       r = g_mkdir (bus, 0744);
(gdb) p bus
$2 = 0x5555555be330 "/tmp/umockdev.RQBNA1/sys/bus"
(gdb) n
185       if (r < 0)
(gdb) p r
$3 = 0
(gdb) n
188       cls = g_build_filename (sys, "class", NULL);

Bad-Case

Breakpoint 1, mock_sysfs_init (ms=0x5555555b6400) at ../tests/mock-sysfs.c:165
165     {
(gdb) n
171       ms->bed = umockdev_testbed_new ();
(gdb) 
[New Thread 0x7ffff6e65640 (LWP 17082)]
# GLib-DEBUG: setenv()/putenv() are not thread-safe and should not be used 
after threads are created
# DEBUG: umockdev.vala:110: Created udev test bed /tmp/umockdev.TK2VA1
172       ms->domains = g_hash_table_new_full (g_str_hash, g_str_equal,
(gdb) 
[New Thread 0x7ffff6664640 (LWP 17083)]
175       ms->devices = g_hash_table_new (g_str_hash, g_str_equal);
(gdb) 
180       sys = umockdev_testbed_get_sys_dir (ms->bed);
(gdb) 
182       bus = g_build_filename (sys, "bus", NULL);
(gdb) p sys
$1 = 0x5555555a98b0 "/tmp/umockdev.TK2VA1/sys"
(gdb) n
183       r = g_mkdir (bus, 0744);
(gdb) p bus
$2 = 0x5555555be560 "/tmp/umockdev.TK2VA1/sys/bus"
(gdb) n
185       if (r < 0)
(gdb) p r
$3 = -1
(gdb) n
186         g_warning ("could not create %s", bus);
(gdb) n

** (/usr/libexec/installed-tests/bolt/test-power:17078): WARNING **:
15:11:06.614: could not create /tmp/umockdev.TK2VA1/sys/bus

Thread 1 "test-power" received signal SIGTRAP, Trace/breakpoint trap.


I'll tag this update-excuse and FYI-subscribe Martin who has done the Debian 
upload and the Ubuntu sync of this on 16th Sept (post FF).

** Affects: bolt (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: umockdev (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: update-excuse

** Also affects: bolt (Ubuntu)
   Importance: Undecided
       Status: New

** Summary changed:

- 0.16.3-1 breaks autopkgtest of bolt
+ umockdev 0.16.3-1 breaks autopkgtest of bolt

** Tags added: update-excuse

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1945321

Title:
  umockdev 0.16.3-1 breaks autopkgtest of bolt

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bolt/+bug/1945321/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to