BUG ?

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderator: Klaus

Post Reply
ZoOoOoP
Posts: 10
Joined: Sun Feb 27, 2022 2:17 pm

BUG ?

Post by ZoOoOoP » Sun Jul 17, 2022 10:52 pm

- Create a new stack.

- Create a button.

- Button code :

Code: Select all

on mouseUp
   
   put "*/*" into XYZ
   if 1 = 1 then
      answer XYZ
   end if
   
end mouseUp
- No problem, all works as expected.

- On code page, click after "then", and after press "Enter/Return", bug ?

(i'm on MAC, and same on 9,6,6 and 10)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10309
Joined: Wed May 06, 2009 2:28 pm

Re: BUG ?

Post by dunbarx » Mon Jul 18, 2022 4:03 am

Fascinating. LC freezes just a bit.

It is the string "*/*" that is the issue. I tried a few others and they all acted appropriately.

If you hit Cmd-period a few times LC unfreezes itself, but if you hit return again it freezes again.

Anyone? Is that string some sort of odd regex/escape oddity that confounds the SE?

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10309
Joined: Wed May 06, 2009 2:28 pm

Re: BUG ?

Post by dunbarx » Mon Jul 18, 2022 4:15 am

The handler actually runs fine if one does not try to append a return after that line. But I find that oftentimes the SE itself will close after several Cmd-period keypresses. Other times it just unfreezes LC.

The string "*" works fine.
The string "*/" works fine.
The string "*/* shows the issue.
Any random string at all, of any length, if it contains "*/*" somewhere within it, the issue appears.

Craig

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4168
Joined: Sun Jan 07, 2007 9:12 pm

Re: BUG ?

Post by bn » Mon Jul 18, 2022 10:08 am

This only happens if "Control Structure Completion" is turned on in the Script Editor.

I know who the culprit is: it is yours truly...

See
https://quality.livecode.com/show_bug.cgi?id=22396

Also note that a proposed fix was not merged.
I tested with the proposed fix by applying the fix temporarily and it does prevent the hang.

Kind regards
Bernd

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10309
Joined: Wed May 06, 2009 2:28 pm

Re: BUG ?

Post by dunbarx » Mon Jul 18, 2022 2:36 pm

Fascinating again.

Bernd, can you explain how a quoted literal of any kind can wreak such havoc in a simple handler? In other words, what is the significance of that particular string?

Craig

stam
Posts: 3064
Joined: Sun Jun 04, 2006 9:39 pm

Re: BUG ?

Post by stam » Mon Jul 18, 2022 3:04 pm

dunbarx wrote:
Mon Jul 18, 2022 2:36 pm
Fascinating again.

Bernd, can you explain how a quoted literal of any kind can wreak such havoc in a simple handler? In other words, what is the significance of that particular string?

Craig
I suspect it’s because block commenting starts with /* and ends with */

But yeah, it’s surprising this is happening inside a string literal denoted by quotes…

stam
Posts: 3064
Joined: Sun Jun 04, 2006 9:39 pm

Re: BUG ?

Post by stam » Mon Jul 18, 2022 3:10 pm

Perhaps @ZoOoOoP can add to Bernd’s bug report above, might help bring to the forefront again for the dev team?

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4168
Joined: Sun Jan 07, 2007 9:12 pm

Re: BUG ?

Post by bn » Mon Jul 18, 2022 3:14 pm

stam wrote:
Mon Jul 18, 2022 3:10 pm
Perhaps @ZoOoOoP can add to Bernd’s bug report above, might help bring to the forefront again for the dev team?
ZoOoOoP has already reported this as a bug
https://quality.livecode.com/show_bug.cgi?id=23822

I have added a comment to that bug report

Kind regards
Bernd

stam
Posts: 3064
Joined: Sun Jun 04, 2006 9:39 pm

Re: BUG ?

Post by stam » Mon Jul 18, 2022 3:32 pm

FWIW, you can avoid the bug by constructing he string variable if you absolutely need this:

Code: Select all

on mouseUp
    local XYZ
    put "*/" into XYZ
    put "*" after XYZ
    if 1 = 1 then
        answer XYZ
    end if
end mouseUp
does not trigger the IDE stall... it's just the string literal */* that causes mayhem...

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4168
Joined: Sun Jan 07, 2007 9:12 pm

Re: BUG ?

Post by bn » Mon Jul 18, 2022 4:18 pm

dunbarx wrote:
Mon Jul 18, 2022 2:36 pm
Bernd, can you explain how a quoted literal of any kind can wreak such havoc in a simple handler? In other words, what is the significance of that particular string?
In this particular instance of the problem it was me searching for /* to eliminate comments. My code did not guard against quoted literals. The proposed fix is to eliminate all quoted literals because they are not necessary for formatting.

In a more general sense regarding the Script Editor the problem boils down to a difference between token and word as defined in LC.

try this
put
"/*"
into the field (including the quotes)

in the message box type
put word 1 of field "x" & return & token 1 of field "x"

The script editor uses different techniques to circumvent the problems but each "patch" has its own problems.

Kind regards
Bernd

Post Reply