From: "drbrain (Eric Hodel)" Date: 2013-09-05T09:20:45+09:00 Subject: [ruby-core:57029] [ruby-trunk - Bug #8865] OptionParser acceptable bugs Issue #8865 has been updated by drbrain (Eric Hodel). File optparse.rb.accept.2.patch added Updated with patch 2 that includes tests ---------------------------------------- Bug #8865: OptionParser acceptable bugs https://bugs.ruby-lang.org/issues/8865#change-41624 Author: drbrain (Eric Hodel) Status: Assigned Priority: Normal Assignee: nobu (Nobuyoshi Nakada) Category: lib Target version: ruby -v: - Backport: 1.9.3: REQUIRED, 2.0.0: REQUIRED I have found a few bugs in OptionParser's accept feature: Hexadecimal and binary numbers are not properly supported for Integer OptionParser::DecimalInteger, OptionParser::OctalInteger and OptionParser::DecimalNumeric convert invalid input to 0 or nil instead of raising InvalidArgument. The attached patch fixes the validation regular expression for handling binary and hexadecimal arguments and adds verification for DecimalInteger, OctalInteger and DecimalNumeric -- http://bugs.ruby-lang.org/