bugGNU Octave - Bugs: bug #52699, ginput() broken on dev

 
 

bug #52699: ginput() broken on dev

Submitter:  Rik <rik5>
Submitted:  Tue 19 Dec 2017 09:28:06 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 26 Dec 2017 06:37:13 PM UTC, comment #9: 

I added tests for emitting an error if a function parameter is declared persistent here http://hg.savannah.gnu.org/hgweb/octave/rev/2dc926274bce.  These are part of the fixed tests in the test/ directory.

I tried the equivalent with global (declaring the input or output of a function global) and there is no warning in Octave.  Should we at least warn about that as Matlab does?

Rik <rik5>
Group administrator
Mon 25 Dec 2017 07:47:19 PM UTC, comment #8: 

John.
Could we try your suggestion to not allow existing
variables to be made global?

If there is complaint from Matlab users other choices could
be considered, or??

After a moment's thought, I do not think that flag to allow
global of existing is a good idea at all.


Michael Godfrey <godfrey>
Group Member
Sun 24 Dec 2017 05:21:07 PM UTC, comment #7: 

This raises a question that I have wondered about: Is there
a case for a "Matlab compatibility" mode? This could be
set by some variable or option.

However, it would seem best to disallow making existing
variables or function parameters global. Use of global is
in any case prone to problems. (Even though I have used
it myself, I know that I should not.)

Michael Godfrey <godfrey>
Group Member
Sun 24 Dec 2017 05:00:27 PM UTC, comment #6: 

Matlab allows function parameters and existing variables to be made global, but there is a warning that the local value may change to match the global value and that this behavior may go away in some future release.  Who knows when that might be though.  I mean, it has been documented for many many years that isstr will go away and that you should use ischar instead, but that hasn't happened yet.

I would prefer that we disallow making existing variables (including function parameters) global the same as we do for persistent, but we would probably get complaints about how that behavior is not compatible with Matlab.

John W. Eaton <jwe>
Group administrator
Sun 24 Dec 2017 01:03:24 AM UTC, comment #5: 

Solution works for me.  Should there be a note in the manual about how persistent variables can't be input/output parameters for functions?

Does the restriction also apply to global variables?

Rik <rik5>
Group administrator
Sat 23 Dec 2017 07:35:16 PM UTC, comment #4: 

I checked in the following changeset:

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

Next, I'll see if I can make Octave throw an error if persistent is applied to function arguments (in or out).  I think this new behavior is compatible with Matlab.  Also, I don't really understand how it ever worked before.  Hmm.

John W. Eaton <jwe>
Group administrator
Sat 23 Dec 2017 12:23:55 AM UTC, comment #3: 

John,

Mistake: I meant this to go to bug #52722.
Will copy it there.
Michael

Michael Godfrey <godfrey>
Group Member
Sat 23 Dec 2017 12:14:24 AM UTC, comment #2: 

John,
Fix works for me.

Thanks and I will try to think of a way of testing
this kind of functionality.

All suggestions welcome, of course.

Michael

Michael Godfrey <godfrey>
Group Member
Fri 22 Dec 2017 11:58:04 PM UTC, comment #1: 

OK, I see this problem and I can confirm that it is due to some kind of problem with (re)initialization of persistent variables as you mentioned in bug #52722.  I'll try to take a look at that tomorrow.  It is probably a similar problem it does not appear to have exactly the same cause.

John W. Eaton <jwe>
Group administrator
Tue 19 Dec 2017 09:28:06 PM UTC, original submission:  

ginput appears broken on dev.  It looks like something is possibly resetting the persistent variables in the ginput_accumulator function.  Sample code


plot (1:10)
[x,y] = ginput (1)
## Click multiple times in plot, ginput() never terminates


The clicks are detected, as I found by putting a keyboard statement in the windowbuttondownfcn.  But these somehow aren't signaling to the accumulator to stop.

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

Digest:
   bug dependencies.

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-12-24 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2017-12-23 jwe StatusNone Ready For Test
    2017-12-21 rik5 Dependencies- bugs #52693 is dependent

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code