bugGNU Octave - Bugs: bug #52722, global variables no longer defined

 
 

bug #52722: global variables no longer defined

Submitter:  Michael Godfrey <godfrey>
Submitted:  Fri 22 Dec 2017 12:57:08 AM UTC
   
 
Category:  Interpreter Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Michael Godfrey Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 11 Feb 2018 09:07:48 PM UTC, comment #12: 

The problem seems to be not yet fully solved, see bug #53027

Lars Kindermann <larskindermann>
Tue 26 Dec 2017 04:24:16 PM UTC, comment #11: 

Indeed, "eval" is not needed.  I removed it here (http://hg.savannah.gnu.org/hgweb/octave/rev/b1ae8fe2ee00).

Rik <rik5>
Group administrator
Sun 24 Dec 2017 04:57:09 PM UTC, comment #10: 

Why is eval needed?

The thing I was wondering about was whether our method of testing can properly handle things if they really do need to be evaluated as scripts at the top level, for example to test whether the top-level scope is working properly.  That might not be something that is needed here.

John W. Eaton <jwe>
Group administrator
Sun 24 Dec 2017 02:49:19 PM UTC, comment #9: 

Rik,

Very good! I should have noticed that this was the right
way to do this test. John seemed to indicate that there
was a problem. My code just "reinvented" it for this case...

Anyhow, somewhere it might be good to point out that
this is available for testing features/fixes to Octave
itself rather than function tests.

Michael Godfrey <godfrey>
Group Member
Sun 24 Dec 2017 05:06:08 AM UTC, comment #8: 

I added a test for this bug report here (http://hg.savannah.gnu.org/hgweb/octave/rev/b728b7ac1601).  Turns out it wasn't that hard.  We could use 'eval' to invoke the script rather than 'run-octave'.

Rik <rik5>
Group administrator
Sat 23 Dec 2017 11:22:00 PM UTC, comment #7: 

John,

The attached global_files.tar file contains a very simple
set of files such that make can be used to run
tests on Octave in a script. It just contains in
the directory global:
globals.m   defines a few global vraiables
gtest.m     contains tests if the variables exist
input.txt   used by makefile
makefile    run make to invoke it

This works running "standalone." It will take some additional
work to integrate it into the Octave make... Obviously, this
has to be run after run_octave has been generated.

But, does this look like a start? The framework can be used
for other tests at the octave top level.

Michael

(file #42709)

Michael Godfrey <godfrey>
Group Member
Sat 23 Dec 2017 12:24:50 AM UTC, comment #6: 

John,
Fix works for me.
Thanks and I will try to think of a way of testing
this kind of functionality.
All suggestions welcome, of course.
Michael

Michael Godfrey <godfrey>
Group Member
Fri 22 Dec 2017 11:45:24 PM UTC, comment #5: 

I checked in the following changeset:

  http://hg.savannah.gnu.org/hgweb/octave/rev/2706adccf4e9

It seems to fix the problem with global variables and scripts.

I'm not sure how to write a test for this because our tests run inside of functions.  To properly test scripts may require some other method?  I'm not sure.  But I'd be glad to include any test for this issue.

John W. Eaton <jwe>
Group administrator
Fri 22 Dec 2017 07:28:34 PM UTC, comment #4: 

John,
This seems likely. And, could I suggest a test
for correct behavior? It would seem that the test
could be pretty easy (sort of like my example)...

Michael

Michael Godfrey <godfrey>
Group Member
Fri 22 Dec 2017 05:27:59 PM UTC, comment #3: 

Oops.  I will take a look at this since I'm sure that I caused the problem with my recent changes to the symbol table and related objects.

John W. Eaton <jwe>
Group administrator
Fri 22 Dec 2017 04:08:15 PM UTC, comment #2: 

I bet this is related to the reason why ginput thas stopped working (bug #52699).  The implementation there relies on persistent variables, and those too seem broken.


Rik <rik5>
Group administrator
Fri 22 Dec 2017 01:48:09 PM UTC, comment #1: 

Specifically:

Files:
[godfrey@pbdsl4 global]$ more globals.m
       global a b c

[godfrey@pbdsl4 global]$ more gtest.m
globals

        xx = a;

Then at Octave prompt the result is:
octave:1> version
ans = 4.3.0+
octave:2>  _octave_config_info_ ("hg_id")
ans = e1651094f68b
octave:3> gtest
error: 'a' undefined near line 3 column 14
error: called from
    gtest at line 3 column 12
octave:3>

Michael Godfrey <godfrey>
Group Member
Fri 22 Dec 2017 12:57:08 AM UTC, original submission:  

I just noticed that global has recently stopped working.
I have a file globals.m which is included in a number of
other files using just:

globals

near to top of the file.

globals.m contains a list of variable names.

Under 4.2.1 and recent dev versions this worked. Under
the current version e1651094f68b none of the files
containing globals have any of the global variables defined.

Michael Godfrey <godfrey>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #42709:  global_files.tar added by godfrey (10KiB - application/x-tar)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-12-24 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2017-12-23 godfrey Attached File- Added global_files.tar, #42709
    2017-12-22 jwe StatusNone Ready For Test

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code