Hmmm. STILL having problems with Linux

Want to discuss changes to the UOX3 source code? Got a code-snippet you'd like to post? Anything related to coding/programming goes here!
arfon
UOX3 Neophyte
Posts: 35
Joined: Tue Sep 06, 2005 9:36 pm
Location: Texas
Has thanked: 0
Been thanked: 0

Post by arfon »

Recompiled and it still barfs!

Code: Select all

o------------------------------------------------------------------------------o
| Processing INI Settings
/ does not existirectory directory /home/uox3/server/
o------------------------------------------------------------------------------o 
Giwo, would you like access to my server to play with it? I'm fearing that I am missing some warning during compilation (it spits out a BUNCH).
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Doesn't make any sense :P

We know it's reading the ini, as it changed the path it spits out (that it sees as invalid). What I don't understand is why it can't open that directory.

Really I think we need someone with more *nix experience to offer some thoughts/suggestions on why it won't recognize the directory. Based on the linux programming sites I looked into, that usage of opendir() should be fine.

Moreover, GhostTyper, a linux user posting in another forum, seems to have no trouble getting the server running (once we got past the compile errors) he is getting a crash when logging in.
Scott
arfon
UOX3 Neophyte
Posts: 35
Joined: Tue Sep 06, 2005 9:36 pm
Location: Texas
Has thanked: 0
Been thanked: 0

Post by arfon »

I'm compiling the lastest CVS files (as of two nights ago).

Is GhostTyper using the same files?

Hey GhostTyper, can I get your binary and see if it works on my Slackware 9.1 (kernel2.4) box???
[/b]
xir
UOX3 Neophyte
Posts: 47
Joined: Mon Aug 23, 2004 2:59 pm
Has thanked: 0
Been thanked: 0

Post by xir »

I remember experiencing the same problems with the directories after I compiled it, hence my comment on getting it to work is actually trickier than compiling it. I don't actually remember the fix to it unfortunately.
Try printing out what is contained in sText.c_str() (that which is passed into opendir() )- I believe it did some windows-only directory path translation before that actual code?

Add
printf("\n\nPath : %s\n\n", sText.c_str());
before the DIR *dirPtr etc. and see what it comes out with.
Last edited by xir on Sat Oct 08, 2005 1:56 am, edited 1 time in total.
xir
UOX3 Neophyte
Posts: 47
Joined: Mon Aug 23, 2004 2:59 pm
Has thanked: 0
Been thanked: 0

Post by xir »

Code: Select all

	#if UOX_PLATFORM != PLATFORM_WIN32
			DIR *dirPtr = opendir( sText.c_str() );
			if( !dirPtr )
				error = true;
			else
				closedir( dirPtr );
	#else
			char curWorkingDir[1024];
			GetCurrentDirectory( 1024, curWorkingDir );
			int iResult = _chdir( sText.c_str() );
			if( iResult != 0 )
				error = true;
			else
				_chdir( curWorkingDir );	// move back to where we were
	#endif

This doesn't duplicate the same behaviour - wouldn't it be something like
in linux :

Code: Select all

#if UOX_PLATFORM != PLATFORM_WIN32
	char curWorkingDir[PATH_MAX];
	if ( getcwd(curWorkingDir, PATH_MAX) == NULL)
    	error = true;
    else
    {
		int iResult = chdir(sText.c_str());
		if( iResult != 0 )
			error = true;
		else
			chdir(curWorkingDir);
   }	
#else
arfon
UOX3 Neophyte
Posts: 35
Joined: Tue Sep 06, 2005 9:36 pm
Location: Texas
Has thanked: 0
Been thanked: 0

Post by arfon »

Added: printf("\n\nPath : %s\n\n", sText.c_str());

re-compiled and here's the output:

Code: Select all

o------------------------------------------------------------------------------o| UOX Server start up!
| Welcome to Ultima Offline eXperiment 3 v0.98-3.0o
o------------------------------------------------------------------------------o
o------------------------------------------------------------------------------o
| Starting JavaScript Engine....
| JavaScript engine startup complete.
o------------------------------------------------------------------------------o
| Processing INI Settings

/ath : /home/uox3/server/


