ZDaemon Forum Index ZDaemon
Client/Server DOOM
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[ACS] NamedExecute across library boundaries is broken

 
Post new topic   Reply to topic    ZDaemon Forum Index -> Fixed Bugs
View previous topic :: View next topic  
Author Message
rhinoduck
Potatoes


Joined: 22 Oct 2012

PostPosted: Thu Jan 25, 2018 1:55 am    Post subject: [ACS] NamedExecute across library boundaries is broken Reply with quote

EDIT (2018-01-25 1:29 UTC): I originally uploaded a wrong test case, sorry; I reauploaded a "fixed" version of the test WAD now.

When ACS_NamedExecute or ACS_NamedExecuteAlways are called from one library to execute a script from another library, and if the name of the library which contains the script to be executed comes after the name of the library doing the call in the LOADACS lump (this defined the load order), the ZD ACS VM will end up executing (what seems to be) a random different script.

In case of the test WAD (see below), "caller" will execute itself which will effectively result in an infinite loop. But this is not always the case; when this hit me in rhinolib, the script executed was a completely unrelated one from a different library.

I tested this in ZDoom 2.8.1 for comparison, and it works as expected there.

ZDaemon version: 1.10b08
Test WAD: acstest-namedacrosslibraries.wad
To trigger the bug: Load test WAD in the client, and execute the following in console: pukename caller

Code:
#library "lcaller"

#include "zcommon.acs"

script "caller" (void)
{
   Log(s:"caller");
   ACS_NamedExecuteAlways("callee", 0);
}

Code:
#library "lcallee"

#include "zcommon.acs"

script "callee" (void)
{
   Log(s:"callee");
}


Last edited by rhinoduck on Sat Jan 27, 2018 8:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
Kilgore
Air Cavalry


Joined: 17 Jun 2003
Location: Up the river

PostPosted: Sat Jan 27, 2018 2:32 pm    Post subject: Reply with quote

Confirmed and fixed. Thanks a lot rhinoduck.
Back to top
View user's profile Send private message Visit poster's website
rhinoduck
Potatoes


Joined: 22 Oct 2012

PostPosted: Sat Jan 27, 2018 8:29 pm    Post subject: Reply with quote

The fix is complete and nothing more needs to be done; I'm just going to leave this bit of information here as a clarification to my original post.

Given what we found out yesterday, i realised that load order did not matter at all. I am attaching a more complete test case which can demonstrate that (in b08).

When you do pukename caller with the 'a' version of the WAD, "dummy" will be logged in the console; when you do the same with the 'b' version of the WAD, it will yield "placeholder"; both are wrong. So the problem is symmetrical and affects all ACS_NamedExecute*() calls; It just masked itself in some cases when I was first poking around, because the correct script happened to be executed in those by pure coincidence.

Test WADs: acstest-namedacrosslibraries2a.wad acstest-namedacrosslibraries2b.wad

LOADACS (in 'a')
Code:
lcaller
lcallee


LOADACS (in 'b')
Code:
lcallee
lcaller


LCALLER (in 'a' and 'b')
Code:
#library "lcaller"

#include "zcommon.acs"

script "dummy" (void)
{
   Log(s:"dummy");
}

script "caller" (void)
{
   Log(s:"caller");
   ACS_NamedExecuteAlways("callee", 0);
}


LCALLEE (in 'a' and 'b')
Code:
#library "lcallee"

#include "zcommon.acs"

script "placeholder" (void)
{
   Log(s:"placeholder");
}

script "callee" (void)
{
   Log(s:"callee");
}


Thanks for your time, and for the fix, Kilgore Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ZDaemon Forum Index -> Fixed Bugs All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group