Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package umockdev for openSUSE:Factory checked in at 2022-04-02 18:20:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/umockdev (Old) and /work/SRC/openSUSE:Factory/.umockdev.new.1900 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "umockdev" Sat Apr 2 18:20:27 2022 rev:10 rq:965656 version:0.17.8 Changes: -------- --- /work/SRC/openSUSE:Factory/umockdev/umockdev.changes 2022-02-11 23:07:23.890603952 +0100 +++ /work/SRC/openSUSE:Factory/.umockdev.new.1900/umockdev.changes 2022-04-02 18:20:38.786203789 +0200 @@ -1,0 +2,9 @@ +Sat Mar 26 22:34:05 UTC 2022 - Atri Bhattacharya <badshah...@gmail.com> + +- Update to version 0.17.8: + * Fix some potential crashes spotted by Coverity. +- Change from version 0.17.7: + * Fix uevent race condition in + umockdev_testbed_add_from_string(). + +------------------------------------------------------------------- Old: ---- umockdev-0.17.6.tar.xz New: ---- umockdev-0.17.8.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ umockdev.spec ++++++ --- /var/tmp/diff_new_pack.XiTWwE/_old 2022-04-02 18:20:39.302197997 +0200 +++ /var/tmp/diff_new_pack.XiTWwE/_new 2022-04-02 18:20:39.310197907 +0200 @@ -19,7 +19,7 @@ %define shlib libumockdev0 %define shlibpre libumockdev-preload0 Name: umockdev -Version: 0.17.6 +Version: 0.17.8 Release: 0 Summary: Mock hardware devices for creating unit tests and bug reporting License: LGPL-2.1-or-later ++++++ umockdev-0.17.6.tar.xz -> umockdev-0.17.8.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/NEWS new/umockdev-0.17.8/NEWS --- old/umockdev-0.17.6/NEWS 2022-01-21 13:19:11.024681800 +0100 +++ new/umockdev-0.17.8/NEWS 2022-03-23 10:16:41.783421000 +0100 @@ -1,3 +1,10 @@ +## [0.17.8] - 2022-03-23 +- Fix some potential crashes spotted by Coverity +- Enable Fedora builds and bodhi updates via packit + +## [0.17.7] - 2022-03-01 +- Fix uevent race condition in umockdev_testbed_add_from_string() + ## [0.17.6] - 2022-01-21 - Increase uevent buffer size (#167) - Skip /umockdev-testbed-vala/detects_running_outside_testbed during normal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/packit.yaml new/umockdev-0.17.8/packit.yaml --- old/umockdev-0.17.6/packit.yaml 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/packit.yaml 2022-03-23 10:16:41.791421200 +0100 @@ -6,7 +6,8 @@ upstream_package_name: umockdev downstream_package_name: umockdev -synced_files: +files_to_sync: + - packit.yaml - src: packaging/umockdev.spec dest: umockdev.spec @@ -28,3 +29,15 @@ dist_git_branches: - fedora-development - fedora-stable + + - job: koji_build + trigger: commit + metadata: + dist_git_branches: + - fedora-all + + - job: bodhi_update + trigger: commit + metadata: + dist_git_branches: + - fedora-all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/src/libumockdev-preload.c new/umockdev-0.17.8/src/libumockdev-preload.c --- old/umockdev-0.17.6/src/libumockdev-preload.c 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/src/libumockdev-preload.c 2022-03-23 10:16:41.791421200 +0100 @@ -215,12 +215,15 @@ /* read major:minor */ orig_errno = errno; - if (readlink(buf, link, sizeof(link)) < 0) { + ssize_t link_len = readlink(buf, link, sizeof(link)); + if (link_len < 0) { DBG(DBG_PATH, "get_rdev %s: cannot read link %s: %m\n", nodename, buf); errno = orig_errno; return false; } + link[link_len] = '\0'; errno = orig_errno; + if (sscanf(link, "%u:%u", major, minor) != 2) { DBG(DBG_PATH, "get_rdev %s: cannot decode major/minor from '%s'\n", nodename, link); return false; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/src/uevent_sender.c new/umockdev-0.17.8/src/uevent_sender.c --- old/umockdev-0.17.6/src/uevent_sender.c 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/src/uevent_sender.c 2022-03-23 10:16:41.791421200 +0100 @@ -68,7 +68,7 @@ } static void -sendmsg_one(struct msghdr *msg, const char *path) +sendmsg_one(struct iovec *iov, size_t iov_len, const char *path) { struct sockaddr_un event_addr; int fd; @@ -97,14 +97,14 @@ abort(); } - msg->msg_name = &event_addr; - /* count = */ sendmsg(fd, msg, 0); + const struct msghdr msg = { .msg_name = &event_addr, .msg_iov = iov, .msg_iovlen = iov_len }; + /* count = */ sendmsg(fd, &msg, 0); /* printf("passed %zi bytes to event socket %s\n", count, path); */ close(fd); } static void -sendmsg_all(uevent_sender * sender, struct msghdr *msg) +sendmsg_all(uevent_sender * sender, struct iovec *iov, size_t iov_len) { glob_t gl; int res; @@ -114,7 +114,7 @@ if (res == 0) { size_t i; for (i = 0; i < gl.gl_pathc; ++i) - sendmsg_one(msg, gl.gl_pathv[i]); + sendmsg_one(iov, iov_len, gl.gl_pathv[i]); } else { /* ensure that we only fail due to that, not due to bad globs */ if (res != GLOB_NOMATCH) { @@ -230,7 +230,6 @@ { char buffer[UEVENT_BUFSIZE]; size_t buffer_len = 0; - struct msghdr smsg; struct iovec iov[2]; const char *subsystem; const char *devtype; @@ -295,9 +294,5 @@ iov[1].iov_len = buffer_len; /* send message */ - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = iov; - smsg.msg_iovlen = 2; - - sendmsg_all(sender, &smsg); + sendmsg_all(sender, iov, 2); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/src/umockdev.vala new/umockdev-0.17.8/src/umockdev.vala --- old/umockdev-0.17.6/src/umockdev.vala 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/src/umockdev.vala 2022-03-23 10:16:41.795421400 +0100 @@ -394,41 +394,9 @@ this.set_property(devpath, name, "%x".printf(value)); } - /** - * umockdev_testbed_add_devicev: - * @self: A #UMockdevTestbed. - * @subsystem: The subsystem name, e. g. "usb" - * @name: The device name; arbitrary, but needs to be unique within the testbed - * @parent: (allow-none): device path of the parent device. Use %NULL for a - * top-level device. - * @attributes: (array zero-terminated=1): - * A list of device sysfs attributes, alternating names and - * values, terminated with %NULL: - * { "key1", "value1", "key2", "value2", ..., NULL } - * @properties: (array zero-terminated=1): - * A list of device udev properties; same format as @attributes - * - * This method is mostly meant for language bindings (where it is named - * umockdev_testbed_add_device()). For C programs it is usually more convenient to - * use umockdev_testbed_add_device(). - * - * Add a new device to the testbed. A Linux kernel device always has a - * subsystem (such as "usb" or "pci"), and a device name. The test bed only - * builds a very simple sysfs structure without nested namespaces, so it - * requires device names to be unique. Some gudev client programs might make - * assumptions about the name (e. g. a SCSI disk block device should be called - * sdaN). A device also has an arbitrary number of sysfs attributes and udev - * properties; usually you should specify them upon creation, but it is also - * possible to change them later on with umockdev_testbed_set_attribute() and - * umockdev_testbed_set_property(). - * - * Returns: The sysfs path for the newly created device. Free with g_free(). - * - * Rename to: umockdev_testbed_add_device - */ - public string? add_devicev(string subsystem, string name, string? parent, - [CCode(array_null_terminated=true, array_length=false)] string[] attributes, - [CCode(array_null_terminated=true, array_length=false)] string[] properties) + private string? add_devicev_no_uevent(string subsystem, string name, string? parent, + [CCode(array_null_terminated=true, array_length=false)] string[] attributes, + [CCode(array_null_terminated=true, array_length=false)] string[] properties) { string dev_path; string? dev_node = null; @@ -533,7 +501,50 @@ if (attributes.length % 2 != 0) warning("add_devicev: Ignoring attribute key '%s' without value", attributes[attributes.length-1]); - if (in_mock_environment ()) + return dev_path; + } + + /** + * umockdev_testbed_add_devicev: + * @self: A #UMockdevTestbed. + * @subsystem: The subsystem name, e. g. "usb" + * @name: The device name; arbitrary, but needs to be unique within the testbed + * @parent: (allow-none): device path of the parent device. Use %NULL for a + * top-level device. + * @attributes: (array zero-terminated=1): + * A list of device sysfs attributes, alternating names and + * values, terminated with %NULL: + * { "key1", "value1", "key2", "value2", ..., NULL } + * @properties: (array zero-terminated=1): + * A list of device udev properties; same format as @attributes + * + * This method is mostly meant for language bindings (where it is named + * umockdev_testbed_add_device()). For C programs it is usually more convenient to + * use umockdev_testbed_add_device(). + * + * Add a new device to the testbed. A Linux kernel device always has a + * subsystem (such as "usb" or "pci"), and a device name. The test bed only + * builds a very simple sysfs structure without nested namespaces, so it + * requires device names to be unique. Some gudev client programs might make + * assumptions about the name (e. g. a SCSI disk block device should be called + * sdaN). A device also has an arbitrary number of sysfs attributes and udev + * properties; usually you should specify them upon creation, but it is also + * possible to change them later on with umockdev_testbed_set_attribute() and + * umockdev_testbed_set_property(). + * + * This will synthesize an "add" uevent. + * + * Returns: The sysfs path for the newly created device. Free with g_free(). + * + * Rename to: umockdev_testbed_add_device + */ + public string? add_devicev(string subsystem, string name, string? parent, + [CCode(array_null_terminated=true, array_length=false)] string[] attributes, + [CCode(array_null_terminated=true, array_length=false)] string[] properties) + { + string? dev_path = this.add_devicev_no_uevent(subsystem, name, parent, attributes, properties); + + if (dev_path != null && in_mock_environment ()) uevent(dev_path, "add"); return dev_path; @@ -560,6 +571,8 @@ * possible to change them later on with umockdev_testbed_set_attribute() and * umockdev_testbed_set_property(). * + * This will synthesize an "add" uevent. + * * Example: * |[ * umockdev_testbed_add_device (testbed, "usb", "dev1", NULL, @@ -1348,9 +1361,9 @@ throw new UMockdev.Error.VALUE("missing SUBSYSTEM property in description of device %s", devpath); debug("creating device %s (subsystem %s)", devpath, subsystem); - string syspath = this.add_devicev(subsystem, - devpath.substring(9), // chop off "/devices/" - null, attrs, props); + string syspath = this.add_devicev_no_uevent(subsystem, + devpath.substring(9), // chop off "/devices/" + null, attrs, props); /* add binary attributes */ for (int i = 0; i < binattrs.length; i += 2) @@ -1377,6 +1390,9 @@ while (cur_data[0] != '\0' && cur_data[0] == '\n') cur_data = cur_data.next_char(); + if (in_mock_environment ()) + uevent(syspath, "add"); + return cur_data; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/tests/run-alpine new/umockdev-0.17.8/tests/run-alpine --- old/umockdev-0.17.6/tests/run-alpine 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/tests/run-alpine 2022-03-23 10:16:41.795421400 +0100 @@ -20,6 +20,7 @@ # run build as user su -s /bin/sh - guest << EOG set -ex +export BRITTLE_TESTS="${BRITTLE_TESTS:-}" cd /source meson setup /tmp/dbg --buildtype debug --werror meson test -C /tmp/dbg -v --num-processes=1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/tests/run-apt new/umockdev-0.17.8/tests/run-apt --- old/umockdev-0.17.6/tests/run-apt 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/tests/run-apt 2022-03-23 10:16:41.795421400 +0100 @@ -28,12 +28,13 @@ eatmydata apt-get -y --purge dist-upgrade # install build and test dependencies -eatmydata apt-get install -y --no-install-recommends meson git pkg-config valac libglib2.0-dev libudev-dev libgudev-1.0-dev libpcap-dev python3-gi gobject-introspection libgirepository1.0-dev gir1.2-glib-2.0 gir1.2-gudev-1.0 gtk-doc-tools udev xserver-xorg-video-dummy xserver-xorg-input-evdev xserver-xorg-input-synaptics xinput usbutils evtest gphoto2 valgrind +eatmydata apt-get install -y --no-install-recommends meson git pkg-config valac libglib2.0-dev libudev-dev libgudev-1.0-dev libpcap-dev python3-gi gobject-introspection libgirepository1.0-dev gir1.2-glib-2.0 gir1.2-gudev-1.0 gtk-doc-tools udev xserver-xorg-video-dummy xserver-xorg-input-evdev xserver-xorg-input-synaptics xinput procps usbutils evtest gphoto2 valgrind # run build as user useradd build su -s /bin/sh - build << EOG set -ex +export BRITTLE_TESTS="${BRITTLE_TESTS:-}" cd /source meson setup /tmp/dbg --buildtype debug --prefix /usr -Dgtk_doc=true --werror cd /tmp/dbg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/tests/run-dnf new/umockdev-0.17.8/tests/run-dnf --- old/umockdev-0.17.6/tests/run-dnf 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/tests/run-dnf 2022-03-23 10:16:41.795421400 +0100 @@ -37,6 +37,7 @@ useradd guest su -s /bin/sh - guest << EOG set -eux +export BRITTLE_TESTS="${BRITTLE_TESTS:-}" cd /source CFLAGS="\$(grep -q rawhide /etc/os-release && echo -fanalyzer)" meson setup /tmp/dbg --buildtype debug --prefix /usr -Dgtk_doc=\${gtk_doc} -Db_coverage=\$coverage --werror diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/tests/test-umockdev-run.vala new/umockdev-0.17.8/tests/test-umockdev-run.vala --- old/umockdev-0.17.6/tests/test-umockdev-run.vala 2022-01-21 13:19:11.036682000 +0100 +++ new/umockdev-0.17.8/tests/test-umockdev-run.vala 2022-03-23 10:16:41.795421400 +0100 @@ -56,18 +56,6 @@ } static bool -skip_brittle_test (string reason) -{ - if (Environment.get_variable ("BRITTLE_TESTS") == null) { - stdout.printf ("[SKIP: brittle test: %s] ", reason); - stdout.flush (); - return true; - } - - return false; -} - -static bool have_program (string program) { string sout; @@ -376,6 +364,9 @@ """); } +/* + broken: URB structure apparently got more flexible a while ago; triggers assertion about submit_node != NULL + static bool check_gphoto_version () { @@ -403,9 +394,6 @@ if (!check_gphoto_version ()) return; - if (skip_brittle_test ("URB structure apparently got more flexible; triggers assertion about submit_node != NULL")) - return; - check_program_out ("gphoto2", "-d " + rootdir + "/devices/cameras/canon-powershot-sx200.umockdev -i /dev/bus/usb/001/011=" + rootdir + "/devices/cameras/canon-powershot-sx200.ioctl -- gphoto2 -l", @@ -425,9 +413,6 @@ if (!check_gphoto_version ()) return; - if (skip_brittle_test ("URB structure apparently got more flexible; triggers assertion about submit_node != NULL")) - return; - check_program_out ("gphoto2", "-d " + rootdir + "/devices/cameras/canon-powershot-sx200.umockdev -i /dev/bus/usb/001/011=" + rootdir + "/devices/cameras/canon-powershot-sx200.ioctl -- gphoto2 -L", @@ -450,9 +435,6 @@ if (!check_gphoto_version ()) return; - if (skip_brittle_test ("URB structure apparently got more flexible; triggers assertion about submit_node != NULL")) - return; - get_program_out ("gphoto2", umockdev_run_command + "-d " + rootdir + "/devices/cameras/canon-powershot-sx200.umockdev -i /dev/bus/usb/001/011=" + rootdir + "/devices/cameras/canon-powershot-sx200.ioctl -- gphoto2 -T", @@ -481,9 +463,6 @@ if (!check_gphoto_version ()) return; - if (skip_brittle_test ("URB structure apparently got more flexible; triggers assertion about submit_node != NULL")) - return; - get_program_out ("gphoto2", umockdev_run_command + "-d " + rootdir + "/devices/cameras/canon-powershot-sx200.umockdev -i /dev/bus/usb/001/011=" + rootdir + "/devices/cameras/canon-powershot-sx200.ioctl -- gphoto2 -P", @@ -503,6 +482,8 @@ FileUtils.remove ("IMG_0002.JPG"); } +*/ + static void t_input_touchpad () { @@ -566,11 +547,18 @@ Posix.kill (xorg_pid, Posix.SIGQUIT); Posix.kill (xorg_pid, Posix.SIGKILL); #endif + try { + Process.spawn_sync (null, {"pkill", "-9", "-f", "Xorg.*/tests/xorg-dummy.conf"}, null, SpawnFlags.SEARCH_PATH, null, null, null, null); + } catch (Error e) {} + int status; Posix.waitpid (xorg_pid, out status, 0); Process.close_pid (xorg_pid); FileUtils.remove (logfile); FileUtils.remove (logfile + ".old"); + // clean up lockfile after killed X server + FileUtils.remove ("/tmp/.X5-lock"); + FileUtils.remove ("/tmp/.X11-unix/X5"); assert_cmpstr (xinput_err, CompareOperator.EQ, ""); assert_cmpint (xinput_exit, CompareOperator.EQ, 0); @@ -784,10 +772,12 @@ // tests with gphoto2 program for PowerShot Test.add_func ("/umockdev-run/integration/gphoto-detect", t_gphoto_detect); + /* Test.add_func ("/umockdev-run/integration/gphoto-folderlist", t_gphoto_folderlist); Test.add_func ("/umockdev-run/integration/gphoto-filelist", t_gphoto_filelist); Test.add_func ("/umockdev-run/integration/gphoto-thumbs", t_gphoto_thumbs); Test.add_func ("/umockdev-run/integration/gphoto-download", t_gphoto_download); + */ // input devices Test.add_func ("/umockdev-run/integration/input-touchpad", t_input_touchpad); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/tests/test-umockdev-vala.vala new/umockdev-0.17.8/tests/test-umockdev-vala.vala --- old/umockdev-0.17.6/tests/test-umockdev-vala.vala 2022-01-21 13:19:11.040682000 +0100 +++ new/umockdev-0.17.8/tests/test-umockdev-vala.vala 2022-03-23 10:16:41.795421400 +0100 @@ -793,12 +793,6 @@ void t_detects_not_running_in_testbed () { - if (Environment.get_variable ("BRITTLE_TESTS") == null) { - stdout.printf ("[SKIP: brittle test: does not work on emulated architectures] "); - stdout.flush (); - return; - } - int pipefds[2]; assert_cmpint (Posix.pipe(pipefds), CompareOperator.EQ, 0); @@ -808,8 +802,10 @@ if (pid == 0) { Posix.close(pipefds[0]); GLib.Environment.unset_variable("LD_PRELOAD"); - string[] argv = { "--test-outside-testbed", pipefds[1].to_string() }; - Posix.execv("/proc/self/exe", argv); + string myexe = Posix.realpath("/proc/self/exe"); + string[] argv = { myexe, "--test-outside-testbed", pipefds[1].to_string() }; + Posix.execv(myexe, argv); + error ("execv /proc/self/exe = %s failed: %m", myexe); } Posix.close(pipefds[1]); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/umockdev-0.17.6/tests/test-umockdev.c new/umockdev-0.17.8/tests/test-umockdev.c --- old/umockdev-0.17.6/tests/test-umockdev.c 2022-01-21 13:19:11.040682000 +0100 +++ new/umockdev-0.17.8/tests/test-umockdev.c 2022-03-23 10:16:41.795421400 +0100 @@ -646,7 +646,6 @@ struct udev_monitor *mon; struct udev_device *device; const int num_events = 10; - int i; /* set up monitor */ udev = udev_new(); @@ -658,20 +657,22 @@ g_assert_cmpint(udev_monitor_filter_update(mon), ==, 0); g_assert_cmpint(udev_monitor_enable_receiving(mon), ==, 0); - g_autofree gchar *syspath = umockdev_testbed_add_device( - fixture->testbed, "pci", "mydev", NULL, - /* attributes */ - "idVendor", "0815", NULL, - /* properties */ - "ID_INPUT", "1", "DEVTYPE", "fancy", NULL); - g_assert(syspath); + gboolean success = umockdev_testbed_add_from_string( + fixture->testbed, + "P: /devices/mydev\n" + "E: SUBSYSTEM=pci\n" + "A: idVendor=0815\n" + "E: ID_INPUT=1\n" + "E: DEVTYPE=fancy\n", NULL); + g_assert (success); + const gchar *syspath = "/sys/devices/mydev"; /* queue a bunch of events */ - for (i = 0; i < num_events; ++i) + for (int i = 0; i < num_events; ++i) umockdev_testbed_uevent(fixture->testbed, syspath, "change"); /* check that they are on the monitors */ - /* first, the add event from add_device() */ + /* first, the add event from add_from_string() */ device = udev_monitor_receive_device(mon); g_assert(device != NULL); g_assert_cmpstr(udev_device_get_syspath(device), ==, syspath); @@ -680,7 +681,7 @@ g_assert_cmpstr(udev_device_get_devtype(device), ==, "fancy"); udev_device_unref(device); /* now the change events */ - for (i = 0; i < num_events; ++i) { + for (int i = 0; i < num_events; ++i) { device = udev_monitor_receive_device(mon); g_assert(device != NULL); g_assert_cmpstr(udev_device_get_syspath(device), ==, syspath);