bugGNU Octave - Bugs: bug #58691, Variables cannot be set in a...

 
 

bug #58691: Variables cannot be set in a script called by a nested function

Submitted by:  Kai Torben Ohlhus <siko1056>
Submitted on:  Fri 03 Jul 2020 06:56:04 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

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)

Thu 09 Jul 2020 02:04:29 AM UTC, comment #7: 

Thank you for this small and elegant change jwe 🙂  I can confirm that for Octave 6

>> __octave_config_info__.hg_id
ans = dc53b7b7af8b

the original example works flawlessly.

Kai Torben Ohlhus <siko1056>
Project Member
Tue 07 Jul 2020 05:16:39 PM UTC, comment #6: 

I pushed the following changeset on stable and merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/c09bc9e108b5

John W. Eaton <jwe>
Project Administrator
Sat 04 Jul 2020 07:34:52 AM UTC, comment #5: 

Resetting to regression and raising priority again because this has the potential to break existing code.

Markus Mützel <mmuetzel>
Project Member
Fri 03 Jul 2020 04:45:40 PM UTC, comment #4: 

I saved the three files in the same folder and see the following in Octave 5.2:

>> script_nest
ans =  5
>> fcn_calls_script
ans =  5

That is what I would expect.

I see the following with Octave 6 (hg id 2de2b2ddd032):

>> script_nest
>> fcn_calls_script
ans = 5

That is not what I would expect.

It was working as expected in Octave 5. It no longer works as expected in Octave 6.
I'd say this is a regression.

Markus Mützel <mmuetzel>
Project Member
Fri 03 Jul 2020 03:45:22 PM UTC, comment #3: 

Better to say: "NEVER worked and nobody noticed or bothered."

Kai Torben Ohlhus <siko1056>
Project Member
Fri 03 Jul 2020 03:44:29 PM UTC, comment #2: 

@Markus, thanks for caring.  But there is no alarm here.  Please read my comment in https://hg.savannah.gnu.org/hgweb/octave/rev/286fe9352cd6, this feature has literally NEVER worked.  Our test suite was fooled 😉

Kai Torben Ohlhus <siko1056>
Project Member
Fri 03 Jul 2020 03:15:05 PM UTC, comment #1: 

This was still working correctly in Octave 5.2.0.

Marking as a regression and raising priority.

I'm also attaching the files for the example in comment #0.

The output in Octave 6.0.1 is here:

>> script_nest
>> fcn_calls_script
ans = 5

(file #49416, file #49417, file #49418)

Markus Mützel <mmuetzel>
Project Member
Fri 03 Jul 2020 06:56:04 AM UTC, original submission:  

Since bug #58686 was fixed, it became apparent, that variables cannot be set in a script called by a nested function, i.e. a builtin test of Octave passed, while it was not passing (false positive).

Example (from "scripts/test/nest") Matlab compatible:

% script_nest_script.m
x = 5;

% script_nest.m
function x = script_nest
  A (5)
  function A (n)
    if n <= 0
      script_nest_script;
    else
      A (n - 1);
    end%if
  end%function
end%function

% fcn_calls_script.m
function x = fcn_calls_script ()
  script_nest_script;
end%function

The desired output from Matlab R2020b is

>> script_nest

ans = 5

>> fcn_calls_script

ans = 5

but in Octave 6 and 7 (cset d5311ca8f945, 02 Jul 2020) the call to "script_nest" does not assign the output variable "x" set inside "script_nest_script".

Kai Torben Ohlhus <siko1056>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #49416:  fcn_calls_script.m added by mmuetzel (88B - text/plain)
file #49417:  script_nest.m added by mmuetzel (170B - text/plain)
file #49418:  script_nest_script.m added by mmuetzel (29B - text/plain)

 

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 (Updated the item)
  • -email is unavailable- added by siko1056 (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 16 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-09 siko1056 Priority7 - High => 5 - Normal
        StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2020-07-07 jwe StatusConfirmed => Ready For Test
    2020-07-04 mmuetzel Priority5 - Normal => 7 - High
        Item GroupMatlab Compatibility => Regression
    2020-07-03 siko1056 Priority7 - High => 5 - Normal
        Item GroupRegression => Matlab Compatibility
    2020-07-03 mmuetzel StatusNone => Confirmed
    2020-07-03 mmuetzel Attached File- => Added fcn_calls_script.m, #49416
        Attached File- => Added script_nest.m, #49417
        Attached File- => Added script_nest_script.m, #49418
        Severity1 - Wish => 3 - Normal
        Priority5 - Normal => 7 - High
        Item GroupMatlab Compatibility => Regression
        Releasedev => 6.0.90

    Back to the top


    Powered by Savane 3.5