Bug 78480

Summary: poll(2) should not be called with negative timeout under NetBSD
Product: dbus Reporter: Jaap Boender <jaapb>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: prlw1
Version: unspecifiedKeywords: patch
Hardware: All   
OS: NetBSD   
Whiteboard: review+
i915 platform: i915 features:
Attachments: Patch to dbus/dbus-sysdeps-unix.c fixing the issue.

Description Jaap Boender 2014-05-09 09:32:39 UTC
Created attachment 98740 [details]
Patch to dbus/dbus-sysdeps-unix.c fixing the issue.

There seems to be a difference between the behaviour of poll(2) under NetBSD (at least) and other operating systems; under Linux, for example, any negative timeout is treated as an indefinite block, whereas NetBSD only accepts -1, any other negative value resulting in an EINVAL.

(This is a real issue: with an unpatched version of dbus, KDE refuses to start.)

A patch fixing this issue is attached; it should be portable, as it simply maps any negative timeout to -1.
Comment 1 Simon McVittie 2014-05-09 13:44:50 UTC
Which caller is getting this wrong? I would expect callers of _dbus_poll() to use the portable "timeout >= -1" version.

That patch can't hurt, though. I'll apply it when I next do dbus test-builds, and it's appropriate for "ports" or distro packaging.

Coding style nitpicking: D-Bus is in approximately GNOME style (which is itself approximately GNU style), so the {} and their contents should be indented by 2 more spaces.
Comment 2 Simon McVittie 2014-06-11 10:58:37 UTC
Fixed in git for 1.9.0, and appropriate to backport in *BSD ports/packages/whatever.

As a note for the future, we prefer "git format-patch" output so that it's clear how the author prefers to be named.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.