bugGNU Octave - Bugs: bug #53027, Strange behavior of globals with...


bug #53027: Strange behavior of globals with load

Submitted by:  Lars Kindermann <larskindermann>
Submitted on:  Wed 31 Jan 2018 08:19:02 AM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  Kai Torben Ohlhus <siko1056>
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Fri 23 Mar 2018 10:42:18 AM UTC, comment #9:

@jwe: Wow, with your changes for me everything works as expected for all the considered examples and some software (INTLAB) that I regularly use. I consider this one as closed.

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Fri 23 Mar 2018 03:47:06 AM UTC, comment #8:

I pushed an additional changeset that allows the test in ntest53027b.m to pass and that also avoids a crash introduced in the previous changeset for the example code provided in bug #52722, which is now a test:


John W. Eaton <jwe>
Project Administrator
Thu 22 Mar 2018 10:28:00 PM UTC, comment #7:

I pushed the following changeset, including some new tests.


Note that there is still one case that I discovered that I don't have a fix for yet. See the comments in the new file test/bug-53027/ntest53027b.m for an explanation.

John W. Eaton <jwe>
Project Administrator
Thu 22 Mar 2018 07:48:52 PM UTC, comment #6:

Sure, thanks for looking into it. As you predicted, the Matlab R2017b output of file #43631:

Octave 4.2.2 and 4.3.0+ (without my patch file #43629):

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Thu 22 Mar 2018 04:17:14 PM UTC, comment #5:

Kai: I think the attached test is also wrong, with or without your change. I think it should return 0 for both of the exist tests. Can you confirm this behavior with Matlab?

(file #43631)

John W. Eaton <jwe>
Project Administrator
Thu 22 Mar 2018 12:06:05 PM UTC, comment #4:

For comment #1 I can confirm, that Octave 4.2.2 and Matlab R2017b behave this way.

The attached patch basically reverts the first two changes of jwe in libinterp/corefcn/symrec.h (cset http://hg.savannah.gnu.org/hgweb/octave/rev/2706adccf4e9#l3.1) and restores the behavior of comment #1.

For me this patch does not result in further regressions regarding the persistent issues in bug #52722 and can be applied soon with some comments and a test.

(file #43629)

Kai Torben Ohlhus <siko1056>
Project MemberIn charge of this item.
Mon 12 Feb 2018 10:15:34 PM UTC, comment #3:


I'm uploading the script bugGlobal2.m which is taken from comment #1.

Also adding jwe to the CC list since he fixed the issue in bug #52722 which likely caused this one.

Rik <rik5>
Project Administrator
Sun 11 Feb 2018 09:00:56 PM UTC, comment #2:

I am pretty sure this is related to changeset 24456:2706adccf4e9 and bug #52722 "fix binding for global variables in script files".

Probably that patch fixes the bug for setting globals in functions but not for loading them with load().

Lars Kindermann <larskindermann>
Thu 01 Feb 2018 12:07:06 PM UTC, comment #1:

It seems there is incorrectly created a second handle to the global X somewhere.

The bug is very nasty because many scripts now give bad results without any notice. It must habe been introduced within the last month or so. Here is a very basic script that demonstrates the error more clearly:

This should be the correct output (Version 4.0):

And this is from current dev:

Lars Kindermann <larskindermann>
Wed 31 Jan 2018 08:19:02 AM UTC, original submission:

load() of a global inside a function leads to several strange effects:
- The value outside the function does not change
- It cannot be cleared anymore

Test code (bugGlobal.m):

This is the correct output of version 4.0

This is the strange output of current dev

This is the even stranger output of a second execution of the code

Lars Kindermann <larskindermann>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #43631:  ntest.m added by jwe (195B - text/x-objcsrc)
file #43629:  bug53027.patch added by siko1056 (1KiB - text/x-patch)
file #43289:  bugGlobal2.m added by larskindermann (120B - text/x-objcsrc)
file #43137:  bugGlobal.m added by larskindermann (349B - text/x-objcsrc)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by larskindermann (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-23 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2018-03-22 jwe StatusPatch Submitted => Ready For Test
    2018-03-22 jwe Attached File- => Added ntest.m, #43631
    2018-03-22 siko1056 Assigned toNone => siko1056
    2018-03-22 siko1056 Attached File- => Added bug53027.patch, #43629
        StatusConfirmed => Patch Submitted
    2018-03-22 siko1056 Item GroupIncorrect Result => Regression
    2018-02-14 larskindermann Attached File- => Added bugGlobal2.m, #43289
    2018-02-12 rik5 StatusNone => Confirmed
    2018-02-12 rik5 Carbon-Copy- => Added jwe
    2018-01-31 larskindermann Attached File- => Added bugGlobal.m, #43137

    Back to the top

    Powered by Savane 3.4