ping On Thu, Oct 3, 2019, at 1:19 PM, Thomas Frohwein wrote: > Hi, > > With the move to mono 5 and integration of .NET Core modules (corefx, > corert), mono has tightened the checks around some operations, leading > to exceptions in some software that was built based on previously > allowed operations. > > The diff below adds an option to disable 2 of these checks, allowing > to run selected software again by setting the env var > MONO_FORCE_COMPAT. > > This was found and tested with the 2 games Terraria and Sword of the > Stars: The Pit, by me stefmorino (on Freenode #openbsd-gaming), and > solene@. > > My understanding of the reasons for the exceptions is that undefined > behavior could occur if these exceptions are disabled. Terraria and > Sword of the Stars: The Pit work fine with this workaround. > MONO_FORCE_COMPAT shoud only be set in such exceptions where the > assemblies fail to run otherwise. The use of mono should otherwise be > unaffected. > > The Terraria part of this compatibility issue has been raised with > upstream, but the conversation is stalling [1]. > > ok to include this in mono? > > [1] https://github.com/mono/corert/pull/33 > > Index: Makefile > =================================================================== > RCS file: /cvs/ports/lang/mono/Makefile,v > retrieving revision 1.132 > diff -u -p -r1.132 Makefile > --- Makefile 19 Sep 2019 12:02:59 -0000 1.132 > +++ Makefile 3 Oct 2019 17:16:02 -0000 > @@ -5,6 +5,7 @@ USE_WXNEEDED= Yes > COMMENT= cross platform, open source .NET developement framework > > V= 5.20.1.34 > +REVISION= 0 > > DISTNAME= mono-${V} > > Index: > patches/patch-external_corefx_src_Common_src_CoreLib_System_Collections_Generic_List_cs > =================================================================== > RCS file: > patches/patch-external_corefx_src_Common_src_CoreLib_System_Collections_Generic_List_cs > diff -N > patches/patch-external_corefx_src_Common_src_CoreLib_System_Collections_Generic_List_cs > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ > patches/patch-external_corefx_src_Common_src_CoreLib_System_Collections_Generic_List_cs > 3 Oct 2019 17:16:02 -0000 > @@ -0,0 +1,24 @@ > +$OpenBSD$ > + > +add MONO_FORCE_COMPAT env var for backwards compatibility with some > +routines that were abandoned with the update to mono 5 upstream > +This may lead to undefined behavior and should only be used in > +well-defined cases. > + > +Index: > external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs > +--- > external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs.orig > ++++ > external/corefx/src/Common/src/CoreLib/System/Collections/Generic/List.cs > +@@ -578,8 +578,11 @@ namespace System.Collections.Generic > + action(_items[i]); > + } > + > +- if (version != _version) > +- > ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); > ++ if (Environment.GetEnvironmentVariable > ("MONO_FORCE_COMPAT") == null) > ++ { > ++ if (version != _version) > ++ > ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); > ++ } > + } > + > + // Returns an enumerator for this list with the given > Index: > patches/patch-external_corert_src_System_Private_CoreLib_shared_System_Collections_Generic_ArraySortHelper_cs > =================================================================== > RCS file: > patches/patch-external_corert_src_System_Private_CoreLib_shared_System_Collections_Generic_ArraySortHelper_cs > diff -N > patches/patch-external_corert_src_System_Private_CoreLib_shared_System_Collections_Generic_ArraySortHelper_cs > --- /dev/null 1 Jan 1970 00:00:00 -0000 > +++ > patches/patch-external_corert_src_System_Private_CoreLib_shared_System_Collections_Generic_ArraySortHelper_cs > 3 Oct 2019 17:16:02 -0000 > @@ -0,0 +1,20 @@ > +$OpenBSD$ > + > +add MONO_FORCE_COMPAT env var for backwards compatibility with some > +routines that were abandoned with the update to mono 5 upstream > +This may lead to undefined behavior and should only be used in > +well-defined cases. > + > +Index: > external/corert/src/System.Private.CoreLib/shared/System/Collections/Generic/ArraySortHelper.cs > +--- > external/corert/src/System.Private.CoreLib/shared/System/Collections/Generic/ArraySortHelper.cs.orig > ++++ > external/corert/src/System.Private.CoreLib/shared/System/Collections/Generic/ArraySortHelper.cs > +@@ -40,7 +40,8 @@ namespace System.Collections.Generic > + > + internal static void ThrowOrIgnoreBadComparer(object comparer) > + { > +- throw new > ArgumentException(SR.Format(SR.Arg_BogusIComparer, comparer)); > ++ if (Environment.GetEnvironmentVariable > ("MONO_FORCE_COMPAT") == null) > ++ throw new > ArgumentException(SR.Format(SR.Arg_BogusIComparer, comparer)); > + } > + } > + > >
-- tfrohw...@fastmail.com PGP Public Key: https://pgp.mit.edu/pks/lookup?op=get&search=0xE1A22D58D20C6D22