mirage / functoria

A DSL to invoke otherworldly functors
ISC License
63 stars 21 forks source link

Ensure that keys with different defaults are distinguished by functoria #194

Closed samoht closed 4 years ago

samoht commented 4 years ago

Fix https://github.com/mirage/mirage/issues/1157

The issue is present since MirageOS 3.0.3 and was introduced by https://github.com/mirage/functoria/pull/188

The Key.equal function, added in #188, was not precise enough and was collapsing keys with different default values. This would happen in https://github.com/mirage/mirage/blob/3.7/lib/mirage_impl_network.ml#L36-L46 where every netif driver will use a key with the same name (e.g. "interface") but with a different default value (e.g. "tap0" or "service").

We were lucky enough that the polymorphic hash function would work most of the time and put these devices in different hashtbl buckets (and so equal would work fine). When this is not the case, the devices are put in the same buckets and one of them disapears and cause mirage#1157

Another possible fix is to use a unique ID for each key instead. That would work too but that would make sharing more complicated.

samoht commented 4 years ago

I'm merging this to make a new release. If anyone has anything to say to block that release, now is the time to speak :p