On 02/23/10 11:07 AM, Alok Aggarwal wrote: > Hi Joe, > > On Tue, 23 Feb 2010, Joseph J VLcek wrote: > >> On 02/22/10 07:03 PM, Alok Aggarwal wrote: >>> Simple change for: >>> >>> 14208 "Welcome to the OpenSolaris snv_131 installation menu" doesn't >>> have a >>> default action >>> >>> Webrev: >>> http://cr.opensolaris.org/~aalok/webrev.14208/ >>> >>> Thanks, >>> Alok >>> _______________________________________________ >>> caiman-discuss mailing list >>> caiman-discuss at opensolaris.org >>> http://mail.opensolaris.org/mailman/listinfo/caiman-discuss >> >> Is there a way to confirm the size of menu_items[] ? >> >> What if the user enters a number which is beyond the end of >> menu_items[]? >> >> I am thinking how will the code avoid? >> >> Python 2.6.4 (r264:75706, Jan 31 2010, 11:27:34) [C] on sunos5 >> Type "help", "copyright", "credits" or "license" for more information. >>>>> menu_items=("aaa", "bbb", "ccc") >>>>> print menu_items[0] >> aaa >>>>> print menu_items[1] >> bbb >>>>> print menu_items[999] >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> IndexError: tuple index out of range >>>>> > > As we communicated offline, the script in question is a ksh93 script > rather than python and is thus not > subject to the above traceback. > > However, out of bounds checking should still be > happening there. I've filed the following bug to > track that - > > 14772 text-mode-menu.ksh should do out of bounds checking on user input > > Thanks for catching the bug!
An interesting side effect of that bug: if you enter a number that's out of range, that number is added to the menu (with a blank line after it). > Alok > _______________________________________________ > caiman-discuss mailing list > caiman-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/caiman-discuss