Comment 2 for bug 1945321

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Looking at the changelog this looks suspicious:
  - Immediately create "bus" and "class" directories in /sys to fix udev
    enumerator (thanks David Lechner)

That change is at
  https://github.com/martinpitt/umockdev/commit/5e829601434610ef510bda12571291509a3a51d2

And that explains it, the bolt test code wants to create /tmp/umockdev.RQBNA1/sys/bus and it already exists.

Offending code in bolt tests is at:
https://gitlab.freedesktop.org/bolt/bolt/-/blob/master/tests/mock-sysfs.c#L183

Checking that theory in the debugger confirms that - breaking just prior to the failing mkdir.

Good-case
183 r = g_mkdir (bus, 0744);
(gdb) p bus
$4 = 0x5555555be330 "/tmp/umockdev.P7PGA1/sys/bus"
(gdb) shell find /tmp/umockdev.P7PGA1/
/tmp/umockdev.P7PGA1/
/tmp/umockdev.P7PGA1/sys
/tmp/umockdev.P7PGA1/ioctl
/tmp/umockdev.P7PGA1/ioctl/_default

Bad-case
183 r = g_mkdir (bus, 0744);
(gdb) p bus
$4 = 0x5555555be560 "/tmp/umockdev.7MRGA1/sys/bus"
gdb) shell find /tmp/umockdev.7MRGA1/
/tmp/umockdev.7MRGA1/
/tmp/umockdev.7MRGA1/sys
/tmp/umockdev.7MRGA1/sys/bus
/tmp/umockdev.7MRGA1/sys/class
/tmp/umockdev.7MRGA1/ioctl
/tmp/umockdev.7MRGA1/ioctl/_default

So we either need to stop umockdev from doing that (but that will break whatever it fixed to introduce this) OR we need to teach bolt tests to be ok, if the directory already exists.