CreateRexxPort issue
Posted: Thu Oct 21, 2021 5:28 pm
I got an issue where my program's ARexx port name was changing to garbled strings. It was initially what I set it, but then during the usage port seemed to vanish (didn't work anymore), but with a closer look it was still there, but its name was trashed. Sometimes the name seemed to be some totally unrelated strings or so.. like it'd point to some memory area that got different content.
With some hunting and cutting the code down to pieces I was able to create this example. The code and port name work fine if I give the name directly to CreateRexxPort(), but if I try to make some conversion from lower case name to upper case, then it starts to act up. Funnily if UpperStr() doesn't need to change anything, issue doesn't seem to happen and everything works as it should be.
And this issue becomes visible only after some other action... the port name seems to be fine at first (the first p_port() check in this example), but then something triggers it (found it with ReadBytes() in my case).
Haven't tried this on other systems than MorphOS yet...
With some hunting and cutting the code down to pieces I was able to create this example. The code and port name work fine if I give the name directly to CreateRexxPort(), but if I try to make some conversion from lower case name to upper case, then it starts to act up. Funnily if UpperStr() doesn't need to change anything, issue doesn't seem to happen and everything works as it should be.
And this issue becomes visible only after some other action... the port name seems to be fine at first (the first p_port() check in this example), but then something triggers it (found it with ReadBytes() in my case).
Haven't tried this on other systems than MorphOS yet...
Code: Select all
; This doesn't work:
Const #APPNAME = "test"
; This works always:
;Const #APPNAME = "TEST"
Function p_port()
DebugPrint("Port check (" .. GetTime(True) .. "):", RunRexxScript("RETURN SHOW('P','TEST')", True))
EndFunction
CreateRexxPort(UpperStr(#APPNAME)) ; UpperStr causes problem here?
Local f=OpenFile(Nil,"System:Applications/OWB/OWB")
p_port() ; port name seems to be fine at this point still
Local data=ReadBytes(f,409600)
p_port() ; port name gets messed up after the previous line!
WaitLeftMouse()