I think I found a bug... but not sure.

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
richh
Posts: 41
Joined: Tue Jan 25, 2011 8:48 pm

I think I found a bug... but not sure.

Post by richh » Sat May 07, 2011 4:30 pm

So lately, I have been working with opening up files as binary then searching for specific information by hex. I came across something unusual and wanted to get addition opinions.

If I run this code in Windows, this statement is true. If I run the same code on a Mac, the statement is false.

Code: Select all

   if "00020000" = "20000d00" then
      answer "Equal"
   else
      answer "Not Equal"
   end if

According to logic, the statement should be false...

thoughts?
Last edited by richh on Sun May 08, 2011 12:31 am, edited 1 time in total.
- Rich

LiveCode 4.6.4
Dell Latitude E6400 running Windows XP SP3 / Mac Pro, Macbook Pro & Mac Mini running OS X 10.6.4

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

Re: I think I found a bug... but not sure.

Post by dunbarx » Sat May 07, 2011 6:15 pm

I am on a Mac, and I get "not equal". No surprise, the strings are different.

How could windows see these as the same? Is it just that Macs are superior machines?

Craig Newman

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: I think I found a bug... but not sure.

Post by bangkok » Sat May 07, 2011 6:59 pm

Holly cow !

I get "equal" on windows !

:shock:

That's a good one.

richh
Posts: 41
Joined: Tue Jan 25, 2011 8:48 pm

Re: I think I found a bug... but not sure.

Post by richh » Sat May 07, 2011 11:25 pm

Should I email Runrev to report the problem or is there a specific place I should go to report it?
- Rich

LiveCode 4.6.4
Dell Latitude E6400 running Windows XP SP3 / Mac Pro, Macbook Pro & Mac Mini running OS X 10.6.4

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

Re: I think I found a bug... but not sure.

Post by dunbarx » Sun May 08, 2011 2:56 am

Just tell Microsoft that their OS is awful, always was awful, and always will be.

Craig newman

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: I think I found a bug... but not sure.

Post by wsamples » Sun May 08, 2011 3:19 am

I think there are two problems here. One is with Livecode and how it evaluates strings it determines are numeric values. I'm running openSUSE and the above evaluates to "not equal", however changing the test to "00020000" = "20000"' evaluates to "true" which is correct only if we are considering numeric values. The strings are clearly not identical, which is what the question is since they are quoted strings. This also occurs in OS X. The remaining question is why is the string being treated as a numeric in Windows. This is definitely something to pass along to the devs.

richh
Posts: 41
Joined: Tue Jan 25, 2011 8:48 pm

Re: I think I found a bug... but not sure.

Post by richh » Sun May 08, 2011 5:07 am

Craig:

Though my personal preference is mac, my employer sees things differently :( Oh well, slowly but surely Microsoft is losing their market share :)


wsamples:

I agree; however, there is a 3rd element to the mix in which the string on the right contains the d character. I am curious if this character is being mistaken for 0 which would then follow suite to your conclusion.

if "00020000" = "20000d00" then

I will send an email to the dev team. Thank you everyone for their input.
- Rich

LiveCode 4.6.4
Dell Latitude E6400 running Windows XP SP3 / Mac Pro, Macbook Pro & Mac Mini running OS X 10.6.4

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: I think I found a bug... but not sure.

Post by wsamples » Sun May 08, 2011 5:11 am

:D I was about to edit my post to clarify that I meant was talking about the string containing the "d" being treated as a numeric in Windows... Yes, it is really very odd and not possible to guess if that happens somehow in the Livecode engine or in Windows.

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: I think I found a bug... but not sure.

Post by wsamples » Sun May 08, 2011 5:22 am

Some day I will learn to be thorough and efficient, but apparently I have a way to go...

The string containing the "d" is being truncated at the "d", which allows the statement to evaluate as true, based on the numeric value the string contains. This is NOT a good thing!

richh
Posts: 41
Joined: Tue Jan 25, 2011 8:48 pm

Re: I think I found a bug... but not sure.

Post by richh » Sun May 08, 2011 5:29 am

no worries it happens to me as well :P

I agree, this issue is not a good thing. I just sent an email to runrev's support team.
- Rich

LiveCode 4.6.4
Dell Latitude E6400 running Windows XP SP3 / Mac Pro, Macbook Pro & Mac Mini running OS X 10.6.4

Post Reply