bugGNU Octave - Bugs: bug #45988, menu function returns 1 when no...

 
 

bug #45988: menu function returns 1 when no choice

Submitter:  Francesco Potortì <pot>
Submitted:  Thu 17 Sep 2015 12:13:34 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 22 Sep 2015 09:31:55 AM UTC, comment #6: 

Fixed with http://hg.savannah.gnu.org/hgweb/octave/rev/bb09279e5c99 on the default (development) branch

@Francesco Potortì: You can download the fixed menu.m from http://hg.savannah.gnu.org/hgweb/octave/file/bb09279e5c99/scripts/miscellaneous/menu.m and replace it in your install directory so you don't have to wait for the 4.2 release.

Closing as fixed

Andreas Weber <andy1978>
Group Member
Tue 22 Sep 2015 04:06:17 AM UTC, comment #5: 

This doesn't fix a regression or a segfault so it should be placed on the development branch.  Looks good to me.

Rik <rik5>
Group administrator
Tue 22 Sep 2015 01:32:21 AM UTC, comment #4: 

@Rik: Sure, can I push this to stable?

(file #34946)

Andreas Weber <andy1978>
Group Member
Sat 19 Sep 2015 09:33:22 PM UTC, comment #3: 

Confirmed.  I re-filed the bug as a Matlab compatibility issue.

@Andreas: Can you prepare a changeset to update the documentation and also return 0 if the Cancel button is used.

Rik <rik5>
Group administrator
Fri 18 Sep 2015 01:15:56 PM UTC, comment #2: 

argh, sorry, it should IMHO be

    if (! ok)
      choice = 0;
    endif


Andreas Weber <andy1978>
Group Member
Fri 18 Sep 2015 01:14:04 PM UTC, comment #1: 

I think menu should indeed return 0 if the user hits cancel (see Matlab documentation).

This seems like a bug in line 61
http://hg.savannah.gnu.org/hgweb/octave/file/ff904ae0285b/scripts/miscellaneous/menu.m#l61

which should IMHO be

    if (! ok)
      choice = 1;
    endif


Andreas Weber <andy1978>
Group Member
Thu 17 Sep 2015 12:13:34 PM UTC, original submission:  

I would expect the menu function to return 0 when no choice is made by opressing hte Cancel button.

However, 1 is returned.  This should be properly documented.

Francesco Potortì <pot>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34946:  menu.patch added by andy1978 (1KiB - text/x-patch)

 

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 andy1978 (Posted a comment)
  • -email is unavailable- added by pot (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
    2015-09-22 andy1978 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-09-22 andy1978 Attached File- Added menu.patch, #34946
    2015-09-19 rik5 Item GroupIncorrect Result Matlab Compatibility
        StatusNone Confirmed
    2015-09-18 andy1978 CategoryDocumentation Octave Function
        Item GroupDocumentation Incorrect Result
        Summarymenu function eturns 1 when no choice menu function returns 1 when no choice

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code