[libvirt PATCH 2/2] tests: don't set G_DEBUG=fatal-warnings on macOS

Andrea Bolognani abologna at redhat.com
Thu Apr 28 13:39:42 UTC 2022


On Thu, Apr 28, 2022 at 12:22:14PM +0100, Daniel P. Berrangé wrote:
> +# On macOS when BROKEN_POLL is set for GLib, our tests will
> +# periodically trigger a warning:
> +#
> +#  (process:50880): GLib-WARNING **: 02:54:15.272: poll(2) failed due to: Bad file descriptor.
> +#
> +# Our code is inherantly racy, calling g_source_destroy which
> +# removes the FD from the event thread poll asynchronously
> +# but we close the FD immediately after g_source_destroy returns.
> +#
> +# With poll() this results in POLLNVAL, but with select() it
> +# generates the BADF error on macOS
> +if host_machine.system() != 'darwin'
> +  tests_env += ['G_DEBUG=fatal-warnings']
> +endif

Doesn't this just sweep the issue under the carpet? Shouldn't GLib be
changed to do something like

  #ifndef BROKEN_POLL
    if (poll() < 0)
      if (!POLLNVAL)
        return -1;
  #else
    if (select() < 0)
      if (!EBADF)
        return -1;
  #endif

instead? If acting on an fd that's already been closed is okay when
using the poll()-based implementation, the same should apply to the
select()-based one as well.

-- 
Andrea Bolognani / Red Hat / Virtualization



More information about the libvir-list mailing list