Caught during a CI run on Linux. open() can block for example when used with pipes. Also make sure to handle any errors that might need to be thrown. Using strdup here is safe, because we already ensure that the string is a safe C null terminated string.
This makes sure to only do a quick check against VM types since if then the types don't match, we know the whole chain doesn't match. With the older implementation there was a problem with subclasses of VM types, because they share the type info but can't use a quick check. That is why we now compare against the class_id and not use the TypeInfo directly.
A better version should be made so this is actually checked correctly. This version can also create a fast path for certain cases where there's a mismatch.
This is a second attempt at fixing this that this time works on Linux. This cleans up some of the spread around logic of platforms. It still needs more cleanup by better abstracting this in the configure process.
This reverts commit 688769a.