bugGNU Octave - Bugs: bug #58382, Incomplete symbol info when saving...

 
 

bug #58382: Incomplete symbol info when saving variables in a script

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Sun 17 May 2020 10:53:14 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 6.0.90 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 19 May 2020 08:40:30 AM UTC, comment #6: 

Thanks. This works for me now.

Closing as fixed.

Markus Mützel <mmuetzel>
Group administrator
Mon 18 May 2020 08:22:19 PM UTC, comment #5: 

I pushed a changeset to stable that appears to fix the problem for me:

http://hg.savannah.gnu.org/hgweb/octave/rev/8db2d4c9a64f

John W. Eaton <jwe>
Group administrator
Sun 17 May 2020 01:46:01 PM UTC, comment #4: 

It looks like nothing needs to be done for "Run Selection" in this case.

Re-titling the bug to better reflect the underlying issue.
Comment #1 gives good instructions to reproduce.

The problem is probably with something that happens inside this function in load-save.cc:

  size_t load_save_system::save_vars (std::ostream& os,
                                      const std::string& pattern,
                                      const load_save_format& fmt,
                                      bool save_as_floats)
  {
    tree_evaluator& tw = m_interpreter.get_evaluator ();

    symbol_info_list syminfo_list = tw.glob_symbol_info (pattern);

    size_t saved = 0;

    for (const auto& syminfo : syminfo_list)
      {
        do_save (os, syminfo, fmt, save_as_floats);

        saved++;
      }

    return saved;
  }


I don't know if a script should share its symbol info with its parent, or something different should be done here.

Adding jwe to the CC list since I think he is the only one who has a good understanding of the symbol info implementation.

Markus Mützel <mmuetzel>
Group administrator
Sun 17 May 2020 01:11:52 PM UTC, comment #3: 

Since "F9" just puts all selected commands into a script file and lets the interpreter source this file, this bug is just another symptom of the original issue. Therefore, I suggest to open a new bug report for the original issue.

Torsten Lilge <ttl>
Group Member
Sun 17 May 2020 01:06:21 PM UTC, comment #2: 

I can confirm your comment #1, Torsten.

Would fixing that bug also fix the original issue? Or should I open a new bug and let this one depend on a fix for the issue with "save" in scripts?

Markus Mützel <mmuetzel>
Group administrator
Sun 17 May 2020 12:50:40 PM UTC, comment #1: 

I can reproduce the issue, but it also occurs when executing a script file. When executing


A = 1


in the command line and running a script with


who
save ("A.mat", "A")


afterwards, the variable "A" is listed by "who" as a variable in the current scope but "save" fails with the same warning as in your post.

The documentation on script files says: "A script file also differs from a function file in that the variables named in a script file are not local variables, but are in the same scope as the other variables that are visible on the command line."

If I understand this correctly, "who" is behaving like expected, but "save" does not.

Torsten Lilge <ttl>
Group Member
Sun 17 May 2020 10:53:14 AM UTC, original submission:  

A variable in the current scope cannot be saved with "Run Selection" (F9):

A = 1;
save ("A.mat", "A");


First execute the first line of the code snippet. Then, select the second line and press F9.
The variable "A" should be stored in "A.mat". Instead, I see the following warning and the resulting file cannot be loaded:

warning: save: no such variable 'A'
warning: called from
    /tmp/octave/octave_cUzvHO.m at line 1 column 4


Markus Mützel <mmuetzel>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mmuetzel
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by mmuetzel (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-19 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-05-18 jwe StatusConfirmed Ready For Test
    2020-05-17 mmuetzel CategoryGUI Interpreter
        StatusNone Confirmed
        SummaryWrong scope when saving variables with &quot;Run Selection&quot; Incomplete symbol info when saving variables in a script
        Carbon-Copy- Added jwe

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code