bugGNU Octave - Bugs: bug #60493, ignore_function_time_stamp none...

 
 

bug #60493: ignore_function_time_stamp none has no effect

Submitter:  Tasos Papastylianou <tpapastylianou>
Submitted:  Sat 01 May 2021 04:29:18 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Need Info Assigned to:  None
Originator Name:  Tasos Papastylianou Open/Closed:  * Open
Release:  * 6.2.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 06 Dec 2021 08:07:34 PM UTC, comment #14: 

Dear Rik and Mike, sorry for the delay in responding to this ticket.

The documentation change is useful and welcome, and I can confirm that I can reproduce Mike's steps on my machine at this point in time, running octave 6.4.0.

I am happy that this ticket is resolved to my satisfaction within the scope of the original submission and the example I provided.

But.

Having said that, the original issue that prompted me to open this ticket (see [1] in the original submission, namely: https://stackoverflow.com/questions/67334895/access-private-functions-from-private-functions-in-octave-bug) persists, and it is true in that particular instance the ignore_function_time_stamp function does not resolve the issue, even though a manual edit has been performed, and that the problem persists until a manual "clear functions" has been issued.

Presumably this means I misrepresented the original issue, for which I can only apologise, and that a bug affecting ignore_function_time_stamp still persists, which is unrelated to whether a return to the interactive prompt has taken place or not.

If you prefer, I'm happy for this issue to be closed and a new one opened representing the bug shown in the more elaborate example in [1].

Again, apologies for the trouble my unfortunate choice of example has caused.

Tasos Papastylianou <tpapastylianou>
Mon 22 Nov 2021 01:43:11 AM UTC, comment #13: 

Marking as "Need Info".  Mike requested a test from Tasos on May 10th, 2021.  Still in progress.

Rik <rik5>
Group administrator
Mon 10 May 2021 10:41:18 PM UTC, comment #12: 

Tasos, does the attached change to the ignore_function_time_stamp doc string resolve this for you?

(file #51415)

Mike Miller <mtmiller>
Group Member
Sat 08 May 2021 06:49:08 AM UTC, comment #11: 

I reported the issue related to "is_system_fcn_file" as a separate bug http://savannah.gnu.org/bugs/index.php?60554

Anonymous
Sat 08 May 2021 12:28:20 AM UTC, comment #10: 

Regarding comment #7
I'm on Windows and cannot say it is reproducible unless someone test it on Windows.

Anonymous
Fri 07 May 2021 11:23:35 PM UTC, comment #9: 

I think documentation is all that is required.

Rik <rik5>
Group administrator
Fri 07 May 2021 04:23:47 PM UTC, comment #8: 

So to resolve this bug, should there be a documentation update to make it clear that the command prompt needs to be shown for any out-of-date checks to be performed? Is there some other resolution worth pursuing?

Mike Miller <mtmiller>
Group Member
Fri 07 May 2021 04:21:59 PM UTC, comment #7: 

I can't reproduce this latest comment, but if it were reproducible, please report "related" problems as separate bug reports.

Mike Miller <mtmiller>
Group Member
Fri 07 May 2021 01:29:15 PM UTC, comment #6: 

A related bug is that "octave_user_function::is_system_fcn_file ()" from version 6 onward doesn't work any more. I attached a .oct function "is_system_function" for test.

Example usage :


is_system_function ("unique")


which returns 1 on Octave 5 but returns 0 on Octave 6.


(file #51393)

Anonymous
Mon 03 May 2021 03:31:39 AM UTC, comment #5: 

I separated the single original script in to 4 scripts t1.m, t2.m, t3.m, t4.m.  Try running the sequence by starting Octave and then typing


t1
t2
t3
t4


This works for me and is similar to what Mike was proposing.  Each time Octave returns to the command prompt it has a chance to evaluate whether timestamps have changed.  The sequence works for me.

(file #51366, file #51367, file #51368, file #51369)

Rik <rik5>
Group administrator
Mon 03 May 2021 03:27:30 AM UTC, comment #4: 

Also, note that the original Stack Overflow example was done on Windows.  Time stamps on that platform can be horrendously crude (for example, everything within 100 milliseconds is tagged with the same timestamp).  That lack of precision is not Octave's fault.  Running interactively helps mitigate this because each change to an m-file is done after the user copy and pastes the new code and then hits return.  This operation typically takes at least 1 second so there is no issue with the imprecise timestamps.

Rik <rik5>
Group administrator
Sat 01 May 2021 07:46:43 PM UTC, comment #3: 

Sure, I mean that first I paste this into the command window and press Enter


fA = fopen( 'A.m', 'w' ); fprintf( fA, "function A()\n  disp( 'Hello from A' )\n  B()\nend\n" ); fclose( fA );
mkdir private
fB = fopen( 'private/B.m', 'w' ); fprintf( fB, "function B()\n  disp( 'Hello from B' )\n%%  C()\nend\n" ); fclose( fB );
fC = fopen( 'C.m', 'w' ); fprintf( fC, "function C()\n  disp( 'Hello from C' )\nend\n" ); fclose( fC );

fprintf( "-- before activating C within B --\n" )
A()


and I get back


-- before activating C within B --
Hello from A
Hello from B


Now I paste this and press Enter


fprintf( "-- after editing B and activating C within it --\n" )
fB = fopen( 'private/B.m', 'w' ); fprintf( fB, "function B()\n  disp( 'Hello from B' )\n  C()\nend\n" ); fclose( fB );
A()


and I get back


-- after editing B and activating C within it --
Hello from A
Hello from B
Hello from C


And lastly I paste this and press Enter


fprintf( "-- after clearing manually --\n" )
clear functions
A()


and of course I get back


-- after clearing manually --
Hello from A
Hello from B
Hello from C


Mike Miller <mtmiller>
Group Member
Sat 01 May 2021 07:15:31 PM UTC, comment #2: 

Hi Mike, thanks for the input!

Would you mind giving an example of what you mean?

The process I mention below (and also the one in the stackoverflow link) do not work as expected even when done manually with calls in the interpreter and edits done manually (i.e. not via fopen). If you edit the function files manually, the outcome is an error about C() being undefined,m as per the description in the stackoverflow link.

Tasos Papastylianou <tpapastylianou>
Sat 01 May 2021 07:10:03 PM UTC, comment #1: 

If my understanding is correct, the logic that checks whether a function is out of date only applies after returning from a script or a function call, to the interactive prompt. In other words, I think the working assumption is that a user would be editing function files, and not self-modifying code.

If you run the example interactively, it works as expected.

So maybe the docs should be updated to emphasize that this feature depends on interactive use.

Mike Miller <mtmiller>
Group Member
Sat 01 May 2021 04:29:18 PM UTC, original submission:  

According to the octave manual[0] the command


ignore_function_time_stamp none


will cause octave to "always check time stamps on files to determine whether functions defined in function files need to recompiled".

The intent of this command, as I understand it, is to always check files for modifications, allowing one to modify a function file and use the updated definition within an ongoing session, without having to restart the session, and without having to run "clear functions" first.

However, the command seems to have no effect in practice.

Example (adapted from [1]):


ignore_function_time_stamp none
fA = fopen( 'A.m', 'w' ); fprintf( fA, "function A()\n  disp( 'Hello from A' )\n  B()\nend\n" ); fclose( fA );
mkdir private
fB = fopen( 'private/B.m', 'w' ); fprintf( fB, "function B()\n  disp( 'Hello from B' )\n%%  C()\nend\n" ); fclose( fB );
fC = fopen( 'C.m', 'w' ); fprintf( fC, "function C()\n  disp( 'Hello from C' )\nend\n" ); fclose( fC );

fprintf( "-- before activating C within B --\n" )
A()

fprintf( "-- after editing B and activating C within it --\n" )
fB = fopen( 'private/B.m', 'w' ); fprintf( fB, "function B()\n  disp( 'Hello from B' )\n  C()\nend\n" ); fclose( fB );
A()

fprintf( "-- after clearing manually --\n" )
clear functions
A()


When the above is run as a script, the second step doesn't show the call to C(), even though that instruction is now 'active' (i.e. uncommented) in the file. Futhermore, if the modifications aren't made via 'fopen', but manually in an editor, this results in an explicit error, as detailed in [1].

If my understanding is correct, the role of 'ignore_function_time_stamp none' is to explicitly always check if a function file has been modified and fetch the updated definition before running it, so the above behaviour is not the intended behaviour. (I have no problem with this behaviour from an optimisation point of view, but based on the documentation of that command, this is a bug).

[0] https://octave.org/doc/v6.2.0/Function-Files.html#index-ignore_005ffunction_005ftime_005fstamp
[1] https://stackoverflow.com/questions/67334895/access-private-functions-from-private-functions-in-octave-bug

Tasos Papastylianou <tpapastylianou>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51415:  bug60493.diff added by mtmiller (1KiB - text/x-patch)
file #51393:  is_system_function.cc added by None (608B - application/octet-stream)
file #51366:  t1.m added by rik5 (438B - text/x-matlab)
file #51367:  t2.m added by rik5 (119B - text/x-matlab)
file #51368:  t3.m added by rik5 (68B - text/x-matlab)
file #51369:  t4.m added by rik5 (65B - text/x-matlab)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-22 rik5 StatusWorks For Me Need Info
    2021-05-10 mtmiller Attached File- Added bug60493.diff, #51415
    2021-05-07 None Attached File- Added is_system_function.cc, #51393
    2021-05-03 rik5 Attached File- Added t1.m, #51366
        Attached File- Added t2.m, #51367
        Attached File- Added t3.m, #51368
        Attached File- Added t4.m, #51369
        StatusNone Works For Me

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code