/ does not existirectory directory /home/uox3/server/
o------------------------------------------------------------------------------o
| Beginning UOX final shut down sequence...
| HTMLTemplates object not found.
| Cleaning up item and character memory... uox3: ObjectFactory.cpp:26: static UOX::ObjectFactory& UOX::ObjectFactory::getSingleton(): Assertion `ms_Singleton' failed.
Aborted
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

xir: That's actually why I had him comment out the entire statement inside the #if, as uoxlinux.h will actually wrap those function calls (thus causing you to not need #ifdef'd code). However even when using that method, it wouldn't work.

if may also be worth noting that display errors such as:
/ath

and

/ does not existirectory directory

Have nothing to do with the problem, but are caused by how the messageloop vs direct console access interact (sometimes interfering with eachother).
Scott
arfon
UOX3 Neophyte
Posts: 35
Joined: Tue Sep 06, 2005 9:36 pm
Location: Texas
Has thanked: 0
Been thanked: 0

Post by arfon »

keep giving me suggestions and I'll keep trying them!

I'm trying to keep track of how this is done for other Linux guys.
xir
UOX3 Neophyte
Posts: 47
Joined: Mon Aug 23, 2004 2:59 pm
Has thanked: 0
Been thanked: 0

Post by xir »

Ok then. The problem still has to be what is being passed in as the parameter right? There *could* be a carriage return character embedded in the actual string at the end of the sText.c_str(). Going on a wild guess here. But try this

Code: Select all

printf("\n\n");
for (int i = 0; i < sText.size(); ++i)
	printf("%02X ", sText[i]);
printf(\n\n");
If the last character in Hex is 0x0D you'll need to change this in UString.h.

#define MYWHITESPACE " \t\v\f\0 "

to

#define MYWHITESPACE " \t\r\v\f\0 "

(I think)
arfon
UOX3 Neophyte
Posts: 35
Joined: Tue Sep 06, 2005 9:36 pm
Location: Texas
Has thanked: 0
Been thanked: 0

Post by arfon »

I assume that I need to modify cServerData.cpp again...

What are the line numbers I need to change?
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Actually he's speaking of ustring.h

Open the file and find the line he mentioned, MYWHITESPACE should be line 18 or so.
Scott
punt
VIP
Posts: 244
Joined: Wed Mar 24, 2004 7:46 pm
Has thanked: 0
Been thanked: 9 times

Post by punt »

That is an unnecessary step, unless on did not properly ensure the text files have the unix end of line (versus the windows). When one unzipped, if the -a option was used (for the zip file was made on windows), it would convert the text files to unix end of line format. In addition, there are dos2unix utilities available to convert them files (which I personally would recommend over changing code, ensuring the data files are consistent with the OS they are on).
arfon
UOX3 Neophyte
Posts: 35
Joined: Tue Sep 06, 2005 9:36 pm
Location: Texas
Has thanked: 0
Been thanked: 0

Post by arfon »

I'm sorry Punt, I did not understand your last post...

I DL'd the svc files on a linux system and tar -xzf'd them.

What should I do?[/i]
xir
UOX3 Neophyte
Posts: 47
Joined: Mon Aug 23, 2004 2:59 pm
Has thanked: 0
Been thanked: 0

Post by xir »

It probably isn't an issue but paste the previous bit of code I pasted into the place of that last print and see what it comes out with. There most be *something* not correct with what is being passed in.
arfon
UOX3 Neophyte
Posts: 35
Joined: Tue Sep 06, 2005 9:36 pm
Location: Texas
Has thanked: 0
Been thanked: 0

Post by arfon »

so...

Code: Select all

#define MYWHITESPACE " \t\v\f\0 " 
is line 18 of UString.h


Of what file and line will I find:

Code: Select all

printf("\n\n");
for (int i = 0; i < sText.size(); ++i)
   printf("%02X ", sText[i]);
printf(\n\n"); 
(sText.c_str())?
xir
UOX3 Neophyte
Posts: 47
Joined: Mon Aug 23, 2004 2:59 pm
Has thanked: 0
Been thanked: 0

Post by xir »

arfon wrote:so...

Code: Select all

#define MYWHITESPACE " \t\v\f\0 " 
is line 18 of UString.h


Of what file and line will I find:

Code: Select all

printf("\n\n");
for (int i = 0; i < sText.size(); ++i)
   printf("%02X ", sText[i]);
printf(\n\n"); 
(sText.c_str())?
Nevermind about the whitespace, just add it before the

Code: Select all

#if UOX_PLATFORM != PLATFORM_WIN32
         DIR *dirPtr = opendir( sText.c_str() ); 
etc.
and see what it comes out with.
Post Reply