"REMOVE" command causes segmentation fault (fixed)
-
supremoleet
- UOX3 Neophyte
- Posts: 28
- Joined: Fri Sep 01, 2006 3:37 am
- Has thanked: 0
- Been thanked: 0
- Contact:
"REMOVE" command causes segmentation fault (fixed)
OS: Gentoo Linux 2.6.16-r13 x86-64.
UOX: 0.98-3.7g
One of the first issues I came across was the 'remove command which is causing a segmentation fault immediately when used. At first, I thought it was something to do with the client I was running -- at the time I was running a 4.0x client using UO_Rice and Wine. I updated the client and started using UOGateway Lite, experienced the same problem.
I then attempted to connect remotely from a WinXP machine running UO 5.0.4d and UOGateway (1.9.1266). No luck -- still getting a seg fault. I tried restarting the server.
I thought at one point in time I had read on the forums that there was an issue with some JS files, but nothing related shows up on the known issues post.
UOX: 0.98-3.7g
One of the first issues I came across was the 'remove command which is causing a segmentation fault immediately when used. At first, I thought it was something to do with the client I was running -- at the time I was running a 4.0x client using UO_Rice and Wine. I updated the client and started using UOGateway Lite, experienced the same problem.
I then attempted to connect remotely from a WinXP machine running UO 5.0.4d and UOGateway (1.9.1266). No luck -- still getting a seg fault. I tried restarting the server.
I thought at one point in time I had read on the forums that there was an issue with some JS files, but nothing related shows up on the known issues post.
Last edited by supremoleet on Fri Sep 22, 2006 8:22 pm, edited 1 time in total.
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
If I ever found out how to compile UOX3 on Linux I would check the validity of this bug myself. Unfortunately, I seem to be stuck.
-= Ho Eyo He Hum =-
-
supremoleet
- UOX3 Neophyte
- Posts: 28
- Joined: Fri Sep 01, 2006 3:37 am
- Has thanked: 0
- Been thanked: 0
- Contact:
Additional info: 'rremove works fine. I'm comparing the two JS files, target numbers and everything seem to match up.
Given that the segmentation fault is occurring before the client even sees the targeting cursor or gets the "Select an item to remove" message, the problem must be somewhere early in the process. Users who do not have access to the remove command don't cause a crash -- they just get the "Access denied" message.
I just verified now that 'deletechar also causes a segmentation fault.
* Edit: This also seems to be happening with the 'set command as well.
./js/commands/targeting/remove.js wrote:Code: Select all
function CommandRegistration() { RegisterCommand( "remove", 2, true ); RegisterCommand( "deletechar", 3, true ); } function command_REMOVE( socket, cmdString ) { var targMsg = GetDictionaryEntry( 188, socket.Language ); socket.CustomTarget( 0, targMsg ); } function onCallback0( socket, ourObj ) { if( !socket.GetWord( 1 ) ) { if( ourObj.isChar ) { if( ourObj.npc ) { socket.SysMessage( GetDictionaryEntry( 1015 ) ); ourObj.Delete(); } } else if( ourObj.isItem ) { socket.SysMessage( GetDictionaryEntry( 1013 ) ); ourObj.Delete(); } } } function command_DELETECHAR( socket, cmdString ) { var targMsg = GetDictionaryEntry( 1618, socket.Language ); socket.CustomTarget( 1, targMsg ); } function onCallback1( socket, ourObj ) { if( !socket.GetWord( 1 ) && ourObj.isChar && ourObj != socket.currentChar ) { if( !ourObj.npc && ourObj.online ) { var targSock = ourObj.socket; if( targSock ) { targSock.SysMessage( GetDictionaryEntry( 1659 ) ); targSock.Disconnect(); } } ourObj.Delete(); } }
I'm not sure of how exactly RegisterCommand() is set up so I suppose there could potentially be a problem there that I'm not seeing. The RegisterCommand()'s look the same between remove and rremove though../js/commands/custom/repeatingcmds.js (Excerpt) wrote:Code: Select all
RegisterCommand( "rremove", 2, true ); // Use 'RREMOVE - Removes multiple targeted items.Code: Select all
//Repeated Command: REMOVE function command_RREMOVE( pSock, execString ) { pUser = pSock.currentChar; pUser.CustomTarget( 7, "Which object do you wish to remove?" ); } function onCallback7( pSock, myTarget ) { var pUser = pSock.currentChar; if( !pSock.GetWord( 1 )) { if( myTarget.npc || myTarget.isItem ) myTarget.Delete(); else pUser.SysMessage( "You can only remove items or NPCs." ); } else pUser.SysMessage( "You can only remove items or NPCs." ); pUser.CustomTarget( 7, "Which object do you wish to remove?" ); }
Given that the segmentation fault is occurring before the client even sees the targeting cursor or gets the "Select an item to remove" message, the problem must be somewhere early in the process. Users who do not have access to the remove command don't cause a crash -- they just get the "Access denied" message.
I just verified now that 'deletechar also causes a segmentation fault.
* Edit: This also seems to be happening with the 'set command as well.
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
Don't know if it's the issue, but one difference I see between the two scripts, is that RREMOVE does CustomTarget on the character object, while REMOVE and DELETECHARACTER does it on the socket object.
Try adding a var pUser = socket.currentChar; to the two latter commands and run CustomTarget on pUser instead, and see if the segmentation fault still occurs.
Alternatively, make sure that all the js files have proper unix file endings or whatnot, in case that matters.
Try adding a var pUser = socket.currentChar; to the two latter commands and run CustomTarget on pUser instead, and see if the segmentation fault still occurs.
Alternatively, make sure that all the js files have proper unix file endings or whatnot, in case that matters.
-= Ho Eyo He Hum =-
-
supremoleet
- UOX3 Neophyte
- Posts: 28
- Joined: Fri Sep 01, 2006 3:37 am
- Has thanked: 0
- Been thanked: 0
- Contact:
A few updates... first, I've found that 'set only causes the command when an argument is specified.
I used GDB to look into this...
I used GDB to look into this...
Code: Select all
Program received signal SIGSEGV, Segmentation fault.
0x0000000000531b38 in UOX::CDictionaryContainer::GetEntry ()
(gdb) backtrace
#0 0x0000000000531b38 in UOX::CDictionaryContainer::GetEntry ()
#1 0x00000000005cd590 in UOX::SE_GetDictionaryEntry ()
#2 0x0000000000680765 in js_Invoke ()
#3 0x000000000068918c in js_Interpret ()
#4 0x00000000006807b4 in js_Invoke ()
#5 0x00000000006809c3 in js_InternalInvoke ()
#6 0x0000000000660d39 in JS_CallFunctionName ()
#7 0x00000000004ec728 in UOX::cScript::executeCommand ()
#8 0x000000000049f689 in UOX::cCommands::Command ()
#9 0x00000000005eb6f0 in UOX::CPITalkRequest::Handle ()
#10 0x000000000059e611 in UOX::cNetworkStuff::GetMsg ()
#11 0x000000000059f60d in UOX::cNetworkStuff::CheckMessage ()
#12 0x000000000061f5bd in main ()
(gdb) list 1 /var/tmp/portage/glibc-2.3.5-r2/work/build-amd64-x86_64-pc-linux-gnu-nptl/nptl/crti.S: No such file or directory.
in /var/tmp/portage/glibc-2.3.5-r2/work/build-amd64-x86_64-pc-linux-gnu-nptl/nptl/crti.S
-
giwo
- Developer
- Posts: 1780
- Joined: Fri Jun 18, 2004 4:17 pm
- Location: California
- Has thanked: 0
- Been thanked: 0
Code: Select all
if( ourObj.isChar )
{
if( ourObj.npc )
{
socket.SysMessage( GetDictionaryEntry( 1015 ) );
ourObj.Delete();
}
}
else if( ourObj.isItem )
{
socket.SysMessage( GetDictionaryEntry( 1013 ) );
ourObj.Delete();
}
Code: Select all
if( ourObj.isChar )
{
if( ourObj.npc )
{
socket.SysMessage( GetDictionaryEntry( 1015, socket.Language ) );
ourObj.Delete();
}
}
else if( ourObj.isItem )
{
socket.SysMessage( GetDictionaryEntry( 1013, socket.Language ) );
ourObj.Delete();
}
-
supremoleet
- UOX3 Neophyte
- Posts: 28
- Joined: Fri Sep 01, 2006 3:37 am
- Has thanked: 0
- Been thanked: 0
- Contact:
Xuri -- that change worked. Giwo, what you recommended didn't seem to have an effect.
It now gives a segmentation fault when I click on the item to delete with the target cursor.
Also, usable skills (like meditate, begging) are causing seg faults as well. Is it just a matter of making changes like the one Xuri recommended? Another friend of mine is running a server on Gentoo and is not experiencing any of these issues. Do you think it's the AMD64?
It now gives a segmentation fault when I click on the item to delete with the target cursor.
Also, usable skills (like meditate, begging) are causing seg faults as well. Is it just a matter of making changes like the one Xuri recommended? Another friend of mine is running a server on Gentoo and is not experiencing any of these issues. Do you think it's the AMD64?
-
supremoleet
- UOX3 Neophyte
- Posts: 28
- Joined: Fri Sep 01, 2006 3:37 am
- Has thanked: 0
- Been thanked: 0
- Contact:
Another update... it looks like the problem is in fact GetDictionaryEntry(). When I made the changes recommended by Xuri, I pulled out the GetDictionaryEntry function for testing purposes. It blew up where I made the changes to GetDictionaryEntry under onCallback0. So I tweaked it down some more and got it working, the script now looks like this:
Code: Select all
function command_REMOVE( socket, cmdString )
{
var pUser = socket.currentChar;
pUser.CustomTarget( 0, GetDictionaryEntry( 188 ) );
}
function onCallback0( socket, ourObj )
{
if( !socket.GetWord( 1 ) )
{
if( ourObj.isChar )
{
if( ourObj.npc )
{
socket.SysMessage( GetDictionaryEntry( 1015 ) );
ourObj.Delete();
}
}
else if( ourObj.isItem )
{
socket.SysMessage( GetDictionaryEntry( 1013 ) );
ourObj.Delete();
}
}
}
-
supremoleet
- UOX3 Neophyte
- Posts: 28
- Joined: Fri Sep 01, 2006 3:37 am
- Has thanked: 0
- Been thanked: 0
- Contact: