[OpenSIPS-Devel] [ opensips-Bugs-2907864 ] Early return from while() loop fails

SourceForge.net noreply at sourceforge.net
Fri Dec 11 12:31:25 CET 2009


Bugs item #2907864, was opened at 2009-12-03 03:41
Message generated for change (Comment added) made by bogdan_iancu
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2907864&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: trunk
Status: Open
>Resolution: Fixed
Priority: 7
Private: No
Submitted By: Norm Brandinger (norm_brandinger)
Assigned to: Bogdan-Andrei Iancu (bogdan_iancu)
Summary: Early return from while() loop fails

Initial Comment:
The simple example below reproduces the problem:

route {
    xlog("L_INFO", "Entering Route TEST\n");
    route(R_TEST);
    xlog("L_INFO", "Returning from Route TEST\n");
}

route[R_TEST] {
    $var(x) = 0;
    while ($var(x) < 5) {
        $var(x) = $var(x) + 1;
        xlog("L_INFO", "Route Test: x=$var(x)\n");
        if ($var(x) == 3) {
            return;
        }
    }
    return;
}

The logs produces are:

Entering Route TEST
Route Test: x=1
Route Test: x=2
Route Test: x=3

Note the the log message indicating a return from R_TEST is NOT produced.
If the while() condition is changed so that the loop completes all of its iterations, then the message indicating a return from R_TEST IS produced.


----------------------------------------------------------------------

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-12-11 13:31

Message:
Hi Norm,

Found and fixed! Please test and confirm (according to my testing it
should be ok).

Thanks & Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-12-11 12:09

Message:
Indeed, I was able to reproduce this ....

Let me work on it.

Regards,
Bogdan

----------------------------------------------------------------------

Comment By: Norm Brandinger (norm_brandinger)
Date: 2009-12-03 05:05

Message:
I've uploaded a patch that appears to correct this problem.  Independent
review should be done to confirm that this patch performs as expected.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=1086410&aid=2907864&group_id=232389



More information about the Devel mailing list