SC load with fc bug on calling sub

Things you’d like to miss in the future...
Post Reply
fishgod
Posts: 222
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

SC load with fc bug on calling sub

Post by fishgod »

The resource-type fc introduced in v20.40.0005 causes problems when calling a sub in the loaded script when its loaded from cache:

Execute this script load-1.xys

Code: Select all

"Test Cached Load"
  load 'load-2.xys', , 'fc';
  load 'load-2.xys', , 'fc';
load-2.xys

Code: Select all

"Second script : main"
  sub '_sub';

"_sub"
  msg "First Time OK, second time Bug!";
Attachments
xy-load-fc-sub-bug.png
xy-load-fc-sub-bug.png (6.99 KiB) Viewed 1777 times
Operating System: Win10 x64 / Win7 x64 / almost allways newest XY-beta
totally XYscripting-addicted

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC load with fc bug on calling sub

Post by admin »

Fixed in next beta.

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC load with fc bug on calling sub

Post by Filehero »

Hi Don,

could it be that this fix breaks the/a check for existing user functions?

20.40.0003 is fine, 20.40.0006 ist raising a script error for the very first time complaining for a "already existing user function".
Because the scripts and functions involved are providing my generic menu generator I hadn't time for a detailed analysis (or a screenshot), only for a simple rollback.


Thanks,
Filehero

admin wrote: 16 Sep 2019 12:01 Fixed in next beta.

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC load with fc bug on calling sub

Post by admin »

No, this isn't the fix. It's a new warning when you try to overwrite your own functions. Looks like something is wrong with your script.

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC load with fc bug on calling sub

Post by Filehero »

Hmm, I never overwrite existing functions. Needs more time to check.

Thanks for your quick reply.

fishgod
Posts: 222
Joined: 03 Feb 2008 00:40
Location: Sankt Augustin (near Bonn), Germany

Re: SC load with fc bug on calling sub

Post by fishgod »

The new warning is a result of the discussion from this thread: viewtopic.php?f=3&t=20889&start=15#p172617

I also get this warning with my script, everything looks correct so far. Let me try to build a minimal example that causes the behaviour.
Operating System: Win10 x64 / Win7 x64 / almost allways newest XY-beta
totally XYscripting-addicted

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC load with fc bug on calling sub

Post by Filehero »

Just a first idea:

I have a script (script A) which references another one (script B, my core library) by include_once.
Within A I build up the source code for a third one (script C) which is finally run from A using load($mscript, , "s");.
Now, since the on-the-fly script C also references B I suspect this to be the cause of the problem somehow (nested scripts and includes).

But I have no further time right now, hope to find some tomorrow.

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC load with fc bug on calling sub

Post by Filehero »

This fixed my issue. What a relief - I got my core script functionality back. :D

Code: Select all

v20.40.0016 - 2019-09-25 13:12
    * Scripting: Removed that "A user function of the same name already exists!" 
      error message (added in v20.40.0006 - 2019-09-16 16:33). The script is not 
      terminated anymore, and the function in question is silently ignored (any 
      previous function of the same name is not overwritten by it).
      Reason: The error message was probably poorly implemented. It came up too 
      often and destroyed working user scripts.
I should have some drinks on that. :mrgreen:

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC load with fc bug on calling sub

Post by Filehero »

Hi Don,

have you done a "complete rollback"?

With some scripts I still see hickups, but before spending more time I want to be sure there isn't a more time-saving solution. :whistle:

Thanks,
Filehero

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC load with fc bug on calling sub

Post by admin »

Pretty complete. There was a fix concerning dupe user functions that I left in, of course. If your script relies on user functions overwriting each other then you have a problem. :)

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC load with fc bug on calling sub

Post by Filehero »

:mrgreen:

Ok, the mysterious overwritten function. Next week I'll find and "kill" it. :maf:
admin wrote: 27 Sep 2019 20:30 Pretty complete. There was a fix concerning dupe user functions that I left in, of course. If your script relies on user functions overwriting each other then you have a problem. :)

Post Reply