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

 
 

bug #52722: global variables no longer defined

Submitted by:  Michael Godfrey <godfrey>
Submitted on:  Fri 22 Dec 2017 12:57:08 AM UTC  
 
Category: InterpreterSeverity: 5 - Blocker
Priority: 5 - NormalItem Group: Regression
Status: FixedAssigned to: None
Originator Name: Michael GodfreyOpen/Closed: Closed
Release: devOperating 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 Jump to the original submission)

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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project 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>
Project Member

 

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

Attach File(s):
   
   
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
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by godfrey (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 24 Dec 2017 05:06:08 AM UTCrik5StatusReady For Test=>Fixed
      Open/ClosedOpen=>Closed
    Sat 23 Dec 2017 11:22:00 PM UTCgodfreyAttached File-=>Added global_files.tar, #42709
    Fri 22 Dec 2017 11:45:24 PM UTCjweStatusNone=>Ready For Test

    Back to the top


    Powered by Savane 3.1-cleanup1