<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - Provide a udev handle from the libinput device"
href="https://bugs.freedesktop.org/show_bug.cgi?id=85573#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_ASSIGNED "
title="ASSIGNED - Provide a udev handle from the libinput device"
href="https://bugs.freedesktop.org/show_bug.cgi?id=85573">bug 85573</a>
from <span class="vcard"><a class="email" href="mailto:bugzilla@hadess.net" title="Bastien Nocera <bugzilla@hadess.net>"> <span class="fn">Bastien Nocera</span></a>
</span></b>
<pre>(In reply to Peter Hutterer from <a href="show_bug.cgi?id=85573#c1">comment #1</a>)
<span class="quote">> Main question here: better to get the udev_device handle directly, or the
> device node and leave the rest up to the caller?
>
> What are the side-effects to each approach?.
>
> If libinput caches the udev_device handle and returns that, there's some odd
> case where dropping privileges in the caller may give a device the caller
> does not have access to anymore (struggling to find a use-case for that
> though, since it would also break hotplugging).
>
> If the cached handle is returned, a buggy caller could call
> udev_device_unref too often and cause a (hard to debug) segfault in
> libinput. I'd consider that a normal bug though, can be avoided by returning
> a new handle for the device.</span >
That's quite a flippant approach. If you couldn't depend the caller behaving
properly, you'd get crashes anyway. And valgrind would tell you where the
problem is without a doubt.
<span class="quote">> If a new handle is returned, the code isn't much different than returning
> the device node, other than adding another udev dependency on the API. The
> path backend uses udev internally, but returning the device node would be
> simple enough.
>
> Any new, uncached handle can suffer from race conditions if the device
> disappears. Not much different to normal error handling though.
> Not all devices may have a udev handle, but then again not all devices have
> a device node.</span >
What devices wouldn't have udev handles, and what devices wouldn't have a
device node?</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>