Fix: Mesh-LLSD und PBR glTF invariant fuer deutsche Linux-Locales
Legacy-LLSD-XML und PBR/glTF-Parsing benutzen nun invariant formatierte Dezimalzahlen; DE/FR/US-Regressionspruefungen ergaenzt. Reproduziert und lokal unter de_DE behoben, alle 6 CI-Gates gruen. Issue #442 bleibt wegen realer Viewer-/DB-/Rollback-Abnahme offen.
This commit is contained in:
1 parent
6364f8fd66
commit
c28ad822ad
4 files changed
+76
-3
No files matched your search
@@ -152,7 +152,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
else if (obj is double || obj is float)
|
||||
{
|
||||
writer.WriteStartElement(String.Empty, "real", String.Empty);
|
||||
writer.WriteString(obj.ToString());
|
||||
writer.WriteString(Convert.ToString(obj, CultureInfo.InvariantCulture));
|
||||
writer.WriteEndElement();
|
||||
}
|
||||
else if (obj is bool b)
|
||||
@@ -288,7 +288,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
ret = Convert.ToInt32(reader.ReadString().Trim());
|
||||
ret = Convert.ToInt32(reader.ReadString().Trim(), CultureInfo.InvariantCulture);
|
||||
break;
|
||||
}
|
||||
case "real":
|
||||
@@ -300,7 +300,7 @@ namespace OpenSim.Framework.Capabilities
|
||||
}
|
||||
|
||||
reader.Read();
|
||||
ret = Convert.ToDouble(reader.ReadString().Trim());
|
||||
ret = Convert.ToDouble(reader.ReadString().Trim(), CultureInfo.InvariantCulture);
|
||||
break;
|
||||
}
|
||||
case "uuid":
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
@@ -1212,8 +1213,12 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
if (side < 0 || side > byte.MaxValue)
|
||||
return false;
|
||||
OSD tst;
|
||||
// libOpenMetaverse JSON number handling in this legacy path can
|
||||
// depend on CurrentCulture. glTF always uses invariant decimal dots.
|
||||
CultureInfo previousCulture = CultureInfo.CurrentCulture;
|
||||
try
|
||||
{
|
||||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
tst = OSDParser.DeserializeJson(data);
|
||||
if(tst is not OSDMap mainArr)
|
||||
return false;
|
||||
@@ -1454,6 +1459,10 @@ namespace OpenSim.Region.OptionalModules.Materials
|
||||
{
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
CultureInfo.CurrentCulture = previousCulture;
|
||||
}
|
||||
|
||||
if (overrides is null)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using OpenMetaverse;
|
||||
@@ -100,6 +101,34 @@ internal static class Program
|
||||
"hull without BoundingVerts accepted");
|
||||
}
|
||||
|
||||
private static void VerifyInvariantLlsdAcrossCultures()
|
||||
{
|
||||
CultureInfo original = CultureInfo.CurrentCulture;
|
||||
try
|
||||
{
|
||||
foreach (string cultureName in new[] { "de-DE", "fr-FR", "en-US" })
|
||||
{
|
||||
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(cultureName);
|
||||
|
||||
const string xml = "<llsd><map><key>value</key><real>1.5</real><key>count</key><integer>2</integer></map></llsd>";
|
||||
var parsed = (Hashtable)LLSD.LLSDDeserialize(Encoding.UTF8.GetBytes(xml));
|
||||
Assert(parsed["value"] is double real && real == 1.5 &&
|
||||
parsed["count"] is int count && count == 2,
|
||||
"LLSD XML numeric parsing depends on host culture: " + cultureName);
|
||||
|
||||
string serialized = Encoding.UTF8.GetString(LLSD.LLSDSerialize(
|
||||
new Hashtable { ["value"] = 1.5d, ["count"] = 2 }));
|
||||
Assert(serialized.Contains("<real>1.5</real>") &&
|
||||
!serialized.Contains("<real>1,5</real>"),
|
||||
"LLSD XML numeric serialization depends on host culture: " + cultureName);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
CultureInfo.CurrentCulture = original;
|
||||
}
|
||||
}
|
||||
|
||||
private static void Main()
|
||||
{
|
||||
// These are OSD maps/arrays after real LLSD decoding, NOT
|
||||
@@ -190,6 +219,7 @@ internal static class Program
|
||||
Assert(!ModelCost.TryParseModelInstance((object)brokenType, 1,
|
||||
out _, out _, out _), "legacy string mesh index must be rejected");
|
||||
|
||||
VerifyInvariantLlsdAcrossCultures();
|
||||
VerifyZlibGeometryDecoding();
|
||||
Console.WriteLine("OpenGenesisLINK Mesh upload fee LLSD instance + zlib geometry regression: OK");
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Regression: removing a PBR material from a non-existent face is a no-op.
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Globalization;
|
||||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
using OpenSim.Region.OptionalModules.Materials;
|
||||
@@ -69,6 +70,38 @@ internal static class Program
|
||||
"PBR UV transform changed for channel " + slot);
|
||||
}
|
||||
|
||||
private static void VerifyPbrAcrossCultures()
|
||||
{
|
||||
CultureInfo original = CultureInfo.CurrentCulture;
|
||||
string baseline = null;
|
||||
try
|
||||
{
|
||||
foreach (string cultureName in new[] { "en-US", "de-DE", "fr-FR" })
|
||||
{
|
||||
CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(cultureName);
|
||||
const string gltf = "{\"materials\":[{\"pbrMetallicRoughness\":{\"metallicFactor\":0.2,\"roughnessFactor\":0.75}}]}";
|
||||
var add = typeof(MaterialsModule).GetMethod("AddMaterialOverride",
|
||||
BindingFlags.NonPublic | BindingFlags.Static);
|
||||
Assert(add != null, "PBR culture-regression helper missing");
|
||||
object[] args = { null, gltf, 1 };
|
||||
Assert((bool)add.Invoke(null, args),
|
||||
"glTF material rejected with host culture " + cultureName);
|
||||
var entries = (RenderMaterialOverrideEntry[])args[0];
|
||||
Assert(entries != null && entries.Length == 1,
|
||||
"PBR override missing for " + cultureName);
|
||||
if (baseline != null)
|
||||
Assert(entries[0].data == baseline,
|
||||
"glTF material conversion changed with host culture " + cultureName);
|
||||
else
|
||||
baseline = entries[0].data;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
CultureInfo.CurrentCulture = original;
|
||||
}
|
||||
}
|
||||
|
||||
private static void Main()
|
||||
{
|
||||
RenderMaterialEntry[] empty = null;
|
||||
@@ -272,6 +305,7 @@ internal static class Program
|
||||
Assert(uvEntries[0].data == pristine, "invalid UV mutated existing PBR face");
|
||||
}
|
||||
|
||||
VerifyPbrAcrossCultures();
|
||||
Console.WriteLine("OpenGenesisLINK PBR ORM/emissive UV channel roundtrip and invalid-input regression: OK");
|
||||
|
||||
Console.WriteLine("OpenGenesisLINK PBR face bounds and glTF texture validation regression: OK");
|
||||
|
||||
Reference in new issue
Block a user