bugGNU Octave - Bugs: bug #40368, octave_config_info() should be...

 
 

bug #40368: octave_config_info() should be read-only

Submitter:  Rik <rik5>
Submitted:  Fri 25 Oct 2013 02:52:29 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 25 Oct 2013 08:21:36 PM UTC, comment #6: 

It seems like this is the way The Mathworks wants us to behave, so I'm marking this bug as "Won't Fix" and closing it.

Rik <rik5>
Group administrator
Fri 25 Oct 2013 03:55:49 PM UTC, comment #5: 

I agree that overriding an existing variable should be allowed to happen, but the indexing with a string seems easy enough to catch.  I'll ask on the maintainer's list for someone to confirm Matlab behavior on this one.

Rik <rik5>
Group administrator
Fri 25 Oct 2013 03:19:05 PM UTC, comment #4: 

A warning about creating a variable with the same name as an existing function is probably not workable.  For efficiency, we'd probably want to do the check in the parser, not the evaluator, but the list of visible functions might not be the same when a statement is parsed vs. executed.

We do currently have a warning for the implicit conversion of the character array index to a numerical value, but it is disabled by default for improved Matlab compatibility.  I don't remember whether that default was chosen because of a complaint about compatibility, or if it was just something we did so that Octave's behavior would match Matlab.

I suppose it would be possible to warn about indexing with a character variable in addition to the warning about converting the index to a number.  I don't know whether that would generate complaints about unwanted warnings from Matlab users.

John W. Eaton <jwe>
Group administrator
Fri 25 Oct 2013 03:06:42 PM UTC, comment #3: 

Is there a way Octave could produce a warning message in this situation?  Trying to index into a non-existent variable with a string doesn't seem like something that the user intended.

More samples


a("junk") = "abc"
error: A(I) = X: X must have the same size as I
a("junk") = "abcd"
a = adcb


The assignment succeeds when the index expression on the left matches the size of the expression on the right.  And if you do an alphabetical sort on "junk" the ordering is [1 4 3 2] so it appears that it is doing a = "abcd"([1 4 3 2]).

Rik <rik5>
Group administrator
Fri 25 Oct 2013 04:45:20 AM UTC, comment #2: 

Hmm, I think this is not actually changing the value of the configuration variables.  But it is creating a new character variable with the name 'octave_config_info' that is mostly zeros.  After doing the assignment, look at the value of "toascii (octave_config_info)" and then do "clear octave_config_info" and then octave_config_info should again give you the configuration values.

So I think I'm going to have to close this one as invalid...

John W. Eaton <jwe>
Group administrator
Fri 25 Oct 2013 04:26:45 AM UTC, comment #1: 

Yeah, that should definitely not be happening because octave_config_info is a function that is just supposed to be returning a value.

It's weird that it also only seems to work for some RHS string lengths and not others.

John W. Eaton <jwe>
Group administrator
Fri 25 Oct 2013 02:52:29 AM UTC, original submission:  

The configuration information should be read-only (since you can't change configuration like which compiler you used at run-time).  However, the function octave_config_info supports assignment and it produces strange results.


octave:1> octave_config_info ('octetcdir')
ans = /home/rik/downloads/local/share/octave/3.7.7+/etc
octave:2> octave_config_info ('octetcdir') = '/home/rik'
octave_config_info = /rmi/ke
octave:3> octave_config_info ('octetcdir')
ans = //eme/rik


Rik <rik5>
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 rik5 (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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-10-25 rik5 Item GroupOther Matlab Compatibility
        StatusNone Wont Fix
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code