bugGNU Octave - Bugs: bug #59342, [octave forge] (struct) Automatic...

 
 

bug #59342: [octave forge] (struct) Automatic variable `argn` has been removed

Submitter:  Markus Mützel <mmuetzel>
Submitted:  Sat 24 Oct 2020 08:40:55 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 08 Nov 2020 06:58:02 PM UTC, comment #2: 

Thanks for the explanation, fixed a bit differently since using cell2struct() probably wouldn't increase efficiency any more if we have to use a loop anyway:

https://sourceforge.net/p/octave/struct/ci/854fda65bc8b59933769aa0f701cacacab1878da/

The function is kept chiefly because it is used by the vrml package.

Closing this report.

Olaf Till <i7tiol>
Group Member
Mon 02 Nov 2020 07:58:11 PM UTC, comment #1: 

Direct use of 'argn' isn't recommended.  This is reaching deep in to the interpreter and private variables may change.  If you still want to use this code then you will need to replace argn with


__varval__ (".argn.")


but this is still vulnerable to name and syntax changes in the future.  A more robust, but longer, way might be


C = cell (nargin, 1);
for i = 1:nargin
  C(i) = inputname (i);
endfor


If we felt like it, inputname could be adjusted to accept a range of indices so you could call


inputname (1:nargin)


Rik <rik5>
Group administrator
Sat 24 Oct 2020 08:40:55 PM UTC, original submission:  

Running the BIST for `tars` of the package "struct" 1.0.16 in Octave 6.0.92 fails with the following error:

>> test tars
***** shared s, x, y, z
 x = 2;
 y = 3;
 z = "foo";
 s = tars (x, y, z);
!!!!! test failed
'argn' undefined near line 26, column 26
shared variables   scalar structure containing the fields:

    s = [](0x0)
    x = [](0x0)
    y = [](0x0)
    z = [](0x0)


It looks like the automatic variable `argn` has been removed. It should probably be replaced with `inputname (n)`.

CC'ing Olaf Till as the package maintainer.

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 i7tiol (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mmuetzel (Submitted the item)
  • -email is unavailable- added by mmuetzel
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-11-08 i7tiol StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2020-11-02 rik5 Item GroupNone Unexpected Error or Warning
        StatusNone Confirmed
    2020-10-24 mmuetzel Carbon-Copy- Added i7tiol

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code