From 4a5979c31114272ec3f2e8742783b6918be93ad2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Jun 2010 21:09:15 +0100 Subject: [PATCH 1/8] minor: remove some mono compiler warnings --- .../Region/Physics/OdePlugin/ODEDynamics.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 26 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs index 9beeabba0a..2342bfa141 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEDynamics.cs @@ -675,7 +675,7 @@ namespace OpenSim.Region.Physics.OdePlugin m_dir.Z = vel_now.Z; // Preserve the accumulated falling velocity d.Vector3 pos = d.BodyGetPosition(Body); - Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); +// Vector3 accel = new Vector3(-(m_dir.X - m_lastLinearVelocityVector.X / 0.1f), -(m_dir.Y - m_lastLinearVelocityVector.Y / 0.1f), m_dir.Z - m_lastLinearVelocityVector.Z / 0.1f); Vector3 posChange = new Vector3(); posChange.X = pos.X - m_lastPositionVector.X; posChange.Y = pos.Y - m_lastPositionVector.Y; diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 0720b5ee53..3cf45019e7 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1576,19 +1576,19 @@ Console.WriteLine(" JointCreateFixed"); //Console.WriteLine("Move " + m_primName); if (!d.BodyIsEnabled (Body)) d.BodyEnable (Body); // KF add 161009 // NON-'VEHICLES' are dealt with here - if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) - { - d.Vector3 avel2 = d.BodyGetAngularVel(Body); - /* - if (m_angularlock.X == 1) - avel2.X = 0; - if (m_angularlock.Y == 1) - avel2.Y = 0; - if (m_angularlock.Z == 1) - avel2.Z = 0; - d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); - */ - } +// if (d.BodyIsEnabled(Body) && !m_angularlock.ApproxEquals(Vector3.Zero, 0.003f)) +// { +// d.Vector3 avel2 = d.BodyGetAngularVel(Body); +// /* +// if (m_angularlock.X == 1) +// avel2.X = 0; +// if (m_angularlock.Y == 1) +// avel2.Y = 0; +// if (m_angularlock.Z == 1) +// avel2.Z = 0; +// d.BodySetAngularVel(Body, avel2.X, avel2.Y, avel2.Z); +// */ +// } //float PID_P = 900.0f; float m_mass = CalculateMass(); From d399bd3eb7de6bab531087a1956f30457c3285ff Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Jun 2010 21:18:52 +0100 Subject: [PATCH 2/8] minor: fix spelling mistake interupt -> interrupt in migrations This is for mantis 4783 --- OpenSim/Data/Migration.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs index 4f113a2f49..c177097ebd 100644 --- a/OpenSim/Data/Migration.cs +++ b/OpenSim/Data/Migration.cs @@ -67,7 +67,6 @@ namespace OpenSim.Data /// really want is the assembly of your database class. /// /// - public class Migration { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -173,8 +172,6 @@ namespace OpenSim.Data ExecuteScript(_conn, script); } - - public void Update() { InitMigrationsTable(); @@ -186,8 +183,8 @@ namespace OpenSim.Data return; // to prevent people from killing long migrations. - m_log.InfoFormat("[MIGRATIONS] Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); - m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); + m_log.InfoFormat("[MIGRATIONS]: Upgrading {0} to latest revision {1}.", _type, migrations.Keys[migrations.Count - 1]); + m_log.Info("[MIGRATIONS]: NOTE - this may take a while, don't interrupt this process!"); foreach (KeyValuePair kvp in migrations) { @@ -206,7 +203,7 @@ namespace OpenSim.Data } catch (Exception e) { - m_log.DebugFormat("[MIGRATIONS] Cmd was {0}", e.Message.Replace("\n", " ")); + m_log.DebugFormat("[MIGRATIONS]: Cmd was {0}", e.Message.Replace("\n", " ")); m_log.Debug("[MIGRATIONS]: An error has occurred in the migration. This may mean you could see errors trying to run OpenSim. If you see database related errors, you will need to fix the issue manually. Continuing."); ExecuteScript("ROLLBACK;"); } From a4a808818f32b937a4228e9311e3e3b413a1b1d7 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 25 Jun 2010 21:48:19 +0100 Subject: [PATCH 3/8] don't report the null uuid as a missing asset on saving oars/iars --- .../Region/CoreModules/World/Archiver/AssetsRequest.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index a1451ce705..4d360f6be5 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -134,7 +134,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver foreach (KeyValuePair kvp in m_uuids) { - m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback); + if (kvp.Key != UUID.Zero) + m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback); } m_requestCallbackTimer.Enabled = true; @@ -269,7 +270,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver } catch (Exception e) { - m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e); + m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}{1}", e.Message, e.StackTrace); } } @@ -285,7 +286,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver catch (Exception e) { m_log.ErrorFormat( - "[ARCHIVER]: Terminating archive creation since asset requster callback failed with {0}", e); + "[ARCHIVER]: Terminating archive creation since asset requester callback failed with {0}{1}", + e.Message, e.StackTrace); } } } From ef0ac7c4032ebb369479c18a4f2cc432b613234f Mon Sep 17 00:00:00 2001 From: Tom Grimshaw Date: Sat, 26 Jun 2010 23:20:28 -0700 Subject: [PATCH 4/8] Deal with incoming land objects properly so they don't just stack up --- .../World/Land/LandManagementModule.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 91c8130f99..cfee1b0cc0 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -1303,18 +1303,31 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnIncomingLandDataFromStorage(List data) { - for (int i = 0; i < data.Count; i++) + lock (m_landList) { - IncomingLandObjectFromStorage(data[i]); + //Remove all the land objects in the sim and then process our new data + foreach (int n in m_landList.Keys) + { + m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); + } + m_landIDList.Initialize(); + m_landList.Clear(); + + for (int i = 0; i < data.Count; i++) + { + IncomingLandObjectFromStorage(data[i]); + } } } public void IncomingLandObjectFromStorage(LandData data) { + ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); new_land.LandData = data.Copy(); new_land.SetLandBitmapFromByteArray(); AddLandObject(new_land); + new_land.SendLandUpdateToAvatarsOverMe(); } public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) From 205d2496f6251244f69004c70b8c5db63b55bc98 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Jun 2010 20:04:39 +0100 Subject: [PATCH 5/8] Fix permission propagation to prevent permanently locked objects from being created. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 64bdc99bb8..750b1f7f50 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -385,7 +385,7 @@ namespace OpenSim.Region.Framework.Scenes if (Permissions.PropagatePermissions() && recipient != senderId) { // First, make sore base is limited to the next perms - itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; + itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); // By default, current equals base itemCopy.CurrentPermissions = itemCopy.BasePermissions; @@ -897,7 +897,7 @@ namespace OpenSim.Region.Framework.Scenes if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions()) { - agentItem.BasePermissions = taskItem.BasePermissions & taskItem.NextPermissions; + agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); if (taskItem.InvType == (int)InventoryType.Object) agentItem.CurrentPermissions = agentItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13); agentItem.CurrentPermissions = agentItem.BasePermissions ; @@ -1092,7 +1092,7 @@ namespace OpenSim.Region.Framework.Scenes destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions & srcTaskItem.NextPermissions; destTaskItem.BasePermissions = srcTaskItem.BasePermissions & - srcTaskItem.NextPermissions; + (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); destTaskItem.CurrentPermissions |= 8; // Slam! } } From b0129b35f8dbe24b8e857223b3ac8ba4cb7cc830 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Jun 2010 12:37:16 -0700 Subject: [PATCH 6/8] Added checks to XInventory DB layer to truncate names and descriptions. --- OpenSim/Data/MySQL/MySQLXInventoryData.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 0fe801d696..3c73095fc3 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs @@ -64,14 +64,22 @@ namespace OpenSim.Data.MySQL public bool StoreFolder(XInventoryFolder folder) { + if (folder.folderName.Length > 64) + folder.folderName = folder.folderName.Substring(0, 64); + return m_Folders.Store(folder); } public bool StoreItem(XInventoryItem item) { + if (item.inventoryName.Length > 64) + item.inventoryName = item.inventoryName.Substring(0, 64); + if (item.inventoryDescription.Length > 128) + item.inventoryDescription = item.inventoryDescription.Substring(0, 128); + return m_Items.Store(item); } - + public bool DeleteFolders(string field, string val) { return m_Folders.Delete(field, val); From 76d2f0f68e16f9b74ce4f81f9ecbf370f39f3ac6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 27 Jun 2010 12:40:17 -0700 Subject: [PATCH 7/8] Same patch as before but for SQLite. --- OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 6064538990..ca651e1998 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -66,11 +66,19 @@ namespace OpenSim.Data.SQLite public bool StoreFolder(XInventoryFolder folder) { + if (folder.folderName.Length > 64) + folder.folderName = folder.folderName.Substring(0, 64); + return m_Folders.Store(folder); } public bool StoreItem(XInventoryItem item) { + if (item.inventoryName.Length > 64) + item.inventoryName = item.inventoryName.Substring(0, 64); + if (item.inventoryDescription.Length > 128) + item.inventoryDescription = item.inventoryDescription.Substring(0, 128); + return m_Items.Store(item); } From 9c553cd254b5b27f3ddcffddee9684aeb4a6298b Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 27 Jun 2010 20:20:08 +0100 Subject: [PATCH 8/8] Fix more perms weirdness. Preserve "Locked" status across gives and rez/take. Preserve "Anyone can move" flag in most cases. --- .../Region/Framework/Scenes/Scene.Inventory.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 55c1575464..6532537fb3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -402,7 +402,7 @@ namespace OpenSim.Region.Framework.Scenes // First, make sore base is limited to the next perms itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); // By default, current equals base - itemCopy.CurrentPermissions = itemCopy.BasePermissions; + itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions; // If this is an object, replace current perms // with folded perms @@ -413,7 +413,7 @@ namespace OpenSim.Region.Framework.Scenes } // Ensure there is no escalation - itemCopy.CurrentPermissions &= item.NextPermissions; + itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move); // Need slam bit on xfer itemCopy.CurrentPermissions |= 8; @@ -918,12 +918,13 @@ namespace OpenSim.Region.Framework.Scenes { agentItem.BasePermissions = taskItem.BasePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); if (taskItem.InvType == (int)InventoryType.Object) - agentItem.CurrentPermissions = agentItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13); - agentItem.CurrentPermissions = agentItem.BasePermissions ; + agentItem.CurrentPermissions = agentItem.BasePermissions & (((taskItem.CurrentPermissions & 7) << 13) | (taskItem.CurrentPermissions & (uint)PermissionMask.Move)); + else + agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; agentItem.CurrentPermissions |= 8; agentItem.NextPermissions = taskItem.NextPermissions; - agentItem.EveryOnePermissions = taskItem.EveryonePermissions & taskItem.NextPermissions; + agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; } else @@ -1105,11 +1106,11 @@ namespace OpenSim.Region.Framework.Scenes if (Permissions.PropagatePermissions()) { destTaskItem.CurrentPermissions = srcTaskItem.CurrentPermissions & - srcTaskItem.NextPermissions; + (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); destTaskItem.GroupPermissions = srcTaskItem.GroupPermissions & - srcTaskItem.NextPermissions; + (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); destTaskItem.EveryonePermissions = srcTaskItem.EveryonePermissions & - srcTaskItem.NextPermissions; + (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); destTaskItem.BasePermissions = srcTaskItem.BasePermissions & (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); destTaskItem.CurrentPermissions |= 8; // Slam!