PDA

View Full Version : IF statement evaluation bug?



MarkDynna
08-08-2014, 12:07 PM
I have an IF statement that says:
IF %_SB_ERRORCODE% = 0 OR %_SB_ERRORCODE% = 3010
(Do everything was good stuff)
ELSE
(Do there was an error stuff)

However, I am seeing behaviour where %_SB_ERRORCODE% = -206752967, but the installer is going into the "Do everything was good stuff"

Am I missing something obvious or is there a bug in the IF evaluation code?

linder
08-09-2014, 02:44 AM
Mark,

See attached screenshot. This code works okay.

Friedrich

linder
08-09-2014, 02:54 AM
BTW, please note that if you display the %SB_ERRORCODE% (e.g. using "Display Message Box") then this will change (reset) the "error code" value in the next step (e.g. to "0").

I have uploaded a demo project for you:

http://www.lindersoft.com/projects/IfStatementTest.zip

1. Unzip into a test folder
2. Compile "ReturnExitCodeDemo.sb8"
3. Compile and RUN "IfStetementTest.sb8"

It works as expected here.

Does this help?

Friedrich

MarkDynna
08-11-2014, 10:21 AM
BTW, please note that if you display the %SB_ERRORCODE% (e.g. using "Display Message Box") then this will change (reset) the "error code" value in the next step (e.g. to "0").


Oh, I didn't realize that displaying a message will reset the result. That fixes it.

andrelernhart
08-12-2014, 11:26 AM
Hi Friedrich,

sorry to bother you once again... but I have the strong suspiction that there IS an "IF" evaluation bug...

step 1: Install File (<some file from local machine> to <some file on target machine> [Feat:xy] (Patch)
step 2: Set Variable <my internal error catcher variable> to &_SB__ERRORCODE% (--> action to make sure that NO not-visible-SB-internal-action would change this value in between somewhen, someelse, somehow...)
step 3: IF <my internel error catcher variable> does not equal 1 or 2 (it doesn't), then ...hulahula... End

The block between "...hulahula..." and "End" IS executed even if <my internel error catcher variable> does not 1 or 2.

There is no IF...END mess in my script, everything is evenly balanced (even the SB8 "Script Structure Validation" gaves me the absolution)...

???

thanks ahead,
regards André

linder
08-12-2014, 11:36 AM
André,

I am not aware of any IF Statement bug (nothing changed in the IF Statement processing for 7+ years). Do you have a simple example project available?

Friedrich

linder
08-13-2014, 04:51 AM
I have opened a ticket to check this.

Friedrich

linder
08-13-2014, 05:36 AM
UPDATE: This is NOT a bug in SetupBuilder! Ticket closed. :)

Friedrich

andrelernhart
08-13-2014, 07:21 AM
Hi Friedrich,

thanks a lot for this fast reply.

I'm glad that my logical world is intact again and I'm sorry that there is a bug in SB. Knowing about this glitch will help to avoid more headache.

I'm confident that you will fix this in one of the next builds. Meanwhile, I will apply a workaround, no problem.

thanks & best regards
André

linder
08-13-2014, 08:09 AM
André,

I checked the logic and it's the expected result and not a bug in SB. Same statements compiled with Clarion and VC++ give the very same results.

Friedrich