bugGNU Octave - Bugs: bug #47818, Octave

 
 

bug #47818: Octave

Submitter:  Ezequiel Gaona <snd>
Submitted:  Sun 01 May 2016 07:00:53 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  SnD Open/Closed:  * Closed
Release:  * 4.0.1 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 02 May 2016 01:18:03 AM UTC, comment #3: 

This is basically bug #31080, which was reported a long time ago and has a lot more discussion on it, so I'm going to close this as a duplicate, but please add your comments there.

The root problem is probably related to the directory timestamp, and ignore_function_time_stamp only operates on known function files, not new ones.

Mike Miller <mtmiller>
Group Member
Sun 01 May 2016 07:05:11 PM UTC, comment #2: 

A workaround that works:

addpath("C:\example)
fid = fopen ("C:\example\foo.m", "wt");
fputs (fid, "function foo ()\n disp (\"This is function foo.\");\nendfunction\n");
fclose (fid);
addpath("C:\example)
fn = str2func ("foo");
fn ()

Ezequiel Gaona <snd>
Sun 01 May 2016 07:01:38 PM UTC, comment #1: 

ups... forgot to fill the title :S

Ezequiel Gaona <snd>
Sun 01 May 2016 07:00:53 PM UTC, original submission:  

This works:

fid = fopen ("foo.m", "wt");
fputs (fid, "function foo ()\n  disp (\"This is function foo.\");\nendfunction\n");
fclose (fid);
fn = str2func ("foo");
fn ()

This doesn't:

addpath("C:\example)
fid = fopen ("C:\example\foo.m", "wt");
fputs (fid, "function foo ()\n  disp (\"This is function foo.\");\nendfunction\n");
fclose (fid);
fn = str2func ("foo");
fn ()

That is because Octave doesn't refresh the functions in others directories, only the current path.

This is something that rehash would fix... right?

This fails too:

fid = fopen ("foo.m", "wt");
fputs (fid, "function foo ()\n  disp (\"This is function foo.\");\nendfunction\n");
fclose (fid);
rehash()
fn = str2func ("foo");
fn ()

Using ignore_function_time_stamp doesn't fix it:

ignore_function_time_stamp("none")
fid = fopen ("foo.m", "wt");
fputs (fid, "function foo ()\n  disp (\"This is function foo.\");\nendfunction\n");
fclose (fid);
fn = str2func ("foo");
fn ()

If I wait a while (like 1 min or something like that), I can do the str2func and works fine.

(Windows, no packages installed, octave 4 clean)

Maybe #35771 is related.

Ezequiel Gaona <snd>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-02 mtmiller Dependencies- Depends on bugs #31080
    2016-05-02 mtmiller Dependencies- Depends on bugs #35771
    2016-05-02 mtmiller StatusNone Duplicate
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code